1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-04-29 01:05:54 +01:00

Dataset: integral conversion fixes

This commit is contained in:
Antonin Portelli 2015-02-13 15:26:23 +00:00
parent 60a010b592
commit cbb67c992f

View File

@ -94,20 +94,24 @@ void Dataset<T>::load(const std::string &listFileName,
template <typename T> template <typename T>
Sample<T> Dataset<T>::bootstrapMean(const Index nSample, RandGen& generator) Sample<T> Dataset<T>::bootstrapMean(const Index nSample, RandGen& generator)
{ {
Index nData = this->size(); typedef typename std::vector<const T *>::size_type size_type;
size_type nData = static_cast<size_type>(this->size());
std::vector<const T *> data(nData); std::vector<const T *> data(nData);
Sample<T> s(nSample); Sample<T> s(nSample);
for (Index j = 0; j < nData; ++j) for (size_type j = 0; j < nData; ++j)
{ {
data[j] = &((*this)[j]); data[j] = &((*this)[static_cast<Index>(j)]);
} }
ptVectorMean(s[central], data); ptVectorMean(s[central], data);
for (Index i = 0; i < nSample; ++i) for (Index i = 0; i < nSample; ++i)
{ {
for (Index j = 0; j < nData; ++j) for (size_type j = 0; j < nData; ++j)
{ {
data[j] = &((*this)[generator.discreteUniform(nData)]); Index k= static_cast<Index>(generator.discreteUniform(static_cast<unsigned int>(nData)));
data[j] = &((*this)[k]);
} }
ptVectorMean(s[i], data); ptVectorMean(s[i], data);
} }