PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types
PLearn::MinVariable Class Reference

#include <MinVariable.h>

Inheritance diagram for PLearn::MinVariable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::MinVariable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MinVariable ()
 Default constructor for persistence.
 MinVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual MinVariabledeepCopy (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_ ()
 MinVariable.
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Static Public Attributes

static StaticInitializer _static_initializer_

Private Types

typedef UnaryVariable inherited

Detailed Description

Definition at line 51 of file MinVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file MinVariable.h.


Constructor & Destructor Documentation

PLearn::MinVariable::MinVariable ( ) [inline]

Default constructor for persistence.

Definition at line 57 of file MinVariable.h.

{}
PLearn::MinVariable::MinVariable ( Variable input)

Definition at line 63 of file MinVariable.cc.

    : inherited(input, 1, 1) {}

Member Function Documentation

string PLearn::MinVariable::_classname_ ( ) [static]

MinVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

OptionList & PLearn::MinVariable::_getOptionList_ ( ) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

RemoteMethodMap & PLearn::MinVariable::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

bool PLearn::MinVariable::_isa_ ( const Object o) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

Object * PLearn::MinVariable::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

StaticInitializer MinVariable::_static_initializer_ & PLearn::MinVariable::_static_initialize_ ( ) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

void PLearn::MinVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 83 of file MinVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, and PLearn::Variable::valuedata.

{
    real minval = valuedata[0];
    for(int i=0; i<input->nelems(); i++)
    {
        if(input->valuedata[i]==minval)
            input->gradientdata[i] += gradientdata[0];
    }
}
string PLearn::MinVariable::classname ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

static const PPath& PLearn::MinVariable::declaringFile ( ) [inline, static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 60 of file MinVariable.h.

{ return new MinVariable(v); }
MinVariable * PLearn::MinVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

void PLearn::MinVariable::fprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 70 of file MinVariable.cc.

References i, PLearn::UnaryVariable::input, and PLearn::Variable::valuedata.

{
    real minval = input->valuedata[0];
    for(int i=1; i<input->nelems(); i++)
    {
        real val = input->valuedata[i];
        if(val<minval)
            minval = val;
    }
    valuedata[0] = minval;
}
OptionList & PLearn::MinVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

OptionMap & PLearn::MinVariable::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

RemoteMethodMap & PLearn::MinVariable::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file MinVariable.cc.

void PLearn::MinVariable::recomputeSize ( int l,
int w 
) const [virtual]

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 67 of file MinVariable.cc.

{ l=1; w=1; }
void PLearn::MinVariable::symbolicBprop ( ) [virtual]

compute a piece of new Var graph that represents the symbolic derivative of this Var

Reimplemented from PLearn::Variable.

Definition at line 94 of file MinVariable.cc.

References PLearn::argmin(), PLearn::Variable::g, PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().

{
    input->accg(new ElementAtPositionVariable(g, argmin(input), input->length(), input->width()));
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 60 of file MinVariable.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines