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

elementwise pow (returns 0 wherever input is negative) More...

#include <PowVariable.h>

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

List of all members.

Public Member Functions

 PowVariable ()
 Default constructor for persistence.
 PowVariable (Variable *input, real the_power)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual PowVariabledeepCopy (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_ ()
 PowVariable.
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 void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

real power

Private Types

typedef UnaryVariable inherited

Detailed Description

elementwise pow (returns 0 wherever input is negative)

Definition at line 54 of file PowVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file PowVariable.h.


Constructor & Destructor Documentation

PLearn::PowVariable::PowVariable ( ) [inline]

Default constructor for persistence.

Definition at line 63 of file PowVariable.h.

: power() {}
PLearn::PowVariable::PowVariable ( Variable input,
real  the_power 
)

Definition at line 57 of file PowVariable.cc.

    : inherited(input, input->length(), input->width()), power(the_power) 
{}

Member Function Documentation

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

PowVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 84 of file PowVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::mypow(), PLearn::Variable::nelems(), and power.

{
    for(int i=0; i<nelems(); i++)
        input->gradientdata[i] += power*gradientdata[i]*mypow(input->valuedata[i],power-1.0);
}

Here is the call graph for this function:

string PLearn::PowVariable::classname ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

void PLearn::PowVariable::declareOptions ( OptionList ol) [static]

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);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file PowVariable.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and power.

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 66 of file PowVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 77 of file PowVariable.cc.

References i, PLearn::UnaryVariable::input, PLearn::mypow(), PLearn::Variable::nelems(), power, and PLearn::Variable::valuedata.

{
    for(int i=0; i<nelems(); i++)
        valuedata[i] = mypow(input->valuedata[i],power);
}

Here is the call graph for this function:

OptionList & PLearn::PowVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file PowVariable.cc.

void PLearn::PowVariable::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 68 of file PowVariable.cc.

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

{
    if (input) {
        l = input->length();
        w = input->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:

void PLearn::PowVariable::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 PowVariable.cc.

References PLearn::Variable::g, PLearn::UnaryVariable::input, PLearn::pow(), and power.

{
    input->accg(g * (power*pow(input, power-1.)));
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 66 of file PowVariable.h.

Definition at line 59 of file PowVariable.h.

Referenced by bprop(), declareOptions(), fprop(), and symbolicBprop().


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