25#ifndef quantlib_log_interpolation_hpp
26#define quantlib_log_interpolation_hpp
36 template<
class I1,
class I2,
class I>
class LogInterpolationImpl;
48 template <
class I1,
class I2>
51 impl_ = ext::shared_ptr<Interpolation::Impl>(
new
62 template <
class I1,
class I2>
64 const I2& yBegin)
const {
76 template <
class I1,
class I2>
82 Real leftConditionValue,
84 Real rightConditionValue) {
85 impl_ = ext::shared_ptr<Interpolation::Impl>(
new
89 leftC, leftConditionValue,
90 rightC, rightConditionValue)));
100 bool monotonic =
true,
103 Real leftConditionValue = 0.0,
106 Real rightConditionValue = 0.0)
110 template <
class I1,
class I2>
112 const I2& yBegin)
const {
155 template <
class I1,
class I2>
168 template <
class I1,
class I2>
181 template <
class I1,
class I2>
194 template <
class I1,
class I2>
207 template <
class I1,
class I2>
220 template <
class I1,
class I2>
233 template <
class I1,
class I2>
248 template <
class I1,
class I2>
250 const I2& yBegin,
const Size n,
255 Real leftConditionValue,
257 Real rightConditionValue) {
258 impl_ = ext::shared_ptr<Interpolation::Impl>(
new
260 xBegin, xEnd, yBegin,
262 leftC, leftConditionValue,
263 rightC, rightConditionValue)));
275 bool monotonic =
true,
278 Real leftConditionValue = 0.0,
281 Real rightConditionValue = 0.0)
285 template <
class I1,
class I2>
287 const I2& yBegin)
const {
342 template <
class I1,
class I2>
344 const I2& yBegin,
const Size n,
356 template <
class I1,
class I2,
class Interpolator>
362 const Interpolator& factory = Interpolator())
364 Interpolator::requiredPoints),
373 "invalid value (" << this->
yBegin_[i]
374 <<
") at index " << i);
381 QL_FAIL(
"LogInterpolation primitive not implemented");
Cubic interpolation factory and traits
Cubic interpolation between discrete points.
@ SecondDerivative
Match value of second derivative at end.
DefaultLogMixedLinearCubic(const Size n, MixedInterpolation::Behavior behavior=MixedInterpolation::ShareRanges)
FritschButlandLogCubic(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
HarmonicLogCubic(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
basic template implementation
templateImpl(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const int requiredPoints=2)
base class for 1-D interpolations.
Real secondDerivative(Real x, bool allowExtrapolation=false) const
Real derivative(Real x, bool allowExtrapolation=false) const
ext::shared_ptr< Impl > impl_
KrugerLogCubic(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
KrugerLogMixedLinearCubic(const Size n, MixedInterpolation::Behavior behavior=MixedInterpolation::ShareRanges)
log-cubic interpolation factory and traits
CubicInterpolation::DerivativeApprox da_
CubicInterpolation::BoundaryCondition rightType_
CubicInterpolation::BoundaryCondition leftType_
static const Size requiredPoints
Interpolation interpolate(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin) const
LogCubic(CubicInterpolation::DerivativeApprox da, bool monotonic=true, CubicInterpolation::BoundaryCondition leftCondition=CubicInterpolation::SecondDerivative, Real leftConditionValue=0.0, CubicInterpolation::BoundaryCondition rightCondition=CubicInterpolation::SecondDerivative, Real rightConditionValue=0.0)
log-cubic interpolation between discrete points
LogCubicInterpolation(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, CubicInterpolation::DerivativeApprox da, bool monotonic, CubicInterpolation::BoundaryCondition leftC, Real leftConditionValue, CubicInterpolation::BoundaryCondition rightC, Real rightConditionValue)
LogCubicNaturalSpline(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
log-linear interpolation factory and traits
static const Size requiredPoints
Interpolation interpolate(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin) const
log-linear interpolation between discrete points
LogLinearInterpolation(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
log-cubic interpolation factory and traits
CubicInterpolation::DerivativeApprox da_
CubicInterpolation::BoundaryCondition rightType_
CubicInterpolation::BoundaryCondition leftType_
LogMixedLinearCubic(const Size n, MixedInterpolation::Behavior behavior, CubicInterpolation::DerivativeApprox da, bool monotonic=true, CubicInterpolation::BoundaryCondition leftCondition=CubicInterpolation::SecondDerivative, Real leftConditionValue=0.0, CubicInterpolation::BoundaryCondition rightCondition=CubicInterpolation::SecondDerivative, Real rightConditionValue=0.0)
static const Size requiredPoints
MixedInterpolation::Behavior behavior_
Interpolation interpolate(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin) const
log-mixedlinearcubic interpolation between discrete points
LogMixedLinearCubicInterpolation(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const Size n, MixedInterpolation::Behavior behavior, CubicInterpolation::DerivativeApprox da, bool monotonic, CubicInterpolation::BoundaryCondition leftC, Real leftConditionValue, CubicInterpolation::BoundaryCondition rightC, Real rightConditionValue)
LogMixedLinearCubicNaturalSpline(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const Size n, MixedInterpolation::Behavior behavior=MixedInterpolation::ShareRanges)
LogParabolic(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
mixed linear/cubic interpolation factory and traits
MonotonicLogCubicNaturalSpline(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
MonotonicLogMixedLinearCubic(const Size n, MixedInterpolation::Behavior behavior=MixedInterpolation::ShareRanges)
MonotonicLogParabolic(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin)
Real value(Real x) const override
LogInterpolationImpl(const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const Interpolator &factory=Interpolator())
Interpolation interpolation_
Real primitive(Real) const override
Real derivative(Real x) const override
std::vector< Real > logY_
Real secondDerivative(Real x) const override
cubic interpolation between discrete points
#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)
std::size_t Size
size of a container
linear interpolation between discrete points
mixed interpolation between discrete points