| 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 gemanroncoroniprocess.hpp |
| 21 | \brief Geman-Roncoroni process |
| 22 | */ |
| 23 | |
| 24 | #ifndef quantlib_geman_roncoroni_process_hpp |
| 25 | #define quantlib_geman_roncoroni_process_hpp |
| 26 | |
| 27 | #include <ql/stochasticprocess.hpp> |
| 28 | #include <ql/math/randomnumbers/rngtraits.hpp> |
| 29 | |
| 30 | namespace QuantLib { |
| 31 | |
| 32 | //! Geman-Roncoroni process class |
| 33 | /*! This class describes the Geman-Roncoroni process governed by |
| 34 | \f[ |
| 35 | \begin{array}{rcl} |
| 36 | dE(t) &=& \left[ \frac{\partial}{\partial t} \mu(t) |
| 37 | +\theta_1 \left(\mu(t)-E(t^-)\right)\right]dt |
| 38 | +\sigma dW(t) + h(E(t^-))dJ(t) \\ |
| 39 | \mu(t)&=& \alpha + \beta t +\gamma \cos(\epsilon+2\pi t) |
| 40 | +\delta \cos(\zeta + 4\pi t) |
| 41 | \end{array} |
| 42 | \f] |
| 43 | |
| 44 | \ingroup processes |
| 45 | */ |
| 46 | class GemanRoncoroniProcess : public StochasticProcess1D { |
| 47 | public: |
| 48 | GemanRoncoroniProcess(Real x0, |
| 49 | Real alpha, Real beta, |
| 50 | Real gamma, Real delta, |
| 51 | Real eps, Real zeta, Real d, |
| 52 | Real k, Real tau, |
| 53 | Real sig2, Real a, Real b, |
| 54 | Real theta1, Real theta2, Real theta3, |
| 55 | Real psi); |
| 56 | |
| 57 | Real x0() const override; |
| 58 | Real drift(Time t, Real x) const override; |
| 59 | Real diffusion(Time t, Real x) const override; |
| 60 | Real stdDeviation(Time t0, Real x0, Time dt) const override; |
| 61 | Real evolve(Time t0, Real x0, Time dt, Real dw) const override; |
| 62 | |
| 63 | Real evolve(Time t0, Real x0, Time dt, Real dw, const Array& du) const; |
| 64 | |
| 65 | private: |
| 66 | // avoid clang++ warnings |
| 67 | using StochasticProcess::evolve; |
| 68 | |
| 69 | const Real x0_; |
| 70 | const Real alpha_, beta_, gamma_, delta_; |
| 71 | const Real eps_, zeta_, d_; |
| 72 | const Real k_, tau_; |
| 73 | const Real sig2_, a_, b_; |
| 74 | const Real theta1_, theta2_, theta3_; |
| 75 | const Real psi_; |
| 76 | mutable ext::shared_ptr<PseudoRandom::urng_type> urng_; |
| 77 | }; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | #endif |
| 82 | |