QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmbackwardsolver.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Andreas Gaida
5 Copyright (C) 2009 Ralph Schreyer
6 Copyright (C) 2009 Klaus Spanderen
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
25#ifndef quantlib_fdm_backward_solver_hpp
26#define quantlib_fdm_backward_solver_hpp
27
28#include <ql/methods/finitedifferences/utilities/fdmboundaryconditionset.hpp>
29
30namespace QuantLib {
31
32 class FdmLinearOpComposite;
33 class FdmStepConditionComposite;
34
41
43
45 const Real theta, mu;
46
47 // some default scheme descriptions
48 static FdmSchemeDesc Douglas(); //same as Crank-Nicolson in 1 dimension
57 Real eps=0.001, Real relInitStepSize=0.01);
58 static FdmSchemeDesc TrBDF2();
59 };
60
62 public:
64
65 FdmBackwardSolver(ext::shared_ptr<FdmLinearOpComposite> map,
67 const ext::shared_ptr<FdmStepConditionComposite>& condition,
68 const FdmSchemeDesc& schemeDesc);
69
70 void rollback(array_type& a,
71 Time from, Time to,
72 Size steps, Size dampingSteps);
73
74 protected:
75 const ext::shared_ptr<FdmLinearOpComposite> map_;
77 const ext::shared_ptr<FdmStepConditionComposite> condition_;
79 };
80}
81
82#endif
1-D array used in linear algebra.
Definition: array.hpp:52
void rollback(array_type &a, Time from, Time to, Size steps, Size dampingSteps)
FdmLinearOp::array_type array_type
const FdmBoundaryConditionSet bcSet_
const ext::shared_ptr< FdmLinearOpComposite > map_
const ext::shared_ptr< FdmStepConditionComposite > condition_
const FdmSchemeDesc schemeDesc_
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
static FdmSchemeDesc MethodOfLines(Real eps=0.001, Real relInitStepSize=0.01)
static FdmSchemeDesc TrBDF2()
static FdmSchemeDesc CrankNicolson()
static FdmSchemeDesc Douglas()
static FdmSchemeDesc CraigSneyd()
static FdmSchemeDesc ModifiedCraigSneyd()
static FdmSchemeDesc ExplicitEuler()
static FdmSchemeDesc ImplicitEuler()
static FdmSchemeDesc ModifiedHundsdorfer()
const FdmSchemeType type
static FdmSchemeDesc Hundsdorfer()