本文整理汇总了C++中Wrapper::GetLookAtTimes方法的典型用法代码示例。如果您正苦于以下问题:C++ Wrapper::GetLookAtTimes方法的具体用法?C++ Wrapper::GetLookAtTimes怎么用?C++ Wrapper::GetLookAtTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wrapper
的用法示例。
在下文中一共展示了Wrapper::GetLookAtTimes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Times
ExoticBSEngine::ExoticBSEngine(const Wrapper<PathDependent>& TheProduct_,
const Parameters& R_,
const Parameters& D_,
const Parameters& Vol_,
const Wrapper<RandomBase>& TheGenerator_,
double Spot_)
:
ExoticEngine(TheProduct_,R_),
TheGenerator(TheGenerator_)
{
MJArray Times(TheProduct_->GetLookAtTimes());
NumberOfTimes = Times.size();
TheGenerator->ResetDimensionality(NumberOfTimes);
// Here is the place for change of models for different products
Drifts.resize(NumberOfTimes);
StandardDeviations.resize(NumberOfTimes);
double Variance = Vol_.IntegralSquare(0,Times[0]);
Drifts[0] = R_.Integral(0.0,Times[0]) - D_.Integral(0.0,Times[0]) - 0.5 * Variance;
StandardDeviations[0] = sqrt(Variance);
// here calculates the r*dt sigma*dw
for (unsigned long j=1; j < NumberOfTimes; ++j)
{
double thisVariance = Vol_.IntegralSquare(Times[j-1],Times[j]);
Drifts[j] = R_.Integral(Times[j-1],Times[j]) - D_.Integral(Times[j-1],Times[j])
- 0.5 * thisVariance;
StandardDeviations[j] = sqrt(thisVariance);
}
LogSpot = log(Spot_);
Variates.resize(NumberOfTimes);
}
示例2: sqrt
ExoticBSEngineBB::ExoticBSEngineBB(const Wrapper<PathDependent>& TheProduct_,
const Parameters& R_,
const Parameters& D_,
const Parameters& Vol_,
const Wrapper<RandomBase>& TheGenerator_,
double Spot_,
bool speed_up_)
:
ExoticEngine(TheProduct_, R_, speed_up_),
TheGenerator(TheGenerator_)
{
NumberOfTimes = TheProduct_->GetLookAtTimes().size();
if (speed_up == true)
NumberOfTimes -= 1;
times.resize(NumberOfTimes);
out.resize(NumberOfTimes);
for (unsigned long i(0); i < NumberOfTimes;++i)
times[i] = TheProduct_->GetLookAtTimes()[i];
TheGenerator->ResetDimensionality(NumberOfTimes);
Drifts.resize(NumberOfTimes);
StandardDeviations.resize(NumberOfTimes);
Drifts[0] = R_.Integral(0.0,times[0]) - D_.Integral(0.0,times[0]) - 0.5 * Vol_.IntegralSquare(0.0,times[0]);
StandardDeviations[0] = sqrt(Vol_.IntegralSquare(0.0, times[0]));
for (unsigned long j=1; j < NumberOfTimes; ++j)
{
Drifts[j] = R_.Integral(times[j-1],times[j]) - D_.Integral(times[j-1],times[j])
- 0.5 * Vol_.IntegralSquare(times[j-1],times[j]);
StandardDeviations[j] = sqrt(Vol_.IntegralSquare(times[j - 1], times[j]));
}
LogSpot = std::log(Spot_);
Variates.resize(NumberOfTimes);
method_ = logscale;
}