Logo
Reference manual - version orea_version
SensiCube Class Reference

SensiCube stores only npvs not equal to the base npvs. More...

#include <orea/cube/sensicube.hpp>

Inheritance diagram for SensiCube:

Public Member Functions

 SensiCube (const std::set< std::string > &ids, const QuantLib::Date &asof, QuantLib::Size samples)
QuantLib::Size numIds () const override
 Return the length of each dimension.
QuantLib::Size samples () const override
const std::map< std::string, Size > & idsAndIndexes () const override
 Get the vector of ids for this cube.
const std::vector< QuantLib::Date > & dates () const override
 Get the vector of dates for this cube.
QuantLib::Date asof () const override
 Return the asof date (T0 date).
Real getT0 (Size i, Size) const override
 Get a T0 value from the cube.
void setT0 (Real value, Size i, Size) override
 Set a value in the cube.
Real get (Size i, Size j, Size k, Size) const override
 Get a value from the cube.
void set (Real value, Size i, Size j, Size k, Size) override
 Set a value in the cube.
void removeT0 (Size i) override
void remove (Size i, Size k, bool useT0) override
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (QuantLib::Size i) const override
std::set< QuantLib::Size > relevantScenarios () const override
bool usesDoublePrecision () const override
Public Member Functions inherited from NPVSensiCube
QuantLib::Size numDates () const override
 Number of dates in the NPVSensiCube is exactly one i.e. the as of date.
QuantLib::Size depth () const override
 The depth in the NPVSensiCube is exactly one.
Real get (QuantLib::Size id, QuantLib::Size sample) const
 Convenience method to get a value from the cube using id and sample only.
Real get (const std::string &id, QuantLib::Size sample) const
 Convenience method to get a value from the cube using id and sample only.
void set (QuantLib::Real value, QuantLib::Size id, QuantLib::Size sample)
 Convenience method to set a value in the cube using id and sample only.
void set (QuantLib::Real value, const std::string &id, QuantLib::Size sample)
 Convenience method to set a value in the cube using id and sample only.
Size getTradeIndex (const std::string &tradeId) const
 Return the index of the trade in the cube.
virtual std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (Size tradeIdx) const =0
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (const std::string &tradeId) const
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.
Public Member Functions inherited from NPVCube
 NPVCube ()
 default ctor
 NPVCube (NPVCube &)=delete
 Do not allow cube copying.
NPVCubeoperator= (NPVCube const &)=delete
virtual ~NPVCube ()
 dtor
const std::set< std::string > ids () const
 Get a set of all ids in the cube.
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, const std::string &id, Size depth=0)
 Set a value in the cube using trade id.
Size getTradeIndex (const std::string &id) const
Size getDateIndex (const QuantLib::Date &date) const

Protected Member Functions

void check (QuantLib::Size i, QuantLib::Size j, QuantLib::Size k) const
Protected Member Functions inherited from NPVCube
virtual Size index (const std::string &id) const
virtual Size index (const QuantLib::Date &date) const

Protected Attributes

std::vector< QuantLib::Real > t0Data_
std::vector< std::map< QuantLib::Size, QuantLib::Real > > tradeNPVs_
std::set< QuantLib::Size > relevantScenarios_

Detailed Description

SensiCube stores only npvs not equal to the base npvs.

Member Function Documentation

◆ numIds()

QuantLib::Size numIds ( ) const
overridevirtual

Return the length of each dimension.

Implements NPVCube.

◆ samples()

QuantLib::Size samples ( ) const
overridevirtual

Implements NPVCube.

◆ idsAndIndexes()

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

Get the vector of ids for this cube.

Implements NPVCube.

◆ dates()

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

Get the vector of dates for this cube.

Implements NPVCube.

◆ asof()

QuantLib::Date asof ( ) const
overridevirtual

Return the asof date (T0 date).

Implements NPVCube.

◆ getT0()

Real getT0 ( Size i,
Size  ) const
overridevirtual

Get a T0 value from the cube.

Implements NPVCube.

◆ setT0()

void setT0 ( Real value,
Size i,
Size  )
overridevirtual

Set a value in the cube.

Implements NPVCube.

◆ get()

Real get ( Size i,
Size j,
Size k,
Size  ) const
overridevirtual

Get a value from the cube.

Reimplemented from NPVSensiCube.

◆ set()

void set ( Real value,
Size i,
Size j,
Size k,
Size  )
overridevirtual

Set a value in the cube.

Reimplemented from NPVSensiCube.

◆ removeT0()

void removeT0 ( Size id)
overridevirtual

Remove t0 values for a given id

Reimplemented from NPVCube.

◆ remove()

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

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 from NPVCube.

◆ relevantScenarios()

std::set< QuantLib::Size > relevantScenarios ( ) const
overridevirtual

Return the set of scenario indices with non-zero result

Implements NPVSensiCube.

◆ usesDoublePrecision()

bool usesDoublePrecision ( ) const
overridevirtual

Implements NPVCube.