Logo
Reference manual - version orea_version
JointNPVCube Class Reference
Inheritance diagram for JointNPVCube:

Public Member Functions

 JointNPVCube (const QuantLib::ext::shared_ptr< NPVCube > &cube1, const QuantLib::ext::shared_ptr< NPVCube > &cube2, const std::set< std::string > &ids={}, const bool requireUniqueIds=true, const std::function< Real(Real a, Real x)> &accumulator=[](Real a, Real x) { return a+x;}, const Real accumulatorInit=0.0)
 JointNPVCube (const std::vector< QuantLib::ext::shared_ptr< NPVCube > > &cubes, const std::set< std::string > &ids={}, const bool requireUniqueIds=true, const std::function< Real(Real a, Real x)> &accumulator=[](Real a, Real x) { return a+x;}, const Real accumulatorInit=0.0)
Size numIds () const override
 Return the length of each dimension.
Size numDates () const override
Size samples () const override
Size depth () const override
const std::map< std::string, Size > & idsAndIndexes () const override
 Get a map of id and their index position in 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 id, Size depth=0) const override
 Get a T0 value from the cube using index.
void setT0 (Real value, Size id, Size depth=0) override
 Set a value in the cube using index.
Real get (Size id, Size date, Size sample, Size depth=0) const override
 Get a value from the cube using index.
void set (Real value, Size id, Size date, Size sample, Size depth=0) override
 Set a value in the cube using index.
bool usesDoublePrecision () const override
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.
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

Additional Inherited Members

Protected Member Functions inherited from NPVCube
virtual Size index (const std::string &id) const
virtual Size index (const QuantLib::Date &date) const

Constructor & Destructor Documentation

◆ JointNPVCube() [1/2]

JointNPVCube ( const QuantLib::ext::shared_ptr< NPVCube > & cube1,
const QuantLib::ext::shared_ptr< NPVCube > & cube2,
const std::set< std::string > & ids = {},
const bool requireUniqueIds = true,
const std::function< Real(Real a, Real x)> & accumulator = [](Real a, Real x) { return a+x;},
const Real accumulatorInit = 0.0 )

ctor for two input cubes

◆ JointNPVCube() [2/2]

JointNPVCube ( const std::vector< QuantLib::ext::shared_ptr< NPVCube > > & cubes,
const std::set< std::string > & ids = {},
const bool requireUniqueIds = true,
const std::function< Real(Real a, Real x)> & accumulator = [](Real a, Real x) { return a+x;},
const Real accumulatorInit = 0.0 )

ctor for n input cubes

  • If no ids are given, the ids in the input cubes define the ids in the resulting cube. The order is lexicographic. If ids are given they define the ids in the output cube.
  • If requireUniqueIds is true, there must be no duplicate ids in the input cubes. If requireUniqueIds is false, they may be duplicate ids in which case get() will return an aggregate of the entries in the input cubes over the matching ids using the accumulator function and accumulator initialization.
  • If one id in the result cube corresponds to several input cubes, it is not allowed to call set on this id, this will result in an exception.

Member Function Documentation

◆ numIds()

Size numIds ( ) const
overridevirtual

Return the length of each dimension.

Implements NPVCube.

◆ numDates()

Size numDates ( ) const
overridevirtual

Implements NPVCube.

◆ samples()

Size samples ( ) const
overridevirtual

Implements NPVCube.

◆ depth()

Size depth ( ) const
overridevirtual

Implements NPVCube.

◆ idsAndIndexes()

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

Get a map of id and their index position in 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 id,
Size depth = 0 ) const
overridevirtual

Get a T0 value from the cube using index.

Implements NPVCube.

◆ setT0()

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

Set a value in the cube using index.

Implements NPVCube.

◆ get()

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

Get a value from the cube using index.

Implements NPVCube.

◆ set()

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

Set a value in the cube using index.

Implements NPVCube.

◆ usesDoublePrecision()

bool usesDoublePrecision ( ) const
overridevirtual

Implements NPVCube.