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


C++ MultiPath::pathSize方法代码示例

本文整理汇总了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_;
    }
开发者ID:pcaspers,项目名称:quantlib-old,代码行数:8,代码来源:mceuropeanhestonengine.hpp

示例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_;
    }
开发者ID:21hub,项目名称:QuantLib,代码行数:15,代码来源:mceuropeanbasketengine.cpp

示例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_;
}
开发者ID:Bernd8,项目名称:quantlib,代码行数:16,代码来源:mceverestengine.cpp

示例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));
    }
开发者ID:21hub,项目名称:QuantLib,代码行数:18,代码来源:mcpagodaengine.cpp


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