34#if defined(QL_PATCH_MSVC)
36#pragma warning(disable:4180)
39#include <boost/numeric/ublas/vector.hpp>
40#include <boost/numeric/ublas/operation.hpp>
42#if defined(QL_PATCH_MSVC)
49 const ext::shared_ptr<FdmMesher>& mesher,
50 const ext::shared_ptr<ExtOUWithJumpsProcess>& process,
51 const ext::shared_ptr<YieldTermStructure>& rTS,
53 Size integroIntegrationOrder)
58 gaussLaguerreIntegration_(integroIntegrationOrder),
59 x_ (mesher->locations(0)),
62 process->getExtendedOrnsteinUhlenbeckProcess(), rTS, bcSet)),
64 .mult(-process->
beta()*mesher->locations(1)))
76 for (
const auto& iter : *
mesher_->layout()) {
77 yLoc[iter.coordinates()[1]] =
mesher_->location(iter, 1);
80 for (
const auto& iter : *
mesher_->layout()) {
81 const Size diag = iter.index();
85 const Integer yIndex = iter.coordinates()[1];
87 for (
Size i=0; i < yInt.
size(); ++i) {
88 const Real weight = std::exp(-yInt[i])*weights[i];
90 const Real ys =
y + yInt[i]/eta;
92 : std::upper_bound(yLoc.
begin(),
95 const Real s = (ys-yLoc[l])/(yLoc[l+1]-yLoc[l]);
97 += weight*lambda*(1-
s);
105 return mesher_->layout()->dim().size();;
109 ouOp_->setTime(t1, t2);
123 return ouOp_->apply_direction(direction,
r);
124 else if (direction == 1)
127 return Array(
r.size(), 0.0);
133 if (direction == 0) {
134 return ouOp_->solve_splitting(direction,
r, a);
136 else if (direction == 1) {
145 return ouOp_->solve_splitting(0,
r, dt);
155 std::vector<SparseMatrix> retVal(1,
ouOp_->toMatrixDecomp().front());
1-D array used in linear algebra.
const_iterator end() const
Size size() const
dimension of the array
const_iterator begin() const
GaussLaguerreIntegration gaussLaguerreIntegration_
Size size() const override
Array apply_direction(Size direction, const Array &r) const override
Array preconditioner(const Array &r, Real s) const override
std::vector< SparseMatrix > toMatrixDecomp() const override
const TripleBandLinearOp dyMap_
void setTime(Time t1, Time t2) override
Time is required.
const FdmBoundaryConditionSet bcSet_
Array apply_mixed(const Array &r) const override
Array integro(const Array &r) const
FdmExtOUJumpOp(const ext::shared_ptr< FdmMesher > &mesher, const ext::shared_ptr< ExtOUWithJumpsProcess > &process, const ext::shared_ptr< YieldTermStructure > &rTS, const FdmBoundaryConditionSet &bcSet, Size integroIntegrationOrder)
const ext::shared_ptr< ExtOUWithJumpsProcess > process_
const ext::shared_ptr< FdmMesher > mesher_
SparseMatrix integroPart_
Array solve_splitting(Size direction, const Array &r, Real s) const override
Array apply(const Array &r) const override
const ext::shared_ptr< FdmExtendedOrnsteinUhlenbeckOp > ouOp_
SparseMatrix toMatrix() const override
Array solve_splitting(const Array &r, Real a, Real b=1.0) const
Array apply(const Array &r) const override
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
extended Ornstein-Uhlenbeck process
Ornstein Uhlenbeck process plus exp jumps (Kluge Model)
const ext::shared_ptr< YieldTermStructure > rTS_
Ornstein Uhlenbeck process plus jumps (Kluge Model)
Ornstein Uhlenbeck process plus jumps (Kluge Model)
memory layout of a fdm linear operator
const ext::shared_ptr< FdmMesher > mesher_
Real Time
continuous quantity with 1-year units
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
linear interpolation between discrete points
Array prod(const SparseMatrix &A, const Array &x)
boost::numeric::ublas::compressed_matrix< Real > SparseMatrix
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
ext::shared_ptr< YieldTermStructure > r
second derivative operator
Interest-rate term structure.