QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdmklugeextouop.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 fdmklugeextouop.hpp
21 \brief Kluge process (power) plus Ornstein Uhlenbeck process (gas)
22*/
23
24#ifndef quantlib_fdm_kluge_ext_ou_op_hpp
25#define quantlib_fdm_kluge_ext_ou_op_hpp
26
30
31
32namespace QuantLib {
33
34 class FdmMesher;
35 class YieldTermStructure;
36 class KlugeExtOUProcess;
37 class ExtOUWithJumpsProcess;
38 class FdmExtOUJumpOp;
39 class FdmExtendedOrnsteinUhlenbeckOp;
40 class ExtendedOrnsteinUhlenbeckProcess;
41
42 /*! This class describes a correlated Kluge - extended Ornstein-Uhlenbeck
43 process governed by
44 \f[
45 \begin{array}{rcl}
46 P_t &=& \exp(p_t + X_t + Y_t) \\
47 dX_t &=& -\alpha X_tdt + \sigma_x dW_t^x \\
48 dY_t &=& -\beta Y_{t-}dt + J_tdN_t \\
49 \omega(J) &=& \eta e^{-\eta J} \\
50 G_t &=& \exp(g_t + U_t) \\
51 dU_t &=& -\kappa U_tdt + \sigma_udW_t^u \\
52 \rho &=& \mathrm{corr} (dW_t^x, dW_t^u)
53 \end{array}
54 \f]
55 */
56
57 /*! References:
58 Kluge, Timo L., 2008. Pricing Swing Options and other
59 Electricity Derivatives, http://eprints.maths.ox.ac.uk/246/1/kluge.pdf
60
61 http://spanderen.de/2011/06/13/vpp-pricing-i-stochastic-processes-partial-integro-differential-equation/
62 */
63
65 public:
67 const ext::shared_ptr<FdmMesher>& mesher,
68 const ext::shared_ptr<KlugeExtOUProcess>& klugeOUProcess,
69 const ext::shared_ptr<YieldTermStructure>& rTS,
70 const FdmBoundaryConditionSet& bcSet,
71 Size integroIntegrationOrder);
72
73 Size size() const override;
74 void setTime(Time t1, Time t2) override;
75
76 Array apply(const Array& r) const override;
77 Array apply_mixed(const Array& r) const override;
78
79 Array apply_direction(Size direction, const Array& r) const override;
80 Array solve_splitting(Size direction, const Array& r, Real s) const override;
81 Array preconditioner(const Array& r, Real s) const override;
82
83 std::vector<SparseMatrix> toMatrixDecomp() const override;
84
85 private:
86
87 const ext::shared_ptr<FdmMesher> mesher_;
88 const ext::shared_ptr<ExtOUWithJumpsProcess> kluge_;
89 const ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> extOU_;
90
91 const ext::shared_ptr<YieldTermStructure> rTS_;
93
94 const ext::shared_ptr<FdmExtOUJumpOp> klugeOp_;
95 const ext::shared_ptr<FdmExtendedOrnsteinUhlenbeckOp> ouOp_;
96
98 };
99}
100#endif
1-D array used in linear algebra.
Definition: array.hpp:52
const ext::shared_ptr< FdmExtOUJumpOp > klugeOp_
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 ext::shared_ptr< ExtendedOrnsteinUhlenbeckProcess > extOU_
const ext::shared_ptr< ExtOUWithJumpsProcess > kluge_
void setTime(Time t1, Time t2) override
Time is required.
const FdmBoundaryConditionSet bcSet_
Array apply_mixed(const Array &r) const override
const ext::shared_ptr< FdmMesher > mesher_
Array solve_splitting(Size direction, const Array &r, Real s) const override
const ext::shared_ptr< YieldTermStructure > rTS_
const NinePointLinearOp corrMap_
Array apply(const Array &r) const override
const ext::shared_ptr< FdmExtendedOrnsteinUhlenbeckOp > ouOp_
composite pattern for linear operators
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
nine point linear operator
ext::shared_ptr< YieldTermStructure > r