29 ext::shared_ptr<Payoff>
payoff,
33 v_(
LsmBasisSystem::multiPathBasisSystem(assetNumber_, polynomialOrder, polynomialType)) {
39 "insufficient polynomial type");
41 const ext::shared_ptr<BasketPayoff> basketPayoff
42 = ext::dynamic_pointer_cast<BasketPayoff>(
payoff_);
43 QL_REQUIRE(basketPayoff,
"payoff not a basket payoff");
45 const ext::shared_ptr<StrikedTypePayoff> strikePayoff
46 = ext::dynamic_pointer_cast<StrikedTypePayoff>(basketPayoff->basePayoff());
48 if (strikePayoff !=
nullptr) {
68 const ext::shared_ptr<BasketPayoff> basketPayoff
69 = ext::dynamic_pointer_cast<BasketPayoff>(
payoff_);
70 QL_REQUIRE(basketPayoff,
"payoff not a basket payoff");
72 Real value = basketPayoff->accumulate(
state);
Real payoff(const Array &state) const
Real operator()(const MultiPath &path, Size t) const override
Array state(const MultiPath &path, Size t) const override
std::vector< ext::function< Real(Array)> > basisSystem() const override
std::vector< ext::function< Real(Array)> > v_
AmericanBasketPathPricer(Size assetNumber, ext::shared_ptr< Payoff > payoff, Size polynomialOrder=2, LsmBasisSystem::PolynomialType polynomialType=LsmBasisSystem::Monomial)
const ext::shared_ptr< Payoff > payoff_
1-D array used in linear algebra.
Correlated multiple asset paths.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
const ext::shared_ptr< Payoff > payoff_
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
utility classes for Longstaff-Schwartz early-exercise Monte Carlo
Least-square Monte Carlo engines.