Logo
Reference manual - version orea_version
NPVCube Class Referenceabstract

NPV Cube class stores both future and current NPV values. More...

#include <orea/cube/npvcube.hpp>

Inheritance diagram for NPVCube:

Public Member Functions

 NPVCube ()
 default ctor
 NPVCube (NPVCube &)=delete
 Do not allow cube copying.
NPVCubeoperator= (NPVCube const &)=delete
virtual ~NPVCube ()
 dtor
virtual Size numIds () const =0
 Return the length of each dimension.
virtual Size numDates () const =0
virtual Size samples () const =0
virtual Size depth () const =0
virtual const std::map< std::string, Size > & idsAndIndexes () const =0
 Get a map of id and their index position in this cube.
const std::set< std::string > ids () const
 Get a set of all ids in the cube.
virtual const std::vector< QuantLib::Date > & dates () const =0
 Get the vector of dates for this cube.
virtual QuantLib::Date asof () const =0
 Return the asof date (T0 date).
virtual Real getT0 (Size id, Size depth=0) const =0
 Get a T0 value from the cube using index.
virtual Real getT0 (const std::string &id, Size depth=0) const
 Get a T0 value from the cube using trade id.
virtual void setT0 (Real value, Size id, Size depth=0)=0
 Set a value in the cube using index.
virtual void setT0 (Real value, const std::string &id, Size depth=0)
 Set a value in the cube using trade id.
virtual Real get (Size id, Size date, Size sample, Size depth=0) const =0
 Get a value from the cube using index.
virtual void set (Real value, Size id, Size date, Size sample, Size depth=0)=0
 Set a value in the cube using index.
virtual Real get (const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0) const
 Get a value from the cube using trade id and date.
virtual void set (Real value, const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0)
 Set a value in the cube using trade id and date.
virtual void removeT0 (Size id)
virtual void remove (Size id, Size sample, bool setToT0Value)
Size getTradeIndex (const std::string &id) const
Size getDateIndex (const QuantLib::Date &date) const
virtual bool usesDoublePrecision () const =0

Protected Member Functions

virtual Size index (const std::string &id) const
virtual Size index (const QuantLib::Date &date) const

Detailed Description

NPV Cube class stores both future and current NPV values.

The cube class stores future NPV values in a 4-D array.

This abstract base class is just used for the storage of a cube. This class also stores the tradeIds, dates and vector of T0 NPVs

The values in the cube must be set according to the following rules to ensure consistent behavior:

  • T0 values need to be set first using setT0(), in arbitrary order for (id, date, sample, depth), not all possible tuples have to be covered
  • after that the other values can be set using set(), again in arbitrary order for (id, date, sample, depth) and again not all possible tuples have to be covered
  • for each tuple (id, date, sample, depth) setT0() and set() should only be called once

Member Function Documentation

◆ numIds()

◆ numDates()

virtual Size numDates ( ) const
pure virtual

Implemented in NPVSensiCube.

◆ depth()

virtual Size depth ( ) const
pure virtual

Implemented in NPVSensiCube.

◆ idsAndIndexes()

virtual const std::map< std::string, Size > & idsAndIndexes ( ) const
pure virtual

◆ dates()

virtual const std::vector< QuantLib::Date > & dates ( ) const
pure virtual

◆ asof()

◆ getT0()

virtual Real getT0 ( Size id,
Size depth = 0 ) const
pure virtual

◆ setT0()

virtual void setT0 ( Real value,
Size id,
Size depth = 0 )
pure virtual

◆ get() [1/2]

virtual Real get ( Size id,
Size date,
Size sample,
Size depth = 0 ) const
pure virtual

◆ set() [1/2]

virtual void set ( Real value,
Size id,
Size date,
Size sample,
Size depth = 0 )
pure virtual

◆ get() [2/2]

virtual Real get ( const std::string & id,
const QuantLib::Date & date,
Size sample,
Size depth = 0 ) const
virtual

Get a value from the cube using trade id and date.

Reimplemented in NPVSensiCube.

◆ set() [2/2]

virtual void set ( Real value,
const std::string & id,
const QuantLib::Date & date,
Size sample,
Size depth = 0 )
virtual

Set a value in the cube using trade id and date.

Reimplemented in NPVSensiCube.

◆ removeT0()

void removeT0 ( Size id)
virtual

Remove t0 values for a given id

Reimplemented in JointNPVSensiCube, and SensiCube.

◆ remove()

void remove ( Size id,
Size sample,
bool setToT0Value )
virtual

Set non-t0 value to either 0 or the t0 value for a given id and sample. If sample is null, all samples are removed

Reimplemented in JointNPVSensiCube, and SensiCube.