PLearn 0.1
|
#include <PlusManyVariable.h>
Public Member Functions | |
PlusManyVariable () | |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //! | |
PlusManyVariable (const VarArray &the_array, bool call_build_=true) | |
Convenience constructor. | |
virtual void | recomputeSize (int &l, int &w) const |
Recomputes the length l and width w that this variable should have, according to its parent variables. | |
virtual void | fprop () |
compute output given input | |
virtual void | bprop () |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual PlusManyVariable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
PlusManyVariable. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef NaryVariable | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
* PlusManyVariable *
Definition at line 50 of file PlusManyVariable.h.
typedef NaryVariable PLearn::PlusManyVariable::inherited [private] |
Reimplemented from PLearn::NaryVariable.
Definition at line 52 of file PlusManyVariable.h.
PLearn::PlusManyVariable::PlusManyVariable | ( | ) |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
Default constructor.
Definition at line 56 of file PlusManyVariable.cc.
{}
string PLearn::PlusManyVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
OptionList & PLearn::PlusManyVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
RemoteMethodMap & PLearn::PlusManyVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
Object * PLearn::PlusManyVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 51 of file PlusManyVariable.cc.
StaticInitializer PlusManyVariable::_static_initializer_ & PLearn::PlusManyVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
void PLearn::PlusManyVariable::bprop | ( | ) | [virtual] |
Implements PLearn::Variable.
Definition at line 97 of file PlusManyVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::TVec< T >::length(), n, PLearn::Variable::nelems(), and PLearn::NaryVariable::varray.
{ int n = nelems(); for (int i = 0; i < varray.length(); i++) { real* vi = varray[i]->gradientdata; for (int k=0; k<n; k++) vi[k] += gradientdata[k]; } }
void PLearn::PlusManyVariable::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::NaryVariable.
Definition at line 110 of file PlusManyVariable.cc.
References PLearn::NaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::PlusManyVariable::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::NaryVariable.
Definition at line 136 of file PlusManyVariable.cc.
References i, PLearn::Variable::length(), PLearn::TVec< T >::length(), PLERROR, PLearn::NaryVariable::varray, and w.
Referenced by build(), and PlusManyVariable().
{ // Check sizes are coherent. if (varray.length() >= 2) { int l = varray[0]->length(); int w = varray[1]->width(); for (int i = 1; i < varray.length(); i++) if (varray[i]->length() != l || varray[i]->width() != w) PLERROR("In PlusManyVariable::build_ - All source variables " "must have the same size"); } }
string PLearn::PlusManyVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 51 of file PlusManyVariable.cc.
void PLearn::PlusManyVariable::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::NaryVariable.
Definition at line 127 of file PlusManyVariable.cc.
References PLearn::NaryVariable::declareOptions().
{ // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::PlusManyVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 79 of file PlusManyVariable.h.
:
//##### Protected Options ###############################################
PlusManyVariable * PLearn::PlusManyVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::NaryVariable.
Definition at line 51 of file PlusManyVariable.cc.
void PLearn::PlusManyVariable::fprop | ( | ) | [virtual] |
compute output given input
Implements PLearn::Variable.
Definition at line 83 of file PlusManyVariable.cc.
References PLearn::Variable::fillValue(), i, PLearn::TVec< T >::length(), n, PLearn::Variable::nelems(), PLearn::Variable::valuedata, and PLearn::NaryVariable::varray.
{ fillValue(0); int n = nelems(); for (int i = 0; i < varray.length(); i++) { real* vi = varray[i]->valuedata; for (int k=0; k<n; k++) valuedata[k] += vi[k]; } }
OptionList & PLearn::PlusManyVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 51 of file PlusManyVariable.cc.
OptionMap & PLearn::PlusManyVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 51 of file PlusManyVariable.cc.
RemoteMethodMap & PLearn::PlusManyVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 51 of file PlusManyVariable.cc.
void PLearn::PlusManyVariable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::NaryVariable.
Definition at line 119 of file PlusManyVariable.cc.
References PLearn::NaryVariable::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
Recomputes the length l and width w that this variable should have, according to its parent variables.
This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.
Reimplemented from PLearn::Variable.
Definition at line 71 of file PlusManyVariable.cc.
References PLearn::TVec< T >::length(), and PLearn::NaryVariable::varray.
Reimplemented from PLearn::NaryVariable.
Definition at line 79 of file PlusManyVariable.h.