本文整理汇总了C++中TimeSeries::average方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSeries::average方法的具体用法?C++ TimeSeries::average怎么用?C++ TimeSeries::average使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSeries
的用法示例。
在下文中一共展示了TimeSeries::average方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blocker
Datum blocker(const RealMatrix& Ua, const RealMatrix sa, const vGroup& ensemble, const uint blocksize, uint repeats, ExtractPolicy& policy) {
TimeSeries<double> coverlaps;
for (uint i=0; i<repeats; ++i) {
vector<uint> picks = pickFrames(ensemble.size(), blocksize);
if (debug) {
cerr << "***Block " << blocksize << ", replica " << i << ", picks " << picks.size() << endl;
dumpPicks(picks);
}
vGroup subset = subgroup(ensemble, picks);
boost::tuple<RealMatrix, RealMatrix> pca_result = pca(subset, policy);
RealMatrix s = boost::get<0>(pca_result);
RealMatrix U = boost::get<1>(pca_result);
if (length_normalize)
for (uint j=0; j<s.rows(); ++j)
s[j] /= blocksize;
coverlaps.push_back(covarianceOverlap(sa, Ua, s, U));
}
return( Datum(coverlaps.average(), coverlaps.variance(), coverlaps.size()) );
}
示例2: main
int main(int argc, char *argv[]) {
if (argc < 4 || argc > 6) {
cerr << "Usage- block_avgconv model traj sel [range [1 = do not align trajectory]]\n";
cerr << fullHelpMessage();
exit(-1);
}
string hdr = invocationHeader(argc, argv);
int k = 1;
AtomicGroup model = createSystem(argv[k++]);
pTraj traj = createTrajectory(argv[k++], model);
AtomicGroup subset = selectAtoms(model, argv[k++]);
vector<uint> sizes;
bool do_align = true;
if (argc == k) {
uint step = traj->nframes() / default_starting_number_of_blocks;
for (uint i=step; i<traj->nframes() * default_fraction_of_trajectory; i += step)
sizes.push_back(i);
} else {
sizes = parseRangeList<uint>(argv[k++]);
if (argc == k+1)
do_align = (argv[k][0] != '1');
}
cout << "# " << hdr << endl;
cout << "# n\tavg\tvar\tblocks\tstderr\n";
vector<AtomicGroup> ensemble;
cerr << "Reading trajectory...\n";
readTrajectory(ensemble, subset, traj);
if (do_align) {
cerr << "Aligning trajectory...\n";
boost::tuple<vector<XForm>, greal, int> result = iterativeAlignment(ensemble);
} else
cerr << "Trajectory is already aligned!\n";
cerr << "Processing- ";
for (uint block = 0; block < sizes.size(); ++block) {
if (block % 50)
cerr << ".";
uint blocksize = sizes[block];
vector<AtomicGroup> averages;
for (uint i=0; i<ensemble.size() - blocksize; i += blocksize) {
vector<uint> indices(blocksize);
for (uint j=0; j<blocksize; ++j)
indices[j] = i+j;
averages.push_back(averageSelectedSubset(ensemble, indices));
}
TimeSeries<double> rmsds;
for (uint j=0; j<averages.size() - 1; ++j)
for (uint i=j+1; i<averages.size(); ++i) {
AtomicGroup left = averages[j];
AtomicGroup right = averages[i];
left.alignOnto(right);
rmsds.push_back(left.rmsd(right));
}
double v = rmsds.variance();
uint n = averages.size();
cout << boost::format("%d\t%f\t%f\t%d\t%f\n") % blocksize % rmsds.average() % v % n % sqrt(v/n);
}
cerr << "\nDone!\n";
}