Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LogQuote Class Reference

Class for storing logs of quotes for log-linear interpolation. More...

#include <qle/quotes/logquote.hpp>

+ Inheritance diagram for LogQuote:
+ Collaboration diagram for LogQuote:

Public Member Functions

 LogQuote (Handle< Quote > q)
 
Inspectors
Real quote () const
 
Quote interface
Real value () const override
 
bool isValid () const override
 

Observer interface

Handle< Quote > q_
 
Real logValue_
 
void update () override
 

Detailed Description

Class for storing logs of quotes for log-linear interpolation.

Tests:
the correctness of the returned values is tested by checking them against the log of the returned values of q_

Definition at line 38 of file logquote.hpp.

Constructor & Destructor Documentation

◆ LogQuote()

LogQuote ( Handle< Quote >  q)

Definition at line 40 of file logquote.hpp.

40 : q_(q) {
41 registerWith(q);
42 update();
43 }
Handle< Quote > q_
Definition: logquote.hpp:58
void update() override
Definition: logquote.cpp:34
+ Here is the call graph for this function:

Member Function Documentation

◆ quote()

Real quote ( ) const

Definition at line 28 of file logquote.cpp.

28{ return q_->value(); }

◆ value()

Real value ( ) const
override

Definition at line 30 of file logquote.cpp.

30{ return logValue_; }

◆ isValid()

bool isValid ( ) const
override

Definition at line 32 of file logquote.cpp.

32{ return q_->isValid(); }

◆ update()

void update ( )
override

Definition at line 34 of file logquote.cpp.

34 {
35 Real v = q_->value();
36 QL_REQUIRE(v > 0.0, "Invalid quote, cannot take log of non-positive number");
37 logValue_ = std::log(v);
38}
+ Here is the caller graph for this function:

Member Data Documentation

◆ q_

Handle<Quote> q_
protected

Definition at line 58 of file logquote.hpp.

◆ logValue_

Real logValue_
protected

Definition at line 59 of file logquote.hpp.