Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FlatExtrapolation::FlatExtrapolationImpl Class Reference
+ Inheritance diagram for FlatExtrapolation::FlatExtrapolationImpl:
+ Collaboration diagram for FlatExtrapolation::FlatExtrapolationImpl:

Public Member Functions

 FlatExtrapolationImpl (const QuantLib::ext::shared_ptr< Interpolation > &i)
 
void update () override
 
Real xMin () const override
 
Real xMax () const override
 
std::vector< Real > xValues () const override
 
std::vector< Real > yValues () const override
 
bool isInRange (Real x) const override
 
Real value (Real x) const override
 
Real primitive (Real x) const override
 
Real derivative (Real x) const override
 
Real secondDerivative (Real x) const override
 

Private Attributes

const QuantLib::ext::shared_ptr< Interpolation > i_
 

Detailed Description

Definition at line 42 of file flatextrapolation.hpp.

Constructor & Destructor Documentation

◆ FlatExtrapolationImpl()

FlatExtrapolationImpl ( const QuantLib::ext::shared_ptr< Interpolation > &  i)

Definition at line 45 of file flatextrapolation.hpp.

45: i_(i) {}
const QuantLib::ext::shared_ptr< Interpolation > i_

Member Function Documentation

◆ update()

void update ( )
override

Definition at line 46 of file flatextrapolation.hpp.

46{ i_->update(); }

◆ xMin()

Real xMin ( ) const
override

Definition at line 47 of file flatextrapolation.hpp.

47{ return i_->xMin(); }
+ Here is the caller graph for this function:

◆ xMax()

Real xMax ( ) const
override

Definition at line 48 of file flatextrapolation.hpp.

48{ return i_->xMax(); }
+ Here is the caller graph for this function:

◆ xValues()

std::vector< Real > xValues ( ) const
override

Definition at line 49 of file flatextrapolation.hpp.

49{ QL_FAIL("not implemented"); }

◆ yValues()

std::vector< Real > yValues ( ) const
override

Definition at line 50 of file flatextrapolation.hpp.

50{ QL_FAIL("not implemented"); }

◆ isInRange()

bool isInRange ( Real  x) const
override

Definition at line 51 of file flatextrapolation.hpp.

51{ return i_->isInRange(x); }

◆ value()

Real value ( Real  x) const
override

Definition at line 52 of file flatextrapolation.hpp.

52 {
53 Real tmp = std::max(std::min(x, i_->xMax()), i_->xMin());
54 return i_->operator()(tmp);
55 }

◆ primitive()

Real primitive ( Real  x) const
override

Definition at line 56 of file flatextrapolation.hpp.

56 {
57 if (x >= i_->xMin() && x <= i_->xMax()) {
58 return i_->primitive(x);
59 }
60 if (x < i_->xMin()) {
61 return i_->primitive(i_->xMin()) - (i_->xMin() - x);
62 } else {
63 return i_->primitive(i_->xMax()) + (x - i_->xMax());
64 }
65 }
+ Here is the call graph for this function:

◆ derivative()

Real derivative ( Real  x) const
override

Definition at line 66 of file flatextrapolation.hpp.

66 {
67 if (x > i_->xMin() && x < i_->xMax()) {
68 return i_->derivative(x);
69 } else {
70 // that is the left derivative for xmin and
71 // the right derivative for xmax
72 return 0.0;
73 }
74 }
+ Here is the call graph for this function:

◆ secondDerivative()

Real secondDerivative ( Real  x) const
override

Definition at line 75 of file flatextrapolation.hpp.

75 {
76 if (x > i_->xMin() && x < i_->xMax()) {
77 return i_->secondDerivative(x);
78 } else {
79 // that is the left derivative for xmin and
80 // the right derivative for xmax
81 return 0.0;
82 }
83 }
+ Here is the call graph for this function:

Member Data Documentation

◆ i_

const QuantLib::ext::shared_ptr<Interpolation> i_
private

Definition at line 86 of file flatextrapolation.hpp.