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

#include <ExtractVariable.h>

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

List of all members.

Public Member Functions

 ExtractVariable ()
 Default constructor for persistence.
 ExtractVariable (Variable *v, int the_offset, int the_length, int the_width)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ExtractVariabledeepCopy (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 ()
 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 ()

Static Public Member Functions

static string _classname_ ()
 ExtractVariable.
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_

Protected Attributes

int offset_
int length_
int width_

Private Types

typedef UnaryVariable inherited

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Detailed Description

Definition at line 51 of file ExtractVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file ExtractVariable.h.


Constructor & Destructor Documentation

PLearn::ExtractVariable::ExtractVariable ( ) [inline]

Default constructor for persistence.

Definition at line 66 of file ExtractVariable.h.

{}
PLearn::ExtractVariable::ExtractVariable ( Variable v,
int  the_offset,
int  the_length,
int  the_width 
)

Definition at line 57 of file ExtractVariable.cc.

References build_().

    : inherited(v, the_length, the_width),
      offset_(the_offset),
      length_(the_length),
      width_(the_width)
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

ExtractVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

void PLearn::ExtractVariable::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 107 of file ExtractVariable.cc.

References PLERROR.

{
    PLERROR("In SVDVariable::bbprop: feature not implemented");
}
void PLearn::ExtractVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 95 of file ExtractVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::length(), PLearn::Var::length(), PLearn::min(), offset_, and PLearn::Variable::width().

{
    real* inputgradient = input->gradientdata+offset_;
    int cnt = min(input->length()-offset_,length()*width());
    for(int i=0; i<cnt; i++)
    {
        inputgradient[i] += gradientdata[i];
    }

}

Here is the call graph for this function:

void PLearn::ExtractVariable::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 66 of file ExtractVariable.cc.

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

Here is the call graph for this function:

void PLearn::ExtractVariable::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 72 of file ExtractVariable.cc.

References PLearn::UnaryVariable::input, offset_, and PLERROR.

Referenced by build(), and ExtractVariable().

{
    if (input) {
        // input is v from constructor
        if(offset_ < 0)
            PLERROR("In ExtractVariable: requested matrix is out of bounds");
    }
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 69 of file ExtractVariable.h.

:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 84 of file ExtractVariable.cc.

References i, PLearn::UnaryVariable::input, PLearn::Variable::length(), PLearn::Var::length(), PLearn::min(), offset_, PLearn::Variable::valuedata, and PLearn::Variable::width().

{
    real* inputdata = input->valuedata+offset_;
    int cnt = min(input->length()-offset_,length()*width());
    for(int i=0; i<cnt; i++)
    {
        valuedata[i] = inputdata[i];
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ExtractVariable.cc.

void PLearn::ExtractVariable::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 81 of file ExtractVariable.cc.

References length_, and width_.

{ l=length_; w=width_; }
void PLearn::ExtractVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 118 of file ExtractVariable.cc.

References PLERROR.

{
    PLERROR("In SVDVariable::rfprop: feature not implemented");
}
void PLearn::ExtractVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 112 of file ExtractVariable.cc.

References PLERROR.

{
    PLERROR("In SVDVariable::symbolicBprop: feature not implemented");
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 69 of file ExtractVariable.h.

Definition at line 61 of file ExtractVariable.h.

Referenced by recomputeSize().

Definition at line 60 of file ExtractVariable.h.

Referenced by bprop(), build_(), and fprop().

Definition at line 61 of file ExtractVariable.h.

Referenced by recomputeSize().


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