/src/quantlib/ql/methods/finitedifferences/pdebsm.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2005 Joseph Wang |
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 pdebsm.hpp |
21 | | \brief Black-Scholes-Merton PDE |
22 | | */ |
23 | | |
24 | | #ifndef quantlib_pdebsm_hpp |
25 | | #define quantlib_pdebsm_hpp |
26 | | |
27 | | #include <ql/methods/finitedifferences/pde.hpp> |
28 | | #include <ql/processes/blackscholesprocess.hpp> |
29 | | #include <utility> |
30 | | |
31 | | namespace QuantLib { |
32 | | |
33 | | QL_DEPRECATED_DISABLE_WARNING |
34 | | |
35 | | /*! \deprecated Part of the old FD framework; copy this function |
36 | | in your codebase if needed. |
37 | | Deprecated in version 1.37. |
38 | | */ |
39 | | class [[deprecated("Part of the old FD framework; copy this function in your codebase if needed")]] PdeBSM : public PdeSecondOrderParabolic { |
40 | | public: |
41 | | typedef ext::shared_ptr<GeneralizedBlackScholesProcess> argument_type; |
42 | | typedef LogGrid grid_type; |
43 | 0 | PdeBSM(argument_type process) : process_(std::move(process)){}; |
44 | 0 | Real diffusion(Time t, Real x) const override { return process_->diffusion(t, x); } |
45 | 0 | Real drift(Time t, Real x) const override { return process_->drift(t, x); } |
46 | 0 | Real discount(Time t, Real) const override { |
47 | 0 | if (std::fabs(t) < 1e-8) t = 0; |
48 | 0 | return process_->riskFreeRate()-> |
49 | 0 | forwardRate(t,t,Continuous,NoFrequency,true); |
50 | 0 | } |
51 | | |
52 | | private: |
53 | | const argument_type process_; |
54 | | }; |
55 | | |
56 | | QL_DEPRECATED_ENABLE_WARNING |
57 | | |
58 | | } |
59 | | |
60 | | |
61 | | #endif |