41 riskFreeRate_(
std::move(riskFreeRate)), dividendYield_(
std::move(dividendYield)),
43 lambda_(lambda), daysPerYear_(daysPerYear), discretization_(
d) {
62 const Real vol = (x[1] > 0.0) ? std::sqrt(x[1])
92 const Real sigma3 = Eml_e4 - q3*q3;
95 const Real sigma23 = 2.0*N + sigma12*sigma13;
96 const Real vol = (x[1] > 0.0) ? std::sqrt(x[1])
101 +
gamma_*sigma13) * vol * vol;
109 tmp[0][0] = vol; tmp[0][1] = 0.0;
110 tmp[1][0] = rho1; tmp[1][1] = rho2;
115 const Array& dx)
const {
116 return { x0[0] * std::exp(dx[0]), x0[1] + dx[1] };
124 const Real sdt = std::sqrt(dt);
133 const Real sigma3 = Eml_e4 - q3*q3;
136 const Real sigma23 = 2.0*N + sigma12*sigma13;
150 vol = (x0[1] > 0.0) ?
Real(std::sqrt(x0[1])) : 0.0;
157 retVal[0] = x0[0] * std::exp(mu*dt+vol*dw[0]*sdt);
158 retVal[1] = x0[1] +
nu*dt + sdt*vol*vol*(rho1*dw[0] + rho2*dw[1]);
161 vol = (x0[1] > 0.0) ?
Real(std::sqrt(x0[1])) : 0.0;
168 retVal[0] = x0[0] * std::exp(mu*dt+vol*dw[0]*sdt);
169 retVal[1] = x0[1] +
nu*dt + sdt*vol*vol*(rho1*dw[0] + rho2*dw[1]);
172 vol = std::sqrt(std::fabs(x0[1]));
179 retVal[0] = x0[0]*std::exp(mu*dt+vol*dw[0]*sdt);
181 +
nu*dt + sdt*vol*vol*(rho1*dw[0] + rho2*dw[1]);
184 QL_FAIL(
"unknown discretization schema");
Chi-square (central and non-central) distributions.
1-D array used in linear algebra.
Cumulative normal distribution function.
Euler discretization for stochastic processes.
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Size size() const override
returns the number of dimensions of the stochastic process
Array evolve(Time t0, const Array &x0, Time dt, const Array &dw) const override
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
const Handle< YieldTermStructure > & dividendYield() const
Time time(const Date &) const override
Discretization discretization_
GJRGARCHProcess(Handle< YieldTermStructure > riskFreeRate, Handle< YieldTermStructure > dividendYield, Handle< Quote > s0, Real v0, Real omega, Real alpha, Real beta, Real gamma, Real lambda, Real daysPerYear=252.0, Discretization d=FullTruncation)
Array initialValues() const override
returns the initial values of the state variables
Handle< YieldTermStructure > dividendYield_
Array apply(const Array &x0, const Array &dx) const override
const Handle< Quote > & s0() const
const Handle< YieldTermStructure > & riskFreeRate() const
Handle< YieldTermStructure > riskFreeRate_
Shared handle to an observable.
Matrix used in linear algebra.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
discretization of a stochastic process over a given time interval
multi-dimensional stochastic process class.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Euler discretization for stochastic processes.
GJR-GARCH(1,1) stochastic process.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
normal, cumulative and inverse cumulative distributions