Commit be8ee609 authored by Florian Goth's avatar Florian Goth
Browse files

some fixes.

parent 4772ea07
......@@ -1155,7 +1155,7 @@ private:
std::string filename;///< the bins are stored under this filename
uint32_t len;///< this is the length of a single valarray
uint32_t functions;///< this is the number of functions that a single function makes up
uint32_t binsize;///< the length of a bin bytes
uint32_t binsize;///< the length of a bin in bytes
static const size_type offs = 2*sizeof(uint32_t);///< where starts the beginning of the file
FileVector_Private::Lock* lock;
off64_t curpos;///<< here we store the current position. That way we get sometmes rid of an expensive sync that is incurred by fseek
......
......@@ -34,11 +34,11 @@ this function calculates the expectation value of the samples stored in the cont
@param len the length of the array
@return the average value of the stored samples
*/
template<typename T>
T expectationvalue(const T *const cont, unsigned int len)
template<typename T, typename IntType>
T expectationvalue(const T *const cont, IntType len)
{
T retval(cont[0]);
for (unsigned int k = 1; k < len; ++k)
for (IntType k = 1; k < len; ++k)
retval += cont[k];
return retval/static_cast<typename ToScalar<T>::RetType>(len);
}
......@@ -129,7 +129,7 @@ errordata<typename Func::res_t > vecjackknife(Func func, const Cont& data, unsig
{
typedef typename Cont::value_type::value_type ElementType;
typedef typename Func::res_t RetType;
unsigned int len = data[0].size();//we assume all datasets have the same length. this is the number of functions not the number of bins!!!
auto len = data[0].size();//we assume all datasets have the same length. this is the number of functions not the number of bins!!!
auto mean = mc_analysis::mean(data);
//mean now contains the averages of each dataset
auto x_J = mean;
......@@ -163,6 +163,7 @@ errordata<typename Func::res_t > vecjackknife(Func func, const Cont& data, unsig
double start = omp_get_wtime();
#endif
std::valarray<typename ToScalar<RetType>::RetType> cov(numcont*numcont);
#pragma omp parallel for schedule(dynamic)
for(uint y = 0; y < numcont; ++y)
{
for(uint x = 0; x < numcont; ++x)
......@@ -175,7 +176,7 @@ errordata<typename Func::res_t > vecjackknife(Func func, const Cont& data, unsig
}
}
#ifdef _OPENMP
std::cout<<"calculation took "<<omp_get_wtime() - start<<" s."<<std::endl;
std::cout<<"calculation of covariance took "<<omp_get_wtime() - start<<" s."<<std::endl;
#endif
retval.setCov(cov);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment