PLearn 0.1
|
multiplies a matrix var by a scalar constant More...
#include <TimesConstantVariable.h>
Public Member Functions | |
TimesConstantVariable () | |
Default constructor for persistence. | |
TimesConstantVariable (Variable *input, real c) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual TimesConstantVariable * | deepCopy (CopiesMap &copies) const |
virtual string | info () const |
Returns a bit more informative string about object (default returns classname()) | |
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 | |
virtual void | rfprop () |
Static Public Member Functions | |
static string | _classname_ () |
TimesConstantVariable. | |
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 () |
Public Attributes | |
real | cst |
The constant. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declare options (data fields) for the class. | |
Private Types | |
typedef UnaryVariable | inherited |
multiplies a matrix var by a scalar constant
* Times... *
Definition at line 57 of file TimesConstantVariable.h.
typedef UnaryVariable PLearn::TimesConstantVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file TimesConstantVariable.h.
PLearn::TimesConstantVariable::TimesConstantVariable | ( | ) | [inline] |
Default constructor for persistence.
Definition at line 67 of file TimesConstantVariable.h.
: cst() {}
string PLearn::TimesConstantVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
OptionList & PLearn::TimesConstantVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
RemoteMethodMap & PLearn::TimesConstantVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
Object * PLearn::TimesConstantVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
StaticInitializer TimesConstantVariable::_static_initializer_ & PLearn::TimesConstantVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
void PLearn::TimesConstantVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 84 of file TimesConstantVariable.cc.
References cst, PLearn::Variable::gradientdata, PLearn::UnaryVariable::input, and PLearn::Variable::nelems().
{ for(int k=0; k<nelems(); k++) input->gradientdata[k] += cst*gradientdata[k]; }
string PLearn::TimesConstantVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
void PLearn::TimesConstantVariable::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
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 62 of file TimesConstantVariable.cc.
References PLearn::OptionBase::buildoption, cst, PLearn::declareOption(), and PLearn::UnaryVariable::declareOptions().
{ declareOption(ol, "cst", &TimesConstantVariable::cst, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::TimesConstantVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 70 of file TimesConstantVariable.h.
TimesConstantVariable * PLearn::TimesConstantVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
void PLearn::TimesConstantVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 77 of file TimesConstantVariable.cc.
References cst, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), and PLearn::Variable::valuedata.
OptionList & PLearn::TimesConstantVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
OptionMap & PLearn::TimesConstantVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
RemoteMethodMap & PLearn::TimesConstantVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file TimesConstantVariable.cc.
virtual string PLearn::TimesConstantVariable::info | ( | ) | const [inline, virtual] |
Returns a bit more informative string about object (default returns classname())
Reimplemented from PLearn::Object.
Definition at line 73 of file TimesConstantVariable.h.
References PLearn::tostring().
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 68 of file TimesConstantVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::TimesConstantVariable::rfprop | ( | ) | [virtual] |
Reimplemented from PLearn::Variable.
Definition at line 98 of file TimesConstantVariable.cc.
References cst, PLearn::UnaryVariable::input, PLearn::TVec< T >::length(), PLearn::Variable::nelems(), PLearn::UnaryVariable::resizeRValue(), PLearn::Variable::rValue, and PLearn::Variable::rvaluedata.
{ if (rValue.length()==0) resizeRValue(); for(int k=0; k<nelems(); k++) rvaluedata[k] = input->rvaluedata[k]*cst; }
void PLearn::TimesConstantVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 91 of file TimesConstantVariable.cc.
References cst, PLearn::Variable::g, and PLearn::UnaryVariable::input.
Reimplemented from PLearn::UnaryVariable.
Definition at line 70 of file TimesConstantVariable.h.
The constant.
Definition at line 63 of file TimesConstantVariable.h.
Referenced by bprop(), declareOptions(), fprop(), rfprop(), and symbolicBprop().