# RV Class Reference
[Core BDM classes]

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 (const ivec &ind) const
| Select only variables at indeces ind.
RV | operator() (const 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 (const RV &crv) const
void | dataind (const RV &rv2, ivec &selfi, ivec &rv2i) const
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
void | set_id (int at, int id0)
| access function
void | set_size (int at, int size0)
| access function
void | set_time (int at, int time0)
| access function
void | newids ()
| Assign unused ids to this rv.
## 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(), dataind(), and subt().

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

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

Returns:
  true if all rv2 were added, false if rv2 is in conflict

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

Referenced by concat(), compositepdf::getrv(), merger::merger(), MPF< BM_T >::MPF(), and compositepdf::setrvc().

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

when this rv is a part of bigger rv, this function returns indeces of self in the data vector of the bigger crv. Then, data can be copied via: data_of_this = cdata(ind);

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

Referenced by enorm< sq_T >::condition(), datalink_m2e::datalink_m2e(), datalink_m2m::datalink_m2m(), and enorm< sq_T >::marginal().

void RV::dataind | ( | const RV & | rv2,
|  | ivec & | selfi,
|  | ivec & | rv2i |
| ) |  |  | const

generate mutual indeces when copying data betwenn self and crv. Data are copied via: data_of_this(selfi) = data_of_rv2(rv2i)

References concat(), findself(), ids, str::ids, len, length(), 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