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


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

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


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

示例1: HammingDistance

// Compute HammingDistance between two time series
size_t NTuple::HammingDistance( TimeSeries& t1, TimeSeries& t2 )
{
	size_t h = 0;
	TimeSeriesIter iter1 = t1.begin();
	TimeSeriesIter iter2 = t2.begin();
	while( iter1 != t1.end() && iter2 != t2.end() )
	{
		// Accumulate the Hamming distance for each NTuple
		h += *iter1++ - *iter2++;
	}
	return h;
}
开发者ID:PlantSimLab,项目名称:polynome,代码行数:13,代码来源:NTuple.cpp

示例2: Iterate

// Iterate only the k'th variable with respect to the given reference time series
size_t DynSysModel::Iterate( TimeSeries& ref_series, size_t k, TimeSeries& result, size_t kov )
{
	// Make sure the result is empty
	result.clear();

	// Hamming distance for bit k
	size_t h = 0;

	TimeSeriesIter t_iter = ref_series.begin();

	// Empty series in => empty series out
	if( t_iter == ref_series.end() ) return h;

	// Save the initial state as the first state in the result
	mState = *t_iter;

	// Force the knockout variable to zero - no longer needed, corrected when file is read in
	// if( kov != 0 ) mState.Reset(kov);
	result.push_back( mState );

	bool f;
	while( true )
	{
		// Merge the next state from the time series with the function evaluation
		// (a) increment iterator and check for end of time series
		++t_iter;
		if( t_iter == ref_series.end() ) break;

		// Evaluate the k'th polynomial at the current state
		//   to produce a new value for the k'th variable for time i+1
		f = mModel[k-1].Evaluate( mState );

		// (b) assign value pointed to by iterator to mState (t[i+1])
		mState = *t_iter;

		// Force the knockout variable to zero - no longer needed, corrected when file is read in
		// if( kov != 0 ) mState.Reset(kov);

		// Accumulate Hamming Distance =  t'[i+1][k] - t[i+1][k]
		h += (mState[k] ^ f) ? 1 : 0;

		// (c) create t'[i+1] = t[i+1] with k'th element replaced by f(t'[i])
		mState.Assign( k, f );

		// Save t'[i+1]
		result.push_back( mState );
	}
	return h;
}
开发者ID:PlantSimLab,项目名称:polynome,代码行数:50,代码来源:DynSysModel.cpp

示例3:

 std::vector<Real> IntervalPrice::extractValues(
                                        const TimeSeries<IntervalPrice>& ts,
                                        IntervalPrice::Type t)  {
     std::vector<Real> returnval;
     returnval.reserve(ts.size());
     for (TimeSeries<IntervalPrice>::const_iterator i = ts.begin();
          i != ts.end(); ++i) {
         returnval.push_back(i->second.value(t));
     }
     return returnval;
 }
开发者ID:grantathon,项目名称:nquantlib64,代码行数:11,代码来源:prices.cpp


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