本文整理汇总了C++中DVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::begin方法的具体用法?C++ DVector::begin怎么用?C++ DVector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVector
的用法示例。
在下文中一共展示了DVector::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forwardEstimation
void ThetaOperator::forwardEstimation(
boost::ptr_vector<MeshContext>& contextStack ,
FitobCalculator* calc ,
int& stackIndex ,
double& timeStamp ){
FITOB_OUT_LEVEL3(verb(),"ThetaOperator::forwardEstimation stackIndex:" << stackIndex << "timeStamp"
<< timeStamp << " contextStack.size():" << contextStack.size());
MeshContext& actualContext = contextStack[stackIndex];
if (thetaExpression_->isConstantExpression(actualContext) == false){
FITOB_ERROR_EXIT(" ThetaOperator, theta expression is not constant ");
}
// evaluate the the expression (theta time) and store it
thetaTime_ = thetaExpression_->eval(actualContext.minGlobCoord());
// todo: these values now are not taken in consideration,
// This might be a future feature, to split up one Theta operator in small theta operators
// in case of too large macro time step
// 19.09.2010 -> at todays knowledge this is not necessary, this would only make things worse
maxThetaTime_ = 10.0; //calc->getXMLConfiguration().get()->getDoubleConfiguration("thetaconfigurations.solver.maxThetaStep.<xmlattr>.value" );
nr_Theta_ = ceil(thetaTime_/maxThetaTime_);
const boost::shared_ptr<ModelCollection>& factorModels = calc->getModelCollection();
const boost::shared_ptr<ScriptModel>& scriptModel = calc->getScriptModel();
const OperatorSequence& scriptBody = scriptModel->bodyOpSeq();
const Domain& actDom = actualContext.getDom();
int nrFactors = factorModels->nrFactors();
Domain newDom(actDom);
FITOB_OUT_LEVEL3(verb(),"ThetaOperator::forwardEstimation nrFactors:" << factorModels->nrFactors() << " thetaTime:" << thetaTime_ );
for (int factorIndex = 0 ; factorIndex < nrFactors ; factorIndex++)
{
const FactorModelBase& model = factorModels->getModel(factorIndex);
int globalIndex = model.getGlobalIndex();
const DVector& startVal = calc->getStartDomain()->getGradedAxis(globalIndex);
// get the points of the normal distribution
DVector stdPoints;
returnScaledNormalDistribution( actDom.getMaximalLevel() ,
factorModels->stdFactor(factorIndex) , 1 , stdPoints );
FITOB_OUT_LEVEL3(verb(),"ThetaOperator::forwardEstimation factorIndex:" << factorIndex << " P.size():" << stdPoints.size());
// here we calculate the scaling
if (startVal.size() > 1){
for (unsigned int pointI = 0; pointI < stdPoints.size() ; pointI++ ){
double endVal = 0.0;
model.forwardEstimation(startVal[pointI] , timeStamp + thetaTime_ ,
stdPoints[pointI] , actDom.getAverage() , endVal );
if (verb()>3){
std::cout << endVal << ",";
}
stdPoints[pointI] = endVal;
}
if (verb()>3) std::cout << std::endl;
} else {
for (unsigned int pointI = 0; pointI < stdPoints.size() ; pointI++ ){
double endVal = 0.0;
model.forwardEstimation(startVal[0] , timeStamp + thetaTime_ ,
stdPoints[pointI] , actDom.getAverage() , endVal );
if (verb()>3){
std::cout << endVal << ",";
}
stdPoints[pointI] = endVal;
}
if (verb()>3) std::cout << std::endl;
}
//and call forwardEstimation_DiffusionEnlarement
int stackIndex_tmp = 0;
scriptBody.forwardEstimation_DiffusionEnlarement( contextStack ,
calc ,stdPoints , globalIndex , stackIndex_tmp , timeStamp );
// sort stdPoints vector - not necessary (even in mean reversion case)
// - this is not necessary since we estimate the values from 0 till T and not for dT
std::sort( stdPoints.begin(),stdPoints.end() );
// set the axis in the new domain
newDom.setAxis(stdPoints,globalIndex);
}
// add new context, extend contextStack
contextStack.push_back(new MeshContext(newDom,timeStamp));
FITOB_OUT_LEVEL3(verb(),"ThetaOperator::forwardEstimation New Domain:" << newDom.toString() );
timeStamp = timeStamp + thetaTime_;
stackIndex = stackIndex + 1;
}