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

#include <SampleVariable.h>

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

List of all members.

Public Member Functions

 UniformSampleVariable (int length=1, int width=1, real minvalue=0, real maxvalue=1)
virtual UniformSampleVariabledeepCopy (CopiesMap &copies) const
virtual string classname () const
virtual void fprop ()
 compute output given input

Protected Attributes

real min_value
real max_value
 box constraints on values
char name [50]

Detailed Description

Definition at line 91 of file SampleVariable.h.


Constructor & Destructor Documentation

PLearn::UniformSampleVariable::UniformSampleVariable ( int  length = 1,
int  width = 1,
real  minvalue = 0,
real  maxvalue = 1 
)

Definition at line 96 of file SampleVariable.cc.

References max_value, min_value, and name.

Referenced by deepCopy().

    :SourceSampleVariable(length,width),
     min_value(minvalue),max_value(maxvalue)
{
    sprintf(name,"U[%f,%f]",min_value,max_value);
}

Here is the caller graph for this function:


Member Function Documentation

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

Reimplemented from PLearn::SourceSampleVariable.

Definition at line 93 of file SampleVariable.cc.

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

Implements PLearn::SourceSampleVariable.

Definition at line 105 of file SampleVariable.cc.

References PLearn::SourceVariable::makeDeepCopyFromShallowCopy(), and UniformSampleVariable().

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

compute output given input

Reimplemented from PLearn::SourceVariable.

Definition at line 121 of file SampleVariable.cc.

References PLearn::bounded_uniform(), max_value, min_value, PLearn::Variable::nelems(), and PLearn::Variable::valuedata.

{
    for (int k=0;k<nelems();k++)
        valuedata[k] = bounded_uniform(min_value,max_value);

}

Here is the call graph for this function:


Member Data Documentation

box constraints on values

Reimplemented from PLearn::Variable.

Definition at line 94 of file SampleVariable.h.

Referenced by fprop(), and UniformSampleVariable().

Reimplemented from PLearn::Variable.

Definition at line 94 of file SampleVariable.h.

Referenced by fprop(), and UniformSampleVariable().

Definition at line 95 of file SampleVariable.h.

Referenced by UniformSampleVariable().


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