26#ifndef quantlib_abcd_interpolation_hpp
27#define quantlib_abcd_interpolation_hpp
38 class OptimizationMethod;
78 template <
class I1,
class I2>
94 ext::shared_ptr<EndCriteria> endCriteria,
95 ext::shared_ptr<OptimizationMethod> optMethod)
104 std::vector<Real> times, blackVols;
105 for ( ; x!=this->
xEnd_; ++x, ++
y) {
107 blackVols.push_back(*
y);
128 QL_REQUIRE(x>=0.0,
"time must be non negative: " <<
129 x <<
" not allowed");
135 QL_FAIL(
"Abcd secondDerivative not implemented");
160 template <
class I1,
class I2>
168 bool aIsFixed =
false,
169 bool bIsFixed =
false,
170 bool cIsFixed =
false,
171 bool dIsFixed =
false,
172 bool vegaWeighted =
false,
174 = ext::shared_ptr<EndCriteria>(),
175 const ext::shared_ptr<OptimizationMethod>& optMethod
176 = ext::shared_ptr<OptimizationMethod>()) {
178 impl_ = ext::shared_ptr<Interpolation::Impl>(
new
221 bool vegaWeighted =
false,
222 ext::shared_ptr<EndCriteria> endCriteria = ext::shared_ptr<EndCriteria>(),
223 ext::shared_ptr<OptimizationMethod> optMethod = ext::shared_ptr<OptimizationMethod>())
227 template <
class I1,
class I2>
229 const I2& yBegin)
const {
Abcd interpolation factory and traits
Abcd(Real a, Real b, Real c, Real d, bool aIsFixed, bool bIsFixed, bool cIsFixed, bool dIsFixed, bool vegaWeighted=false, ext::shared_ptr< EndCriteria > endCriteria=ext::shared_ptr< EndCriteria >(), ext::shared_ptr< OptimizationMethod > optMethod=ext::shared_ptr< OptimizationMethod >())
const ext::shared_ptr< OptimizationMethod > optMethod_
const ext::shared_ptr< EndCriteria > endCriteria_
Interpolation interpolate(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin) const
Abcd interpolation between discrete points.
EndCriteria::Type endCriteria()
AbcdInterpolation(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, Real a=-0.06, Real b=0.17, Real c=0.54, Real d=0.17, bool aIsFixed=false, bool bIsFixed=false, bool cIsFixed=false, bool dIsFixed=false, bool vegaWeighted=false, const ext::shared_ptr< EndCriteria > &endCriteria=ext::shared_ptr< EndCriteria >(), const ext::shared_ptr< OptimizationMethod > &optMethod=ext::shared_ptr< OptimizationMethod >())
const detail::AbcdCoeffHolder & coeffs() const
Real k(Time t, const I1 &xBegin, const I1 &xEnd) const
std::vector< Real > k() const
static void validate(Real a, Real b, Real c, Real d)
basic template implementation
templateImpl(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const int requiredPoints=2)
base class for 1-D interpolations.
ext::shared_ptr< Impl > impl_
Linear interpolation between discrete points
template class providing a null value for a given type.
AbcdCoeffHolder(Real a, Real b, Real c, Real d, bool aIsFixed, bool bIsFixed, bool cIsFixed, bool dIsFixed)
EndCriteria::Type abcdEndCriteria_
virtual ~AbcdCoeffHolder()=default
AbcdInterpolationImpl(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, Real a, Real b, Real c, Real d, bool aIsFixed, bool bIsFixed, bool cIsFixed, bool dIsFixed, bool vegaWeighted, ext::shared_ptr< EndCriteria > endCriteria, ext::shared_ptr< OptimizationMethod > optMethod)
ext::shared_ptr< AbcdCalibration > abcdCalibrator_
Real value(Real x) const override
Real derivative(Real) const override
Real secondDerivative(Real) const override
const ext::shared_ptr< OptimizationMethod > optMethod_
const ext::shared_ptr< EndCriteria > endCriteria_
Real primitive(Real) const override
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
base class for 1-D interpolations
linear interpolation between discrete points