本文整理汇总了C++中Samples::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Samples::push_back方法的具体用法?C++ Samples::push_back怎么用?C++ Samples::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Samples
的用法示例。
在下文中一共展示了Samples::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateRange
BSplineInterpolation::Samples BSplineInterpolation::evaluateRange(
const float start, const float stop, const float stepsize)
{
Samples samples;
for (float x=start; x<stop; x+=stepsize) {
float y = evaluate(x);
samples.push_back(std::make_pair(x, y));
}
return samples;
}
示例2: motionBegin
void TransformStack::motionBegin( const std::vector<float> × )
{
// resample the current stack top at the specified times
Samples newSamples;
for( std::vector<float>::const_iterator it = times.begin(), eIt = times.end(); it != eIt; ++it )
{
newSamples.push_back( Sample( *it, get( *it ) ) );
}
m_stack.top() = newSamples;
m_motionIndex = 0;
}
示例3: create
RawSample* create(const string& sampleName) {
RawSample* sam = byNames[sampleName];
if (sam == NULL) {
// sample does not exist: create it
sam = new RawSample(sampleName);
samples.push_back(sam);
// register name
byNames[sampleName] = sam;
} else {
// sample already exists: not supported
throw runtime_error("Duplicate sample names are not permitted in RawSampleSet.");
}
return sam;
}
示例4:
void
diy::detail::KDTreeSamplingPartition<Block,Point>::
add_samples(Block* b, const diy::ReduceProxy& srp, Samples& samples) const
{
// dequeue and combine the samples
for (int i = 0; i < srp.in_link().size(); ++i)
{
int nbr_gid = srp.in_link().target(i).gid;
Samples smpls;
srp.dequeue(nbr_gid, smpls);
for (size_t i = 0; i < smpls.size(); ++i)
samples.push_back(smpls[i]);
}
}
示例5: exception
Y_PROGRAM_START()
{
Record::DataBase db;
for(int i=1;i<argc;++i)
{
const Record::Pointer r = new Record(argv[i]);
if(!db.insert(r))
{
throw exception("multiple file/conc '%s'",*(r->name));
}
}
const size_t nrec = db.size();
std::cerr << "Loaded #" << nrec << " files" << std::endl;
db.sort_keys(compare_natural);
Samples samples;
for( Iterator i=db.begin();i!=db.end();++i)
{
Record &r = **i;
std::cerr << r.filename << std::endl;
samples.push_back(r.sample);
}
assert(samples.size()==nrec);
////////////////////////////////////////////////////////////////////////////
//
// prepare fit
//
////////////////////////////////////////////////////////////////////////////
Fit::LeastSquares<double> ls;
Proton proton;
Fit::Type<double>::Function F( &proton, & Proton::Compute );
////////////////////////////////////////////////////////////////////////////
//
// First pass, individual fits
//
////////////////////////////////////////////////////////////////////////////
Variables &gvars = samples.variables;
Vector C;
Vector P;
Vector Q;
Vector pHi;
Vector pHe;
Vector T0;
{
gvars.free();
gvars << "p" << "q" << "vi" << "ve" << "t0";
const size_t nvar = gvars.size();
Vector aorg( nvar );
Vector aerr( nvar );
vector<bool> used( nvar, false);
{
ios::ocstream fp("ind.dat");
for( Iterator i=db.begin();i!=db.end();++i)
{
Record &r = **i;
Sample &sample = *r.sample;
r.vars = gvars;
std::cerr << "-- Individual for " << r.filename << std::endl;
std::cerr << r.name << ".vars=" << r.vars << std::endl;
gvars(aorg,"p") = 1.0;
gvars(aorg,"q") = r.thalf-r.t_min;
gvars(aorg,"vi") = r.pH_min;
gvars(aorg,"ve") = r.pH_end;
gvars(aorg,"ve") = 7.1;
tao::ld(used,false);
int level = 0;
gvars.display(std::cerr,aorg);
{
//gvars.on(used,"p");
gvars.on(used,"q");
++level;
std::cerr << "starting level " << level << " with: " << std::endl;
gvars.display(std::cerr,aorg);
if( !ls.fit( sample, F, aorg, aerr, used) )
{
throw exception("couldn't fit %s @level-%d", *(r.name), level );
}
//gvars.diplay(std::cerr, aorg, aerr, "\t");
//std::cerr << "\tR2=" << sample.computeR2() << std::endl;
}
if(false)
{
gvars.on(used,"p");
++level;
std::cerr << "starting level " << level << " with: " << std::endl;
gvars.display(std::cerr,aorg);
if( !ls.fit( sample, F, aorg, aerr, used) )
{
//.........这里部分代码省略.........