Logo
Reference manual - version orea_version
Public Member Functions | List of all members
JointNPVCube Class Reference
+ Inheritance diagram for JointNPVCube:

Public Member Functions

 JointNPVCube (const boost::shared_ptr< NPVCube > &cube1, const boost::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< boost::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.
 
- 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 remove (Size id)
 
virtual void remove (Size id, Size sample)
 
Size getTradeIndex (const std::string &id) 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 boost::shared_ptr< NPVCube > &  cube1,
const boost::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< boost::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.