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

#include <IdentityVariable.h>

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

List of all members.

Public Member Functions

 IdentityVariable ()
 Default constructor for persistence.
 IdentityVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual IdentityVariabledeepCopy (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 bbprop ()
 compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...
virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var
virtual void rfprop ()
void setInput (Var the_input)
 Set this Variable's input (simply call build after setting the new input).

Static Public Member Functions

static string _classname_ ()
 IdentityVariable.
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 42 of file IdentityVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 43 of file IdentityVariable.h.


Constructor & Destructor Documentation

PLearn::IdentityVariable::IdentityVariable ( ) [inline]

Default constructor for persistence.

Definition at line 47 of file IdentityVariable.h.

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

Definition at line 47 of file IdentityVariable.cc.

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

Member Function Documentation

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

IdentityVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

void PLearn::IdentityVariable::bbprop ( ) [virtual]

compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...

d^2C/dx^2 = d^2C/dy^2 * (dy/dx)^2 + dC/dy * d^2y/dx^2 (diaghessian) (gradient)

Reimplemented from PLearn::Variable.

Definition at line 77 of file IdentityVariable.cc.

References PLERROR.

                              {
    PLERROR("bbprop is not implemented for IdentityVariable");
}
void PLearn::IdentityVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 68 of file IdentityVariable.cc.

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

                             {
    int l = nelems();
    real* inputgradientptr = input->gradientdata;
    real* gradientptr = gradientdata;

    for(int i=0; i<l; i++)
        *inputgradientptr++ += *gradientptr++ * 1.0;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 50 of file IdentityVariable.h.

{ input = the_input;}
IdentityVariable * PLearn::IdentityVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 59 of file IdentityVariable.cc.

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

                             {
    int l = nelems();
    real* inputptr = input->valuedata;
    real* ptr = valuedata;
    for(int i=0; i<l; i++)
        *ptr++ = *inputptr++;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 45 of file IdentityVariable.cc.

void PLearn::IdentityVariable::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 51 of file IdentityVariable.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::IdentityVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 86 of file IdentityVariable.cc.

References PLERROR.

                              {
    PLERROR("rfprop is not implemented for IdentityVariable");
}
void PLearn::IdentityVariable::setInput ( Var  the_input) [inline]

Set this Variable's input (simply call build after setting the new input).

Reimplemented from PLearn::UnaryVariable.

Definition at line 58 of file IdentityVariable.h.

{ input = the_input;}
void PLearn::IdentityVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 82 of file IdentityVariable.cc.

References PLERROR.

                                     {
    PLERROR("symbolicBprop is not implemented for IdentityVariable");
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 50 of file IdentityVariable.h.


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