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

#include <DiagVariable.h>

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

List of all members.

Public Member Functions

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


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 50 of file DiagVariable.h.


Constructor & Destructor Documentation

PLearn::DiagVariable::DiagVariable ( )

Default constructor.

Definition at line 59 of file DiagVariable.cc.

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

Definition at line 62 of file DiagVariable.cc.

References build_().

                                                           :
    inherited(input, min(input->length(), input->width()), 1, call_build_)
{
    if (call_build_)
        build_();
}

Here is the call graph for this function:


Member Function Documentation

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

DiagVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

void PLearn::DiagVariable::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 116 of file DiagVariable.cc.

References PLERROR.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 107 of file DiagVariable.cc.

References PLearn::Variable::gradient, i, PLearn::UnaryVariable::input, and PLearn::TVec< T >::length().

{
    int l = gradient.length();
    Mat G = input->matGradient;
    for(int i=0; i<l; i++)
        G(i,i) += gradient[i];
}

Here is the call graph for this function:

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

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

Here is the call graph for this function:

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

Referenced by build(), and DiagVariable().

                          {
    // Nothing to do here.
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 59 of file DiagVariable.h.

:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 99 of file DiagVariable.cc.

References i, PLearn::UnaryVariable::input, PLearn::TVec< T >::length(), and PLearn::Variable::value.

{
    int l = value.length();
    Mat V = input->matValue;
    for(int i=0; i<l; i++)
        value[i] = V(i,i);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file DiagVariable.cc.

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

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

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

Here is the call graph for this function:

void PLearn::DiagVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 128 of file DiagVariable.cc.

References PLERROR.

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

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

Reimplemented from PLearn::Variable.

Definition at line 122 of file DiagVariable.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 DiagVariable.h.


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