|
PLearn 0.1
|
#include <SampleVariable.h>


Public Member Functions | |
| UniformSampleVariable (int length=1, int width=1, real minvalue=0, real maxvalue=1) | |
| virtual UniformSampleVariable * | deepCopy (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] |
Definition at line 91 of file SampleVariable.h.
| 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); }

| 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;
}

| 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);
}

real PLearn::UniformSampleVariable::max_value [protected] |
box constraints on values
Reimplemented from PLearn::Variable.
Definition at line 94 of file SampleVariable.h.
Referenced by fprop(), and UniformSampleVariable().
real PLearn::UniformSampleVariable::min_value [protected] |
Reimplemented from PLearn::Variable.
Definition at line 94 of file SampleVariable.h.
Referenced by fprop(), and UniformSampleVariable().
char PLearn::UniformSampleVariable::name[50] [protected] |
Definition at line 95 of file SampleVariable.h.
Referenced by UniformSampleVariable().
1.7.4