#include <qle/math/randomvariablelsmbasissystem.hpp>
#include <ql/time/date.hpp>
#include <boost/test/unit_test.hpp>
Go to the source code of this file.
◆ BOOST_AUTO_TEST_CASE()
BOOST_AUTO_TEST_CASE |
( |
testBasisSystem1d |
| ) |
|
Definition at line 31 of file randomvariablelsmbasissystem.cpp.
31 {
32
33 BOOST_TEST_MESSAGE("Testing lsm basis system for random variables...");
34
35 constexpr double x0 = -2.0;
36 for (Size order = 0; order < 200; ++order) {
37 auto bs =
39 BOOST_REQUIRE(bs.size() == order + 1);
40 for (Size i = 0; i <= order; ++i) {
41 BOOST_CHECK_CLOSE(bs[i](
RandomVariable(1, x0)).at(0), std::pow(x0, i), 1E-10);
42 }
43 }
44}
static std::vector< std::function< RandomVariable(const RandomVariable &)> > pathBasisSystem(Size order, QuantLib::LsmBasisSystem::PolynomialType type)