21#include <ql/processes/eulerdiscretization.hpp>
26 const QuantLib::ext::shared_ptr<CommoditySchwartzParametrization>& parametrization,
29 ?
QuantLib::ext::make_shared<EulerDiscretization>()
32 p_(parametrization) {}
35 if (
p_->driftFreeState())
38 return -
x0 *
p_->kappaParameter();
45 if (
p_->driftFreeState())
49 return x0 * (
exp(-
p_->kappaParameter() * dt) - 1.0);
55 if (
p_->driftFreeState())
56 return p_->variance(t0 + dt) -
p_->variance(t0);
59 Real kappa =
p_->kappaParameter();
60 Real sigma =
p_->sigmaParameter();
61 return sigma * sigma * (1.0 - std::exp(-2.0 * kappa * dt)) / (2.0 * kappa);
Real drift(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > p_
Real diffusion(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
Real variance(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > p_
Real diffusion(Time t, Real x) const override
CommoditySchwartzStateProcess(const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > ¶metrization, const CommoditySchwartzModel::Discretization discretization)
Real drift(Time t, Real x) const override
COM state process for the one-factor Schwartz model.
RandomVariable variance(const RandomVariable &r)
CompiledFormula exp(CompiledFormula x)