# RV Class Reference

Class representing variables, most often random variables. More...

`#include <libBM.h>`

List of all members.

## Public Member Functions
| RV (Array< std::string > in_names, ivec in_sizes, ivec in_times)
| Full constructor.
| RV (Array< std::string > in_names, ivec in_sizes)
| Constructor with times=0.
| RV (Array< std::string > in_names)
| Constructor with sizes=1, times=0.
| RV ()
| Constructor of empty RV.
int | count () const
| Return number of scalars in the RV.
int | length () const
| Return length (number of entries) of the RV.
ivec | findself (const RV &rv2) const
| Find indexes of self in another rv,.
bool | equal (const RV &rv2) const
| Compare if `rv2` is identical to this `RV`.
bool | add (const RV &rv2)
| Add (concat) another variable to the current one,.
RV | subt (const RV rv2) const
| Subtract another variable from the current one.
RV | subselect (ivec ind) const
| Select only variables at indeces ind.
RV | operator() (ivec ind) const
| Select only variables at indeces ind.
void | t (int delta)
| Shift `time` shifted by delta.
str | tostr () const
| generate `str` from rv, by expanding sizes
ivec | dataind (RV crv) const
| generate indeces into
Array< std::string > & | _names ()
| access function
int | id (int at)
| access function
int | size (int at)
| access function
int | time (int at)
| access function
std::string | name (int at)
| access function
## Protected Attributes
int | tsize
| size = sum of sizes
int | len
| len = number of individual rvs
ivec | ids
| Vector of unique IDs.
ivec | sizes
| Vector of sizes.
ivec | times
| Vector of shifts from current time.
Array< std::string > | names
| Array of names.
## Friends
std::ostream & | operator<< (std::ostream &os, const RV &rv)
| Printing output e.g. for debugging.

## Detailed Description

Class representing variables, most often random variables.

More?...

## Member Function Documentation

ivec RV::findself | ( | const RV & | rv2 | ) | const

Find indexes of self in another rv,.

Returns:
  ivec of the same size as self.

References ids, len, length(), and times.

Referenced by add(), and subt().

bool RV::add | ( | const RV & | rv2 | ) |

Add (concat) another variable to the current one,.

Returns:
  0 if all rv2 were added, 1 if rv2 is in conflict

References findself(), ids, len, names, sizes, times, and tsize.

Referenced by concat(), MPF< BM_T >::MPF(), and mprod::mprod().

ivec RV::dataind | ( | RV | crv | ) | const

generate indeces into

Parameters:

  | crv | data vector that form data vector of self.

References ids, str::ids, len, times, str::times, and tostr().

The documentation for this class was generated from the following files:

- work/git/mixpp/bdm/stat/libBM.h
- work/git/mixpp/bdm/stat/libBM.cpp