PLearn 0.1
|
#include <NonDiagVariable.h>
Public Member Functions | |
NonDiagVariable () | |
Default constructor. | |
NonDiagVariable (Variable *input, bool call_build_=true) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual NonDiagVariable * | 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 | bbprop () |
here don't approximate, do d2C/dx^2 = 4 x^2 d2C/dy^2 + 2 dC/dy | |
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_ () |
NonDiagVariable. | |
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_ |
Private Types | |
typedef UnaryVariable | inherited |
Private Member Functions | |
void | build_ () |
Object-specific post-constructor. |
Definition at line 48 of file NonDiagVariable.h.
typedef UnaryVariable PLearn::NonDiagVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 50 of file NonDiagVariable.h.
PLearn::NonDiagVariable::NonDiagVariable | ( | ) |
string PLearn::NonDiagVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
OptionList & PLearn::NonDiagVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
RemoteMethodMap & PLearn::NonDiagVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
Object * PLearn::NonDiagVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
StaticInitializer NonDiagVariable::_static_initializer_ & PLearn::NonDiagVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
void PLearn::NonDiagVariable::bbprop | ( | ) | [virtual] |
here don't approximate, do d2C/dx^2 = 4 x^2 d2C/dy^2 + 2 dC/dy
Reimplemented from PLearn::Variable.
Definition at line 124 of file NonDiagVariable.cc.
References PLERROR.
{ PLERROR("bbprop not implemented for this variable"); }
void PLearn::NonDiagVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 111 of file NonDiagVariable.cc.
References PLearn::Variable::gradient, i, PLearn::UnaryVariable::input, j, PLearn::TMat< T >::length(), w, and PLearn::TMat< T >::width().
{ Mat G = input->matGradient; int l = G.length(); int w = G.width(); int k=0; for(int i=0; i<l; i++) for(int j=0; j<w; j++) if(i!=j) G(i,j) += gradient[k++]; }
void PLearn::NonDiagVariable::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 72 of file NonDiagVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::NonDiagVariable::build_ | ( | ) | [private] |
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 80 of file NonDiagVariable.cc.
Referenced by build(), and NonDiagVariable().
{
// Nothing to do here.
}
string PLearn::NonDiagVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
static const PPath& PLearn::NonDiagVariable::declaringFile | ( | ) | [inline, static] |
NonDiagVariable * PLearn::NonDiagVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
void PLearn::NonDiagVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 99 of file NonDiagVariable.cc.
References i, PLearn::UnaryVariable::input, j, PLearn::TMat< T >::length(), PLearn::Variable::value, w, and PLearn::TMat< T >::width().
{ Mat V = input->matValue; int l = V.length(); int w = V.width(); int k=0; for(int i=0; i<l; i++) for(int j=0; j<w; j++) if(i!=j) value[k++] = V(i,j); }
OptionList & PLearn::NonDiagVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
OptionMap & PLearn::NonDiagVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.cc.
RemoteMethodMap & PLearn::NonDiagVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file NonDiagVariable.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 87 of file NonDiagVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), PLearn::min(), and PLearn::Var::width().
{ if (input) { l = input->length()*input->width()-min(input->length(), input->width()); w = 1; } else l = w = 0; }
void PLearn::NonDiagVariable::rfprop | ( | ) | [virtual] |
Reimplemented from PLearn::Variable.
Definition at line 136 of file NonDiagVariable.cc.
References PLERROR.
{ PLERROR("rfprop no yet implemented for this vairable"); }
void PLearn::NonDiagVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 130 of file NonDiagVariable.cc.
References PLERROR.
{ PLERROR("symbolic bprop not yet implemented for this variable"); }
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file NonDiagVariable.h.