30#include <boost/numeric/ublas/matrix.hpp>
35 const ext::shared_ptr<FdmMesher>& mesher,
36 ext::shared_ptr<YieldTermStructure> rTS,
41 "mesher and lambdas need to be of the same dimension");
43 for (
Size i=0; i < lambdas.
size(); ++i)
44 ops_.emplace_back(ext::make_shared<TripleBandLinearOp>(
46 .mult(
Array(mesher->layout()->size(), 0.5*lambdas[i])))
61 for (
const auto& op:
ops_)
72 return ops_[direction]->apply(x);
78 return ops_[direction]->solve_splitting(x,
s, 1.0);
86 std::vector<SparseMatrix> retVal;
88 retVal.reserve(
ops_.size());
89 for (
const auto& op:
ops_)
90 retVal.push_back(op->toMatrix());
1-D array used in linear algebra.
Size size() const
dimension of the array
Array solve_splitting(Size direction, const Array &x, Real s) const override
FdmWienerOp(const ext::shared_ptr< FdmMesher > &mesher, ext::shared_ptr< YieldTermStructure > rTS, const Array &lambdas)
Size size() const override
Array preconditioner(const Array &r, Real s) const override
std::vector< SparseMatrix > toMatrixDecomp() const override
Array apply_mixed(const Array &x) const override
void setTime(Time t1, Time t2) override
Time is required.
std::vector< ext::shared_ptr< TripleBandLinearOp > > ops_
Array apply(const Array &x) const override
Array apply_direction(Size direction, const Array &x) const override
const ext::shared_ptr< YieldTermStructure > rTS_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
const ext::shared_ptr< YieldTermStructure > rTS_
memory layout of a fdm linear operator
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
ext::shared_ptr< YieldTermStructure > r
second derivative operator
Interest-rate term structure.