bdm::RV Class Reference

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

#include <bdmbase.h>

List of all members.

Public Member Functions

void from_setting (const Setting &set)
 UI for class RV (description of data vectors).
virtual string to_string ()
 This method returns a basic info about the current instance.
virtual void to_setting (Setting &set) const
 This method save all the instance properties into the Setting structure.
virtual void validate ()
 This method TODO.
Constructors
 RV (const Array< std::string > &in_names, const ivec &in_sizes, const ivec &in_times)
 Full constructor.
 RV (const Array< std::string > &in_names, const ivec &in_sizes)
 Constructor with times=0.
 RV (const Array< std::string > &in_names)
 Constructor with sizes=1, times=0.
 RV ()
 Constructor of empty RV.
 RV (string name, int sz, int tm=0)
 Constructor of a single RV with given id.
Algebra on Random Variables
ivec findself (const RV &rv2) const
 Find indices 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 indices ind.
RV operator() (const ivec &ind) const
 Select only variables at indices ind.
RV operator() (int di1, int di2) const
 Select from data vector starting at di1 to di2.
void t (int delta)
 Shift time by delta.
Relation to vectors
str tostr () const
 generate str from rv, by expanding sizes TODO to_string..
ivec dataind (const RV &crv) const
void dataind (const RV &rv2, ivec &selfi, ivec &rv2i) const
int mint () const
 Minimum time-offset.

Static Public Member Functions

static void clear_all ()
 Invalidate all named RVs. Use before initializing any RV instances, with care...

Protected Attributes

int dsize
 size of the data vector
int len
 number of individual rvs
ivec ids
 Vector of unique IDs.
ivec times
 Vector of shifts from current time.

Access functions

int _dsize () const
int countsize () const
 Recount size of the corresponding data vector.
ivec cumsizes () const
int length () const
int id (int at) const
int size (int at) const
int time (int at) const
std::string name (int at) const
void set_time (int at, int time0)
std::ostream & operator<< (std::ostream &os, const RV &rv)
 State output, e.g. for debugging.


Detailed Description

Class representing variables, most often random variables.

The purpose of this class is to decribe a vector of data. Such description is used for connecting various vectors between each other, see class datalink.

The class is implemented using global variables to assure uniqueness of description:

In is a vector

inline_dotgraph_1.dot

Member Function Documentation

bool bdm::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 countsize(), dsize, findself(), ids, len, and times.

Referenced by bdm::compositepdf::getrv(), bdm::ArxDS::set_drv(), bdm::merger_base::set_sources(), and bdm::compositepdf::setrvc().

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

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

References findself(), ids, bdm::str::ids, times, bdm::str::times, and tostr().

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

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

References dsize, ids, bdm::str::ids, times, bdm::str::times, and tostr().

Referenced by bdm::enorm< sq_T >::condition(), bdm::enorm< sq_T >::marginal(), and bdm::datalink::set_connection().

ivec bdm::RV::findself ( const RV rv2  )  const

Find indices of self in another rv,.

Returns:
ivec of the same size as self.

References ids, and times.

Referenced by add(), dataind(), and subt().

void bdm::RV::from_setting ( const Setting &  set  )  [virtual]

UI for class RV (description of data vectors).

  rv = {
    type = "rv"; //identifier of the description
    // UNIQUE IDENTIFIER same names = same variable
    names = ["a", "b", "c", ...];   // which will be used e.g. in loggers

    //optional arguments
    sizes = [1, 2, 3, ...];         // (optional) default = ones()
    times = [-1, -2, 0, ...];       // time shifts with respect to current time (optional) default = zeros()
  }

Reimplemented from bdm::root.

References bdm::UI::get().


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

Generated on Wed Aug 5 00:06:54 2009 for mixpp by  doxygen 1.5.9