PLearn 0.1
|
#include <ArgminVariable.h>
Public Member Functions | |
ArgminVariable () | |
Default constructor for persistence. | |
ArgminVariable (Variable *input) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ArgminVariable * | deepCopy (CopiesMap &copies) const |
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_ () |
ArgminVariable. | |
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 |
This variable computes the index of the minimum value in the input It is a scalar variable if the input is a vector (single row or single column) Otherwise it is a single-column of length() 2 containing the (i,j) coordinate of the min
Definition at line 56 of file ArgminVariable.h.
typedef UnaryVariable PLearn::ArgminVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file ArgminVariable.h.
PLearn::ArgminVariable::ArgminVariable | ( | ) | [inline] |
PLearn::ArgminVariable::ArgminVariable | ( | Variable * | input | ) |
Definition at line 55 of file ArgminVariable.cc.
string PLearn::ArgminVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
OptionList & PLearn::ArgminVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
RemoteMethodMap & PLearn::ArgminVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
Object * PLearn::ArgminVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
StaticInitializer ArgminVariable::_static_initializer_ & PLearn::ArgminVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
void PLearn::ArgminVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 105 of file ArgminVariable.cc.
{}
string PLearn::ArgminVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
static const PPath& PLearn::ArgminVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 65 of file ArgminVariable.h.
{ return new ArgminVariable(v); }
ArgminVariable * PLearn::ArgminVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
void PLearn::ArgminVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 66 of file ArgminVariable.cc.
References PLearn::argmin(), i, PLearn::UnaryVariable::input, j, PLearn::Var::length(), PLearn::Variable::valuedata, and PLearn::Var::width().
{ real minval = input->valuedata[0]; if (input->isVec()) { int argmin = 0; for(int i=1; i<input->nelems(); i++) { real val = input->valuedata[i]; if(val<minval) { minval = val; argmin = i; } } valuedata[0] = argmin; } else { int k = 0; int argmin_i = 0; int argmin_j = 0; for(int i=0; i<input->length(); i++) for(int j=0; j<input->width(); j++, k++) { real val = input->valuedata[k]; if(val<minval) { minval = val; argmin_i = i; argmin_j = j; } } valuedata[0] = argmin_i; valuedata[1] = argmin_j; } }
OptionList & PLearn::ArgminVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
OptionMap & PLearn::ArgminVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.cc.
RemoteMethodMap & PLearn::ArgminVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 53 of file ArgminVariable.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 59 of file ArgminVariable.cc.
References PLearn::UnaryVariable::input.
void PLearn::ArgminVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 107 of file ArgminVariable.cc.
{}
Reimplemented from PLearn::UnaryVariable.
Definition at line 65 of file ArgminVariable.h.