|
PLearn 0.1
|
#include <RandomVar.h>


Public Member Functions | |
| RVInstanceArray () | |
| RVInstanceArray. | |
| RVInstanceArray (int n, int n_extra_allocated=0) | |
| RVInstanceArray (const Array< RVInstance > &a) | |
| RVInstanceArray (const RVInstance &v, int n_extra_allocated=0) | |
| RVInstanceArray (const RVInstance &v1, const RVInstance &v2, int n_extra_allocated=0) | |
| RVInstanceArray (const RVInstance &v1, const RVInstance &v2, const RVInstance &v3, int n_extra_allocated=0) | |
| int | length () const |
| total length of all the RV's in the array, this is generally != size() | |
| RVInstanceArray | operator&& (RVInstance rhs) |
| Build a chain of (RV,value) pairs. | |
| ConditionalExpression | operator| (RVInstanceArray rhs) |
| RVArray | random_variables () const |
| put all the RVs in the list in a RVarray | |
| VarArray | values () const |
| put all the values of the variables (array[i].V->value) in a VarArray | |
| VarArray | instances () const |
| put all the instance values of the variables (array[i].v) in a VarArray | |
| void | swap_v_and_Vvalue () |
| swap the v's with the V->value's | |
| void | sort () |
| sorts in-place the elements by V->rv_number (topological order of the graphical model) (in the order: ancestors -> descendants) | |
Static Public Member Functions | |
| static int | compareRVnumbers (const RVInstance *rvi1, const RVInstance *rvi2) |
Definition at line 480 of file RandomVar.h.
| PLearn::RVInstanceArray::RVInstanceArray | ( | ) |
Definition at line 797 of file RandomVar.cc.
: Array<RVInstance>(n,n_extra) {}
| PLearn::RVInstanceArray::RVInstanceArray | ( | const Array< RVInstance > & | a | ) |
Definition at line 801 of file RandomVar.cc.
: Array<RVInstance>(va) {}
| PLearn::RVInstanceArray::RVInstanceArray | ( | const RVInstance & | v, |
| int | n_extra_allocated = 0 |
||
| ) |
Definition at line 804 of file RandomVar.cc.
: Array<RVInstance>(1,n_extra)
{ (*this)[0] = v; }
| PLearn::RVInstanceArray::RVInstanceArray | ( | const RVInstance & | v1, |
| const RVInstance & | v2, | ||
| int | n_extra_allocated = 0 |
||
| ) |
Definition at line 808 of file RandomVar.cc.
: Array<RVInstance>(2,n_extra)
{
(*this)[0] = v1;
(*this)[1] = v2;
}
| PLearn::RVInstanceArray::RVInstanceArray | ( | const RVInstance & | v1, |
| const RVInstance & | v2, | ||
| const RVInstance & | v3, | ||
| int | n_extra_allocated = 0 |
||
| ) |
Definition at line 815 of file RandomVar.cc.
: Array<RVInstance>(3,n_extra)
{
(*this)[0] = v1;
(*this)[1] = v2;
(*this)[2] = v3;
}
| int PLearn::RVInstanceArray::compareRVnumbers | ( | const RVInstance * | rvi1, |
| const RVInstance * | rvi2 | ||
| ) | [static] |
Definition at line 864 of file RandomVar.cc.
References PLearn::RVInstance::V.
Referenced by sort().
{
return rvi1->V->rv_number - rvi2->V->rv_number;
}

| VarArray PLearn::RVInstanceArray::instances | ( | ) | const |
put all the instance values of the variables (array[i].v) in a VarArray
Definition at line 838 of file RandomVar.cc.
References i, and PLearn::TVec< RVInstance >::size().
Referenced by PLearn::EM(), and operator|().


| int PLearn::RVInstanceArray::length | ( | ) | const |
total length of all the RV's in the array, this is generally != size()
Reimplemented from PLearn::TVec< RVInstance >.
Definition at line 824 of file RandomVar.cc.
References i, and PLearn::TVec< RVInstance >::size().

| RVInstanceArray PLearn::RVInstanceArray::operator&& | ( | RVInstance | rhs | ) |
Build a chain of (RV,value) pairs.
It is used to build expressions of the form (X==x && Y==y && Z==z).
Definition at line 852 of file RandomVar.cc.
References PLearn::operator&().
{
return PLearn::operator&(*this,(RVInstanceArray)rvi);
//return this->operator&((RVInstanceArray)rvi);
}

| ConditionalExpression PLearn::RVInstanceArray::operator| | ( | RVInstanceArray | rhs | ) |
This operator is used for expressions of the form (Y==y)|(X==x && Z==z) and it acts like &&. If the expression is (Y==y && Z==z)|(X==x && U==u) then the LHS RVInstance list will be coerced into a single (RV,value) pair, with RV = Y&&Z (their joint) and value = vconcat(y & z).
Definition at line 858 of file RandomVar.cc.
References instances(), random_variables(), and PLearn::vconcat().
{
return ConditionalExpression(RVInstance(random_variables(),
vconcat(instances())),RHS);
}

| RVArray PLearn::RVInstanceArray::random_variables | ( | ) | const |
put all the RVs in the list in a RVarray
Definition at line 845 of file RandomVar.cc.
References i, and PLearn::TVec< RVInstance >::size().
Referenced by PLearn::FunctionalRandomVariable::logP(), and operator|().


| void PLearn::RVInstanceArray::sort | ( | ) |
sorts in-place the elements by V->rv_number (topological order of the graphical model) (in the order: ancestors -> descendants)
Definition at line 872 of file RandomVar.cc.
References compareRVnumbers(), PLearn::TVec< RVInstance >::data(), and PLearn::TVec< RVInstance >::size().
Referenced by PLearn::FunctionalRandomVariable::logP().
{
RVInstance* array = data();
qsort(array,size(),sizeof(RVInstance),(compare_function)compareRVnumbers);
}


| void PLearn::RVInstanceArray::swap_v_and_Vvalue | ( | ) | [inline] |
swap the v's with the V->value's
Definition at line 517 of file RandomVar.h.
References i.
Referenced by PLearn::MixtureRandomVariable::ElogP().

| VarArray PLearn::RVInstanceArray::values | ( | ) | const |
put all the values of the variables (array[i].V->value) in a VarArray
Definition at line 831 of file RandomVar.cc.
References i, and PLearn::TVec< RVInstance >::size().

1.7.4