PLearn 0.1
Public Member Functions | Protected Attributes
PLearn::MultinomialSampleVariable Class Reference

#include <SampleVariable.h>

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

List of all members.

Public Member Functions

 MultinomialSampleVariable (Variable *probabilities, int length=1, int width=1)
virtual MultinomialSampleVariabledeepCopy (CopiesMap &copies) const
virtual string classname () const
virtual void fprop ()
 Nothing to do by default.

Protected Attributes

char name [50]

Detailed Description

Definition at line 105 of file SampleVariable.h.


Constructor & Destructor Documentation

PLearn::MultinomialSampleVariable::MultinomialSampleVariable ( Variable probabilities,
int  length = 1,
int  width = 1 
)

Definition at line 133 of file SampleVariable.cc.

References name.

Referenced by deepCopy().

    :UnarySampleVariable(probabilities, length, width)
{
    sprintf(name,"Multinomial[%dx%d]",length,width);
}

Here is the caller graph for this function:


Member Function Documentation

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

Reimplemented from PLearn::UnarySampleVariable.

Definition at line 130 of file SampleVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 140 of file SampleVariable.cc.

References PLearn::UnaryVariable::makeDeepCopyFromShallowCopy(), and MultinomialSampleVariable().

{
    CopiesMap::iterator it = copies.find(this);
    if (it!=copies.end()) // a copy already exists, so return it
        return (MultinomialSampleVariable*)it->second;
  
    // Otherwise call the copy constructor to obtain a SHALLOW copy
    MultinomialSampleVariable* deep_copy = new MultinomialSampleVariable(*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::MultinomialSampleVariable::fprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 156 of file SampleVariable.cc.

References PLearn::UnaryVariable::input, PLearn::multinomial_sample(), PLearn::Variable::nelems(), and PLearn::Variable::valuedata.

{
    for (int k=0;k<nelems();k++)
        valuedata[k] = multinomial_sample(input->value);

}

Here is the call graph for this function:


Member Data Documentation

Definition at line 108 of file SampleVariable.h.

Referenced by MultinomialSampleVariable().


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