QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmsimple3dextoujumpsolver.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2011 Klaus Spanderen
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file fdmsimple3dextoujumpsolver.hpp
21 \brief solver for simple swing options based on ext OU-Jump (Kluge) Model
22*/
23
24
25#ifndef quantlib_fdm_3d_ext_ou_jump_solver_hpp
26#define quantlib_fdm_3d_ext_ou_jump_solver_hpp
27
30#include <ql/handle.hpp>
36#include <utility>
37
38namespace QuantLib {
39
41 public:
43 ext::shared_ptr<YieldTermStructure> rTS,
44 FdmSolverDesc solverDesc,
45 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer())
46 : process_(process), rTS_(std::move(rTS)), solverDesc_(std::move(solverDesc)),
47 schemeDesc_(schemeDesc) {
48 registerWith(process);
49 }
50
51 Real valueAt(Real x, Real y, Real z) const {
52 calculate();
53 return solver_->interpolateAt(x, y, z);
54 }
55
56 protected:
57 void performCalculations() const override {
58 ext::shared_ptr<FdmLinearOpComposite>op(
60 process_.currentLink(),
61 rTS_, solverDesc_.bcSet, 32));
62
63 solver_ = ext::make_shared<Fdm3DimSolver>(
65 }
66
67 private:
69 const ext::shared_ptr<YieldTermStructure> rTS_;
72
73 mutable ext::shared_ptr<Fdm3DimSolver> solver_;
74 };
75}
76
77#endif
FdmSimple3dExtOUJumpSolver(const Handle< ExtOUWithJumpsProcess > &process, ext::shared_ptr< YieldTermStructure > rTS, FdmSolverDesc solverDesc, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer())
const ext::shared_ptr< YieldTermStructure > rTS_
ext::shared_ptr< Fdm3DimSolver > solver_
Real valueAt(Real x, Real y, Real z) const
const Handle< ExtOUWithJumpsProcess > process_
Shared handle to an observable.
Definition: handle.hpp:41
Framework for calculation on demand and result caching.
Definition: lazyobject.hpp:35
virtual void calculate() const
Definition: lazyobject.hpp:253
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Ornstein Uhlenbeck process plus exp jumps (Kluge Model)
Ornstein Uhlenbeck process plus jumps (Kluge Model)
QL_REAL Real
real number
Definition: types.hpp:50
Globally accessible relinkable pointer.
framework for calculation on demand and result caching
Definition: any.hpp:35
STL namespace.
static FdmSchemeDesc Hundsdorfer()
const FdmBoundaryConditionSet bcSet
const ext::shared_ptr< FdmMesher > mesher
Interest-rate term structure.