|
PLearn 0.1
|
An RVArray stores a table of RandomVar's. More...
#include <RandomVar.h>


Public Member Functions | |
| RVArray () | |
| RVArray. | |
| RVArray (int n, int n_extra_allocated=0) | |
| RVArray (const Array< RandomVar > &va) | |
| RVArray (const RandomVar &v, int n_extra_allocated=0) | |
| RVArray (const RandomVar &v1, const RandomVar &v2, int n_extra_allocated=0) | |
| RVArray (const RandomVar &v1, const RandomVar &v2, const RandomVar &v3, int n_extra_allocated=0) | |
| int | length () const |
| VarArray | values () const |
| return the VarArray of values of the RV's | |
| RandomVar | operator[] (RandomVar index) |
| make a long array of RV's, as in expressions like X&Y&Z RVArray operator&(const RandomVar& v); //!< already built-in Arrays | |
| RandomVar & | operator[] (int i) |
| const RandomVar & | operator[] (int i) const |
| void | sort () |
| sorts in-place the elements by rv_number (topological order of the graphical model) (in the order: ancestors -> descendants) | |
Static Public Member Functions | |
| static int | compareRVnumbers (const RandomVar *v1, const RandomVar *v2) |
An RVArray stores a table of RandomVar's.
Definition at line 422 of file RandomVar.h.
| PLearn::RVArray::RVArray | ( | ) |
Definition at line 884 of file RandomVar.cc.
: Array<RandomVar>(n,n_extra) {}
Definition at line 888 of file RandomVar.cc.
: Array<RandomVar>(va) {}
Definition at line 891 of file RandomVar.cc.
: Array<RandomVar>(1,n_extra)
{ (*this)[0] = v; }
Definition at line 895 of file RandomVar.cc.
: Array<RandomVar>(2,n_extra)
{
(*this)[0] = v1;
(*this)[1] = v2;
}
| PLearn::RVArray::RVArray | ( | const RandomVar & | v1, |
| const RandomVar & | v2, | ||
| const RandomVar & | v3, | ||
| int | n_extra_allocated = 0 |
||
| ) |
Definition at line 902 of file RandomVar.cc.
: Array<RandomVar>(3,n_extra)
{
(*this)[0] = v1;
(*this)[1] = v2;
(*this)[2] = v3;
}
Definition at line 930 of file RandomVar.cc.
Referenced by sort().
{
return (*v1)->rv_number - (*v2)->rv_number;
}

| int PLearn::RVArray::length | ( | ) | const |
Reimplemented from PLearn::TVec< RandomVar >.
Definition at line 911 of file RandomVar.cc.
References i, and PLearn::TVec< RandomVar >::size().
Referenced by PLearn::ExtendedRandomVariable::EMBprop(), PLearn::JointRandomVariable::EMBprop(), PLearn::JointRandomVariable::invertible(), and PLearn::RVArrayRandomElementRandomVariable::RVArrayRandomElementRandomVariable().


Definition at line 447 of file RandomVar.h.
{ return Array<RandomVar>::operator[](i); }
Reimplemented from PLearn::TVec< RandomVar >.
Definition at line 450 of file RandomVar.h.
{ return Array<RandomVar>::operator[](i); }
make a long array of RV's, as in expressions like X&Y&Z RVArray operator&(const RandomVar& v); //!< already built-in Arrays
Note that casting a RVArray to RandomVar makes a JointRandomVariable because of RandomVar(RVAarray) constructor. return a new RVArrayRandomElementRandomVariable
Definition at line 927 of file RandomVar.cc.
{ return new RVArrayRandomElementRandomVariable(*this, index); }
| void PLearn::RVArray::sort | ( | ) |
sorts in-place the elements by rv_number (topological order of the graphical model) (in the order: ancestors -> descendants)
Definition at line 937 of file RandomVar.cc.
References compareRVnumbers(), PLearn::TVec< RandomVar >::data(), and PLearn::TVec< RandomVar >::size().
{
RandomVar* array = data();
qsort(array,size(),sizeof(RandomVar),(compare_function)compareRVnumbers);
}

| VarArray PLearn::RVArray::values | ( | ) | const |
return the VarArray of values of the RV's
Definition at line 919 of file RandomVar.cc.
References i, and PLearn::TVec< RandomVar >::size().
Referenced by PLearn::EM(), PLearn::ConcatColumnsRandomVariable::setValueFromParentsValue(), and PLearn::MixtureRandomVariable::setValueFromParentsValue().


1.7.4