本文整理汇总了C++中MultiPath::pathSize方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiPath::pathSize方法的具体用法?C++ MultiPath::pathSize怎么用?C++ MultiPath::pathSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiPath
的用法示例。
在下文中一共展示了MultiPath::pathSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
inline Real EuropeanHestonPathPricer::operator()(
const MultiPath& multiPath) const {
const Path& path = multiPath[0];
const Size n = multiPath.pathSize();
QL_REQUIRE(n>0, "the path cannot be empty");
return payoff_(path.back()) * discount_;
}
示例2: operator
Real EuropeanMultiPathPricer::operator()(const MultiPath& multiPath)
const {
Size n = multiPath.pathSize();
QL_REQUIRE(n>0, "the path cannot be empty");
Size numAssets = multiPath.assetNumber();
QL_REQUIRE(numAssets>0, "there must be some paths");
Size j;
// calculate the final price of each asset
Array finalPrice(numAssets, 0.0);
for (j = 0; j < numAssets; j++)
finalPrice[j] = multiPath[j].back();
return (*payoff_)(finalPrice) * discount_;
}
示例3: operator
Real EverestMultiPathPricer::operator()(const MultiPath& multiPath) const {
Size n = multiPath.pathSize();
QL_REQUIRE(n>0, "the path cannot be empty");
Size numAssets = multiPath.assetNumber();
QL_REQUIRE(numAssets>0, "there must be some paths");
// We search the yield min
Real minYield = multiPath[0].back() / multiPath[0].front() - 1.0;
for (Size j=1; j<numAssets; ++j) {
Rate yield = multiPath[j].back() / multiPath[j].front() - 1.0;
minYield = std::min(minYield, yield);
}
return (1.0 + minYield + guarantee_) * notional_ * discount_;
}
示例4: operator
Real PagodaMultiPathPricer::operator()(const MultiPath& multiPath) const {
Size numAssets = multiPath.assetNumber();
Size numSteps = multiPath.pathSize();
Real averagePerformance = 0.0;
for (Size i = 1; i < numSteps; i++) {
for (Size j = 0; j < numAssets; j++) {
averagePerformance +=
multiPath[j].front() *
(multiPath[j][i]/multiPath[j][i-1] - 1.0);
}
}
averagePerformance /= numAssets;
return discount_ * fraction_
* std::max<Real>(0.0, std::min(roof_, averagePerformance));
}