当前位置: 首页>>代码示例>>C++>>正文


C++ TimeSeries::push_back方法代码示例

本文整理汇总了C++中TimeSeries::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSeries::push_back方法的具体用法?C++ TimeSeries::push_back怎么用?C++ TimeSeries::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeSeries的用法示例。


在下文中一共展示了TimeSeries::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Iterate

// Iterate from an initial state
void DynSysModel::Iterate( NTuple& initial_state, size_t length, TimeSeries& result )
{
	// Make sure the result is empty
	result.clear();

	// Save the initial state as the first time series entry
	result.push_back( initial_state );

	mState = initial_state;
	NTuple next_state;
	PolyModelIter iter;

	size_t i,k;
	for( i = length-1; i > 0; --i )
	{
		k = 1;
		// For each polynomial;
		next_state.Reset();
		iter = mModel.begin();
		while( iter != mModel.end() )
		{
			// Evaluate the k'th polynomial at the current state
			//   to produce a new value for the k'th variable
			next_state.Assign( k, mModel[k-1].Evaluate( mState ) );

			// next polynomial
			++iter; ++k;
		}
		// Update the current state to be the newly compute state
		mState = next_state;
		result.push_back( next_state );
	}
}
开发者ID:PlantSimLab,项目名称:polynome,代码行数:34,代码来源:DynSysModel.cpp

示例2: 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()) );

}
开发者ID:GrossfieldLab,项目名称:loos,代码行数:29,代码来源:boot_bcom.cpp

示例3: KoIterate

// Iterate from an initial state with the k'th function knocked out
void DynSysModel::KoIterate( NTuple& initial_state, size_t length, TimeSeries& result, size_t kov )
{
	// Make sure the result is empty
	result.clear();

	// Force k'th entry to zero in the initial state -  no longer needed, corrected when file is read in
	// NTuple state1 = initial_state;
	// state1.Reset( kov );

	// Save the initial state as the first time series entry
	result.push_back( initial_state );

	mState = initial_state;
	NTuple next_state;
	PolyModelIter iter;

	size_t i,k;
	for( i = length-1; i > 0; --i )
	{
		k = 1;
		// For each polynomial
		next_state.Reset();
		iter = mModel.begin();
		while( iter != mModel.end() )
		{
			// Force the knockout function result to zero
			if( k == kov )
			{
				next_state.Assign( k, 0 );
			}
			else
			{
				// Evaluate the k'th polynomial at the current state
				//   to produce a new value for the k'th variable
				next_state.Assign( k, mModel[k-1].Evaluate( mState ) );
			}

			// next polynomial
			++iter; ++k;
		}
		// Update the current state to be the newly compute state
		mState = next_state;
		result.push_back( next_state );
	}
}
开发者ID:PlantSimLab,项目名称:polynome,代码行数:46,代码来源:DynSysModel.cpp

示例4: FindMotifSub

void BFFindMotif::FindMotifSub(std::deque<Point> &window)
{
	size_t i = 0;
	for(i = 0; i < window.size() - m_MotifLength; ++i)
	{
		double distance = 0.0;
		bool newMotif = true;
		TimeSeries ts;
		ts.reserve(m_MotifLength);
		if(m_SlideWindow.size() >= m_MotifLength)		//	Only process slide window larger than motif length
		{
			//	Get time series
			for(size_t j = i; j < i + m_MotifLength; ++j)
			{
				ts.push_back(window[j].second);
			}

			//	Compare with candidate motif
			for(size_t j = 0; j < m_CandidateMotif.size(); ++j)
			{
				distance = EuclideanDistance(m_CandidateMotif[j].second, ts);

				if((2 * m_Radius > distance) && (m_Radius < distance))	//	Neither new motif nor similar motif
				{
					newMotif = false;
				}
				else if(m_Radius > distance)	//	Similar motif
				{
					m_CandidateMotif[j].first++;
					i += m_Step;
					newMotif = false;
					break;		//	Impossible to be similar with other candidates
				}
			}

			if(true == newMotif)	//	New motif
			{
				m_CandidateMotif.push_back(make_pair<long long, TimeSeries>(1, ts));
				i += m_Step;
			}
			
		}
		else
		{
			cerr << "Window size:" << m_SlideWindow.size() << endl;
		}
	
	}
	
	for(size_t k = 0; k < i; ++k)
	{
		window.pop_front();
	}
	
}
开发者ID:markatango,项目名称:otsm,代码行数:55,代码来源:motif.cpp

示例5: if

void SIMMA:: FindMotifSub(long &bufferCount)
{
	long lLastSize = m_K;			//	last size of candidate motif buffer
	long step = 32;

	size_t i = 0;
	for(i = 0; i < m_SlideWindow.size() - m_MotifLength; ++i)
	{
		double distance = 0.0;
		bool newMotif = true;
		TimeSeries ts;
		ts.reserve(m_MotifLength);

		++bufferCount;

		//	Check buffer when size big enough
		if(true == m_bBufferCheck)
		{
			if((2 * m_K < bufferCount) && (5 * m_K < (int)m_CandidateMotif.size()))
			{
				this->BufferCheck();
				lLastSize = m_SlideWindow.size();
				bufferCount = 0;
			}
		}

		if(m_SlideWindow.size() >= m_MotifLength)	//	Only process slide window larger than motif length
		{
			//	Get time series
			for(size_t j = i; j < i + m_MotifLength; ++j)
			{
				ts.push_back(m_SlideWindow[j].second);
			}

			//	Compare with candidate motif
			for(size_t j = 0; j < m_CandidateMotif.size(); ++j)
			{
				distance = EuclideanDistance(m_CandidateMotif[j].second, ts);

				if((2 * m_Radius > distance) && (m_Radius < distance))	//	Neither new motif nor similar motif
				{
					newMotif = false;
				}
				else if(m_Radius > distance)	//	Similar motif
				{
					m_CandidateMotif[j].first++;
					long jump = this->NonTrivialStep(i);

					if(0 != jump)
						i += jump;
					else
						i = m_SlideWindow.size() - m_MotifLength;

					newMotif = false;
					break;		//	Impossible to be similar with other candidates
				}
			}
			
			//	Check whether current time series is new motif
			if(true == newMotif)
			{
				m_CandidateMotif.push_back(make_pair<long long, TimeSeries>(1, ts));
				long jump = this->NonTrivialStep(i);

				if(0 != jump)
					i += jump;
				else
					i = m_SlideWindow.size() - m_MotifLength;
			}
		}
	}
	
	//	Remove used elements
	for(size_t k = 0; k < i; ++k)
	{
		m_SlideWindow.pop_front();
	}
}
开发者ID:markatango,项目名称:otsm,代码行数:78,代码来源:motif.cpp

示例6: 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";
}
开发者ID:GrossfieldLab,项目名称:loos,代码行数:76,代码来源:block_avgconv.cpp


注:本文中的TimeSeries::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。