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

#include <TraceVariable.h>

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

List of all members.

Public Member Functions

 TraceVariable ()
 Default constructor.
 TraceVariable (Variable *input, bool call_build_=true)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual TraceVariabledeepCopy (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_ ()
 TraceVariable.
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

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Detailed Description

Definition at line 48 of file TraceVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 50 of file TraceVariable.h.


Constructor & Destructor Documentation

PLearn::TraceVariable::TraceVariable ( )

Default constructor.

Definition at line 59 of file TraceVariable.cc.

{}
PLearn::TraceVariable::TraceVariable ( Variable input,
bool  call_build_ = true 
)

Definition at line 62 of file TraceVariable.cc.

References build_().

                                                             :
    inherited(input, 1, 1, call_build_)
{
    if (call_build_)
        build_();
}

Here is the call graph for this function:


Member Function Documentation

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

TraceVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

void PLearn::TraceVariable::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 113 of file TraceVariable.cc.

References PLERROR.

{
    PLERROR("bbprop not implemented for this variable");
}
void PLearn::TraceVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 103 of file TraceVariable.cc.

References PLearn::Variable::g, i, PLearn::UnaryVariable::input, PLearn::TMat< T >::length(), PLearn::Variable::matGradient, PLearn::min(), and PLearn::TMat< T >::width().

{
    double g = matGradient(0,0);
    Mat G = input->gradientValue;
    int l = min(G.length(), G.width());
    for(int i=0; i<l; i++)
        G(i,i) += g;
}

Here is the call graph for this function:

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

References PLearn::UnaryVariable::build(), and build_().

Here is the call graph for this function:

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

Referenced by build(), and TraceVariable().

                           {
    // Nothing to do here.
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 59 of file TraceVariable.h.

:

TraceVariable * PLearn::TraceVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 93 of file TraceVariable.cc.

References i, PLearn::UnaryVariable::input, PLearn::TMat< T >::length(), PLearn::Variable::matValue, PLearn::min(), and PLearn::TMat< T >::width().

{
    Mat V = input->matValue;
    int l = min(V.length(), V.width());
    double result = 0;
    for(int i=0; i<l; i++)
        result += V(i,i);
    matValue(0,0) = result;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file TraceVariable.cc.

void PLearn::TraceVariable::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 87 of file TraceVariable.cc.

{
    l = w = 1;
}
void PLearn::TraceVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 125 of file TraceVariable.cc.

References PLERROR.

{
    PLERROR("rfprop no yet implemented for this vairable");
}
void PLearn::TraceVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 119 of file TraceVariable.cc.

References PLERROR.

{
    PLERROR("symbolic bprop not yet implemented for this variable");
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 59 of file TraceVariable.h.


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