PLearn 0.1
Public Member Functions
PLearn::DiagonalNormalSampleVariable Class Reference

#include <SampleVariable.h>

Inheritance diagram for PLearn::DiagonalNormalSampleVariable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::DiagonalNormalSampleVariable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DiagonalNormalSampleVariable (Variable *mu, Variable *sigma)
virtual
DiagonalNormalSampleVariable
deepCopy (CopiesMap &copies) const
virtual string classname () const
virtual void fprop ()
 compute output given input

Detailed Description

Definition at line 117 of file SampleVariable.h.


Constructor & Destructor Documentation

PLearn::DiagonalNormalSampleVariable::DiagonalNormalSampleVariable ( Variable mu,
Variable sigma 
)

Definition at line 169 of file SampleVariable.cc.

References PLearn::Variable::isScalar(), PLearn::Variable::length(), PLERROR, and PLearn::Variable::width().

Referenced by deepCopy().

    :BinarySampleVariable(mu, sigma, mu->length(), mu->width()) 
{
    if (!sigma->isScalar() && (mu->length()!=sigma->length() || mu->width()!=sigma->width()) )
        PLERROR("DiagonalNormalSampleVariable: mu(%d,%d) incompatible with sigma(%d,%d)",
                mu->length(),mu->width(),sigma->length(),sigma->width());
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

string PLearn::DiagonalNormalSampleVariable::classname ( ) const [virtual]

Reimplemented from PLearn::BinarySampleVariable.

Definition at line 165 of file SampleVariable.cc.

{ return "DiagonalNormalSampleVariable"; }
DiagonalNormalSampleVariable * PLearn::DiagonalNormalSampleVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::BinaryVariable.

Definition at line 177 of file SampleVariable.cc.

References DiagonalNormalSampleVariable(), and PLearn::BinaryVariable::makeDeepCopyFromShallowCopy().

{
    CopiesMap::iterator it = copies.find(this);
    if (it!=copies.end()) // a copy already exists, so return it
        return (DiagonalNormalSampleVariable*)it->second;
  
    // Otherwise call the copy constructor to obtain a SHALLOW copy
    DiagonalNormalSampleVariable* deep_copy = new DiagonalNormalSampleVariable(*this); 
    // Put the copy in the map
    copies[this] = deep_copy;
    // Transform the shallow copy into a deep copy
    deep_copy->makeDeepCopyFromShallowCopy(copies);
    // return the completed deep_copy
    return deep_copy;
}

Here is the call graph for this function:

void PLearn::DiagonalNormalSampleVariable::fprop ( ) [virtual]

compute output given input

Implements PLearn::Variable.

Definition at line 193 of file SampleVariable.cc.

References PLearn::gaussian_mu_sigma(), PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Variable::length(), and PLearn::Variable::valuedata.

{
    if (input2->isScalar())
    {
        real sigma = input2->valuedata[0];
        for (int k=0;k<length();k++)
            valuedata[k] = gaussian_mu_sigma(input1->valuedata[k],
                                             sigma);
    }
    else
        for (int k=0;k<length();k++)
            valuedata[k] = gaussian_mu_sigma(input1->valuedata[k],
                                             input2->valuedata[k]);
}

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines