PLearn 0.1
|
#include <MinusTransposedColumnVariable.h>
Public Member Functions | |
MinusTransposedColumnVariable () | |
Default constructor for persistence. | |
MinusTransposedColumnVariable (Variable *input1, Variable *input2) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual MinusTransposedColumnVariable * | 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 () |
compute output given input | |
virtual void | bprop () |
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_ () |
MinusTransposedColumnVariable. | |
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_ |
Protected Member Functions | |
void | build_ () |
This does the actual building. | |
Private Types | |
typedef BinaryVariable | inherited |
Definition at line 52 of file MinusTransposedColumnVariable.h.
typedef BinaryVariable PLearn::MinusTransposedColumnVariable::inherited [private] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 54 of file MinusTransposedColumnVariable.h.
PLearn::MinusTransposedColumnVariable::MinusTransposedColumnVariable | ( | ) | [inline] |
Default constructor for persistence.
Definition at line 58 of file MinusTransposedColumnVariable.h.
{}
string PLearn::MinusTransposedColumnVariable::_classname_ | ( | ) | [static] |
MinusTransposedColumnVariable.
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
OptionList & PLearn::MinusTransposedColumnVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
RemoteMethodMap & PLearn::MinusTransposedColumnVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
Object * PLearn::MinusTransposedColumnVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
StaticInitializer MinusTransposedColumnVariable::_static_initializer_ & PLearn::MinusTransposedColumnVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
void PLearn::MinusTransposedColumnVariable::bprop | ( | ) | [virtual] |
Implements PLearn::Variable.
Definition at line 102 of file MinusTransposedColumnVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, j, PLearn::Variable::length(), and PLearn::Variable::width().
{ int k=0; real* i2g = input2->gradientdata; real* i1g = input1->gradientdata; for(int i=0; i<length(); i++) for(int j=0; j<width(); j++, k++) { i1g[k] += gradientdata[k]; i2g[j] -= gradientdata[k]; } }
void PLearn::MinusTransposedColumnVariable::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::BinaryVariable.
Definition at line 65 of file MinusTransposedColumnVariable.cc.
References PLearn::BinaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::MinusTransposedColumnVariable::build_ | ( | ) | [protected] |
This does the actual building.
Reimplemented from PLearn::BinaryVariable.
Definition at line 72 of file MinusTransposedColumnVariable.cc.
References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Var::length(), PLERROR, and PLearn::Var::width().
Referenced by build(), and MinusTransposedColumnVariable().
{ if (input1 && input2) { if(!input2->isColumnVec()) PLERROR("IN MinusTransposedColumnVariable: input2 is not a column"); if(input2->length() != input1->width()) PLERROR("IN MinusTransposedColumnVariable: the width() of input1 and the length() of input2 differ"); } }
string PLearn::MinusTransposedColumnVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
static const PPath& PLearn::MinusTransposedColumnVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 61 of file MinusTransposedColumnVariable.h.
: void build_();
MinusTransposedColumnVariable * PLearn::MinusTransposedColumnVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
void PLearn::MinusTransposedColumnVariable::fprop | ( | ) | [virtual] |
compute output given input
Implements PLearn::Variable.
Definition at line 91 of file MinusTransposedColumnVariable.cc.
References i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, j, PLearn::Variable::length(), PLearn::Variable::valuedata, and PLearn::Variable::width().
{ int k=0; real* i2 = input2->valuedata; real* i1 = input1->valuedata; for(int i=0; i<length(); i++) for(int j=0; j<width(); j++, k++) valuedata[k] = i1[k] - i2[j]; }
OptionList & PLearn::MinusTransposedColumnVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
OptionMap & PLearn::MinusTransposedColumnVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 56 of file MinusTransposedColumnVariable.cc.
RemoteMethodMap & PLearn::MinusTransposedColumnVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 56 of file MinusTransposedColumnVariable.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 82 of file MinusTransposedColumnVariable.cc.
References PLearn::BinaryVariable::input1, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::MinusTransposedColumnVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 116 of file MinusTransposedColumnVariable.cc.
References PLearn::columnSum(), PLearn::Variable::g, PLearn::BinaryVariable::input1, and PLearn::BinaryVariable::input2.
Reimplemented from PLearn::BinaryVariable.
Definition at line 61 of file MinusTransposedColumnVariable.h.