PLearn 0.1
|
#include <DuplicateColumnVariable.h>
Public Member Functions | |
DuplicateColumnVariable () | |
Default constructor for persistence. | |
DuplicateColumnVariable (Variable *input, int thewidth) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual DuplicateColumnVariable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-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 () |
Nothing to do by default. | |
virtual void | bprop () |
Nothing to do by default. | |
virtual void | symbolicBprop () |
compute a piece of new Var graph that represents the symbolic derivative of this Var | |
Static Public Member Functions | |
static string | _classname_ () |
DuplicateColumnVariable. | |
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 void | declareOptions (OptionList &ol) |
Declare options (data fields) for the class. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
void | build_ () |
Object-specific post-constructor. | |
Protected Attributes | |
int | width_ |
Private Types | |
typedef UnaryVariable | inherited |
Definition at line 52 of file DuplicateColumnVariable.h.
typedef UnaryVariable PLearn::DuplicateColumnVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file DuplicateColumnVariable.h.
PLearn::DuplicateColumnVariable::DuplicateColumnVariable | ( | ) | [inline] |
string PLearn::DuplicateColumnVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
OptionList & PLearn::DuplicateColumnVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
RemoteMethodMap & PLearn::DuplicateColumnVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
Object * PLearn::DuplicateColumnVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
StaticInitializer DuplicateColumnVariable::_static_initializer_ & PLearn::DuplicateColumnVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
void PLearn::DuplicateColumnVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 102 of file DuplicateColumnVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, j, PLearn::Variable::length(), and PLearn::Variable::width().
{ int k=0; for(int i=0; i<length(); i++) for(int j=0; j<width(); j++, k++) input->gradientdata[i] += gradientdata[k]; }
void PLearn::DuplicateColumnVariable::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::UnaryVariable.
Definition at line 64 of file DuplicateColumnVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::DuplicateColumnVariable::build_ | ( | ) | [protected] |
Object-specific post-constructor.
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build()
method, and possibly the public virtual read method (which calls its parent's read). build_()
can assume that its parent's build_()
has already been called.
Reimplemented from PLearn::UnaryVariable.
Definition at line 71 of file DuplicateColumnVariable.cc.
References PLearn::UnaryVariable::input, and PLERROR.
Referenced by build(), and DuplicateColumnVariable().
{ if (input && !input->isColumnVec()) PLERROR("In DuplicateColumnVariable input is not a column"); }
string PLearn::DuplicateColumnVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
void PLearn::DuplicateColumnVariable::declareOptions | ( | OptionList & | ol | ) | [static] |
Declare options (data fields) for the class.
Redefine this in subclasses: call declareOption
(...) for each option, and then call inherited::declareOptions(options)
. Please call the inherited
method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).
static void MyDerivedClass::declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "The size of the input; it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "The learned model weights"); inherited::declareOptions(ol); }
ol | List of options that is progressively being constructed for the current class. |
Reimplemented from PLearn::UnaryVariable.
Definition at line 78 of file DuplicateColumnVariable.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and width_.
{ declareOption(ol, "width_", &DuplicateColumnVariable::width_, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::DuplicateColumnVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 65 of file DuplicateColumnVariable.h.
: void build_();
DuplicateColumnVariable * PLearn::DuplicateColumnVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
void PLearn::DuplicateColumnVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 93 of file DuplicateColumnVariable.cc.
References i, PLearn::UnaryVariable::input, j, PLearn::Variable::length(), PLearn::Variable::valuedata, and PLearn::Variable::width().
{ int k=0; for(int i=0; i<length(); i++) for(int j=0; j<width(); j++, k++) valuedata[k] = input->valuedata[i]; }
OptionList & PLearn::DuplicateColumnVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
OptionMap & PLearn::DuplicateColumnVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
RemoteMethodMap & PLearn::DuplicateColumnVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file DuplicateColumnVariable.cc.
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 84 of file DuplicateColumnVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and width_.
void PLearn::DuplicateColumnVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 111 of file DuplicateColumnVariable.cc.
References PLearn::Variable::g, PLearn::UnaryVariable::input, and PLearn::rowSum().
Reimplemented from PLearn::UnaryVariable.
Definition at line 65 of file DuplicateColumnVariable.h.
int PLearn::DuplicateColumnVariable::width_ [protected] |
Definition at line 57 of file DuplicateColumnVariable.h.
Referenced by declareOptions(), and recomputeSize().