Representation of random payoffs in the library.
More...
#include <cfl/Slice.hpp>
|
| Slice (const IModel *pModel=0, unsigned iEventTime=0, double dValue=0) |
|
| Slice (const IModel &rModel, unsigned iEventTime, const std::vector< unsigned > &rDependence, const std::valarray< double > &rValues) |
|
Slice | apply (double(*f)(double)) const |
|
void | assign (const IModel &rModel, unsigned iEventTime, const std::vector< unsigned > &rDependence, const std::valarray< double > &rValues) |
|
void | assign (unsigned iEventTime, const std::vector< unsigned > &rDependence, const std::valarray< double > &rValues) |
|
void | assign (const std::vector< unsigned > &rDependence, const std::valarray< double > &rValues) |
|
void | assign (const std::valarray< double > &rValues) |
|
void | assign (const IModel &rModel) |
|
const std::vector< unsigned > & | dependence () const |
|
Slice & | operator*= (double dValue) |
|
Slice & | operator*= (const Slice &rSlice) |
|
Slice & | operator+= (double dValue) |
|
Slice & | operator+= (const Slice &rSlice) |
|
Slice & | operator-= (double dValue) |
|
Slice & | operator-= (const Slice &rSlice) |
|
Slice & | operator/= (double dValue) |
|
Slice & | operator/= (const Slice &rSlice) |
|
Slice & | operator= (const Slice &rSlice) |
|
Slice & | operator= (double dValue) |
|
const IModel * | ptrToModel () const |
|
void | rollback (unsigned iEventTime) |
|
unsigned | timeIndex () const |
|
const std::valarray< double > & | values () const |
|
This class models random payoffs defined at a particular event time of a model. More precisely, Slice is a random variable determined by the current values of the state processes.
- See also
- IModel
cfl::Slice::Slice |
( |
const IModel * |
pModel = 0 , |
|
|
unsigned |
iEventTime = 0 , |
|
|
double |
dValue = 0 |
|
) |
| |
|
explicit |
Constructs a payoff with constant value dValue at the event time with index iEventTime in the framework of the financial model defined by an implementation of the interface class IModel.
- Parameters
-
pModel | A pointer to an implementation of the interface class IModel. |
iEventTime | The index of current event time. |
dValue | The current constant value of the payoff. |
cfl::Slice::Slice |
( |
const IModel & |
rModel, |
|
|
unsigned |
iEventTime, |
|
|
const std::vector< unsigned > & |
rDependence, |
|
|
const std::valarray< double > & |
rValues |
|
) |
| |
Constructs a random payoff at given event time.
- Parameters
-
rModel | A constant reference to the underlying model which implements the interface class IModel. |
iEventTime | The index of the current time in the vector of event times of the underlying model. |
rDependence | A constant reference to the vector of indexes of state processes of underlying model which determine the values of *this . |
rValues | An array of values of the random payoff represented by *this . The size of this array should be equal the result of rModel.numberOfNodes(iEventTime, rDependence) . |
Slice cfl::Slice::apply |
( |
double(*)(double) |
f | ) |
const |
Returns payoff in the form f(*this)
.
- Parameters
-
f | The transformation function. |
- Returns
- The payoff in the form
f(*this)
.
void cfl::Slice::assign |
( |
const IModel & |
rModel, |
|
|
unsigned |
iEventTime, |
|
|
const std::vector< unsigned > & |
rDependence, |
|
|
const std::valarray< double > & |
rValues |
|
) |
| |
Replaces the underlying model, the index of event times, the vector of indexes of state processes, and array of values with rModel, iEventTime, rDependence, and rValues.
- Parameters
-
rModel | The reference to an implementation of interface class IModel. |
iEventTime | The index of new event time for *this . |
rDependence | The new vector of indexes of state processes. |
rValues | The new array of values. |
void cfl::Slice::assign |
( |
unsigned |
iEventTime, |
|
|
const std::vector< unsigned > & |
rDependence, |
|
|
const std::valarray< double > & |
rValues |
|
) |
| |
Replaces the index of event times, the vector of indexes of state processes, and array of values with iEventTime, rDependence, and rValues.
- Parameters
-
iEventTime | The index of new event time for *this . |
rDependence | The new vector of indexes of state processes. |
rValues | The new array of values. |
Replaces vector of indexes of state processes and array of values with rDependence and rValues.
- Parameters
-
rDependence | The new vector of indexes of state processes. |
rValues | The new array of values. |
void cfl::Slice::assign |
( |
const std::valarray< double > & |
rValues | ) |
|
Replaces the array of values with rValues
- Parameters
-
rValues | The new array of values. |
void cfl::Slice::assign |
( |
const IModel & |
rModel | ) |
|
Replaces underlying model with rModel.
- Parameters
-
rModel | The reference to an implementation of interface class IModel. |
const std::vector<unsigned>& cfl::Slice::dependence |
( |
| ) |
const |
Accessor function to the vector of indexes of state processes which determine the random variable represented by *this
.
- Returns
- Constant reference to the vector of indexes on state processes that participate in the construction of the given Slice object.
Slice& cfl::Slice::operator*= |
( |
double |
dValue | ) |
|
Multiplies *this
on the number dValue.
- Parameters
-
dValue | The constant multiplier. |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator*= |
( |
const Slice & |
rSlice | ) |
|
Multiplies *this
on the value of payoff represented by rSlice. Both objects *this
and rSlice should be defined on the same model and at the same event time.
- Parameters
-
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator+= |
( |
double |
dValue | ) |
|
Adds to *this
the number dValue.
- Parameters
-
dValue | The constant value that will be added to *this . |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator+= |
( |
const Slice & |
rSlice | ) |
|
Adds to *this
the value of the payoff represented by rSlice. Both objects *this
and rSlice should be defined on the same model and at the same event time.
- Parameters
-
rSlice | The payoff that will be added to *this . |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator-= |
( |
double |
dValue | ) |
|
Subtracts from *this
the number dValue.
- Parameters
-
dValue | The constant value that will be subtracted from *this . |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator-= |
( |
const Slice & |
rSlice | ) |
|
Subtracts from *this
the value of payoff represented by rSlice. Both objects *this
and rSlice should be defined on the same model and at the same event time.
- Parameters
-
rSlice | The payoff that will be subtracted from *this . |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator/= |
( |
double |
dValue | ) |
|
Divides *this
on the number dValue.
- Parameters
-
dValue | The constant divisor. |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator/= |
( |
const Slice & |
rSlice | ) |
|
Divides *this
on the value of payoff represented by rSlice. Both objects *this
and rSlice should be defined on the same model and at the same event time.
- Parameters
-
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator= |
( |
const Slice & |
rSlice | ) |
|
Assignment operator. Replaces *this
with a copy of rSlice.
- Parameters
-
rSlice | Object that will be copied. |
- Returns
- Reference to
*this
.
Slice& cfl::Slice::operator= |
( |
double |
dValue | ) |
|
Assignment operator. Replaces *this
with the Slice object defined at the same event time and having constant value dValue.
- Parameters
-
dValue | The constant value that will be assigned to *this . |
- Returns
- Reference to
*this
.
const IModel* cfl::Slice::ptrToModel |
( |
| ) |
const |
Accessor function to the implementation of IModel that was used to support current Slice object.
- Returns
- The pointer to the underlying model.
void cfl::Slice::rollback |
( |
unsigned |
iEventTime | ) |
|
This member function is usually used if *this
represents the value of a (derivative) security. It assigns to *this
the equivalent value of this security at event time with smaller index iEventTime.
- Parameters
-
iEventTime | The index of the target event time. It should be smaller or equal the initial index of event time for *this . |
unsigned cfl::Slice::timeIndex |
( |
| ) |
const |
Accessor function to the index of event time where *this
is defined.
- Returns
- Index of event time where
*this
is defined.
Accessor function to the values of *this
.
- Returns
- The array of values of the given Slice object.
The documentation for this class was generated from the following file: