QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdm2dimsolver.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) 2010 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 fdm2dimsolver.hpp
21*/
22
23#ifndef quantlib_fdm_2_dim_solver_hpp
24#define quantlib_fdm_2_dim_solver_hpp
25
26#include <ql/handle.hpp>
27#include <ql/math/matrix.hpp>
31
32
33namespace QuantLib {
34
35 class BicubicSpline;
36 class FdmSnapshotCondition;
37
38 class Fdm2DimSolver : public LazyObject {
39 public:
40 Fdm2DimSolver(const FdmSolverDesc& solverDesc,
41 const FdmSchemeDesc& schemeDesc,
42 ext::shared_ptr<FdmLinearOpComposite> op);
43
44 Real interpolateAt(Real x, Real y) const;
45 Real thetaAt(Real x, Real y) const;
46
47 Real derivativeX(Real x, Real y) const;
48 Real derivativeY(Real x, Real y) const;
49 Real derivativeXX(Real x, Real y) const;
50 Real derivativeYY(Real x, Real y) const;
51 Real derivativeXY(Real x, Real y) const;
52
53 protected:
54 void performCalculations() const override;
55
56 private:
59 const ext::shared_ptr<FdmLinearOpComposite> op_;
60
61 const ext::shared_ptr<FdmSnapshotCondition> thetaCondition_;
62 const ext::shared_ptr<FdmStepConditionComposite> conditions_;
63
64 std::vector<Real> x_, y_, initialValues_;
66 mutable ext::shared_ptr<BicubicSpline> interpolation_;
67 };
68}
69
70#endif
void performCalculations() const override
std::vector< Real > initialValues_
Real derivativeXX(Real x, Real y) const
Real interpolateAt(Real x, Real y) const
const ext::shared_ptr< FdmStepConditionComposite > conditions_
const ext::shared_ptr< FdmSnapshotCondition > thetaCondition_
ext::shared_ptr< BicubicSpline > interpolation_
Real thetaAt(Real x, Real y) const
const FdmSolverDesc solverDesc_
std::vector< Real > y_
Real derivativeY(Real x, Real y) const
Real derivativeX(Real x, Real y) const
Real derivativeXY(Real x, Real y) const
Real derivativeYY(Real x, Real y) const
std::vector< Real > x_
const ext::shared_ptr< FdmLinearOpComposite > op_
const FdmSchemeDesc schemeDesc_
Framework for calculation on demand and result caching.
Definition: lazyobject.hpp:35
Matrix used in linear algebra.
Definition: matrix.hpp:41
QL_REAL Real
real number
Definition: types.hpp:50
Globally accessible relinkable pointer.
framework for calculation on demand and result caching
matrix used in linear algebra.
Definition: any.hpp:35