Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
LogInterpolationImpl< I1, I2, Interpolator > Class Template Reference

#include <qle/math/logquadraticinterpolation.hpp>

+ Inheritance diagram for LogInterpolationImpl< I1, I2, Interpolator >:
+ Collaboration diagram for LogInterpolationImpl< I1, I2, Interpolator >:

Public Member Functions

 LogInterpolationImpl (const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, const Interpolator &factory=Interpolator())
 
QuantLib::ext::shared_ptr< Interpolation > interpolation () const
 
void update () override
 
Real value (Real x) const override
 
Real primitive (Real) const override
 
Real derivative (Real x) const override
 
Real secondDerivative (Real x) const override
 

Private Attributes

std::vector< Real > logY_
 
QuantLib::ext::shared_ptr< Interpolation > interpolation_
 
Real multiplier_
 
Real offset_
 

Detailed Description

template<class I1, class I2, class Interpolator>
class QuantExt::detail::LogInterpolationImpl< I1, I2, Interpolator >

Definition at line 103 of file logquadraticinterpolation.hpp.

Constructor & Destructor Documentation

◆ LogInterpolationImpl()

LogInterpolationImpl ( const I1 &  xBegin,
const I1 &  xEnd,
const I2 &  yBegin,
const Interpolator &  factory = Interpolator() 
)

Definition at line 106 of file logquadraticinterpolation.hpp.

109 : Interpolation::templateImpl<I1,I2>(xBegin, xEnd, yBegin,
110 Interpolator::requiredPoints),
111 logY_(xEnd-xBegin) {
112 interpolation_ = factory.interpolatePtr(this->xBegin_,
113 this->xEnd_,
114 logY_.begin());
115 }
QuantLib::ext::shared_ptr< Interpolation > interpolation_

Member Function Documentation

◆ interpolation()

QuantLib::ext::shared_ptr< Interpolation > interpolation ( ) const

Definition at line 116 of file logquadraticinterpolation.hpp.

116 {
117 return interpolation_;
118 }

◆ update()

void update ( )
override

Definition at line 119 of file logquadraticinterpolation.hpp.

119 {
120 for (Size i=0; i<logY_.size(); ++i) {
121 QL_REQUIRE(this->yBegin_[i]>0.0,
122 "invalid value (" << this->yBegin_[i]
123 << ") at index " << i);
124 logY_[i] = std::log(this->yBegin_[i]);
125 }
126 interpolation_->update();
127 }

◆ value()

Real value ( Real  x) const
override

Definition at line 128 of file logquadraticinterpolation.hpp.

128 {
129 return std::exp((*interpolation_)(x, true));
130 }
+ Here is the caller graph for this function:

◆ primitive()

Real primitive ( Real  ) const
override

Definition at line 131 of file logquadraticinterpolation.hpp.

131 {
132 QL_FAIL("LogInterpolation primitive not implemented");
133 }

◆ derivative()

Real derivative ( Real  x) const
override

Definition at line 134 of file logquadraticinterpolation.hpp.

134 {
135 return value(x)*interpolation_->derivative(x, true);
136 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ secondDerivative()

Real secondDerivative ( Real  x) const
override

Definition at line 137 of file logquadraticinterpolation.hpp.

137 {
138 return value(x)*interpolation_->secondDerivative(x, true) +
139 derivative(x)*interpolation_->derivative(x, true);
140 }
+ Here is the call graph for this function:

Member Data Documentation

◆ logY_

std::vector<Real> logY_
private

Definition at line 142 of file logquadraticinterpolation.hpp.

◆ interpolation_

QuantLib::ext::shared_ptr<Interpolation> interpolation_
private

Definition at line 143 of file logquadraticinterpolation.hpp.

◆ multiplier_

Real multiplier_
private

Definition at line 144 of file logquadraticinterpolation.hpp.

◆ offset_

Real offset_
private

Definition at line 145 of file logquadraticinterpolation.hpp.