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

#include <VarRowsVariable.h>

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

List of all members.

Public Member Functions

 VarRowsVariable ()
 Default constructor for persistence.
 VarRowsVariable (Variable *input1, Variable *input2)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual VarRowsVariabledeepCopy (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 ()
 compute output given input
virtual void bprop ()
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_ ()
 VarRowsVariable.
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 Member Functions

void build_ ()
 This does the actual building.

Private Types

typedef BinaryVariable inherited

Detailed Description

Variable that is a subset of a matrix's rows input1 : matrix from which rows are selected input2 : vector whose elements are row indices in input1

Definition at line 56 of file VarRowsVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 58 of file VarRowsVariable.h.


Constructor & Destructor Documentation

PLearn::VarRowsVariable::VarRowsVariable ( ) [inline]

Default constructor for persistence.

Definition at line 62 of file VarRowsVariable.h.

{}
PLearn::VarRowsVariable::VarRowsVariable ( Variable input1,
Variable input2 
)

Definition at line 57 of file VarRowsVariable.cc.

References build_().

    : inherited(input1, input2, input2->length(), input1->width())
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

VarRowsVariable.

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

Implements PLearn::Variable.

Definition at line 92 of file VarRowsVariable.cc.

References i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Var::length(), PLearn::Variable::matGradient, PLearn::TMat< T >::row(), and PLearn::Var::row().

{
    for (int i = 0; i < input2->length(); ++i)
    {
        int r=int(input2->value[i]);
        input1->matGradient.row(r) += matGradient.row(i);
        input1->updateRow(r);
    }
}

Here is the call graph for this function:

void PLearn::VarRowsVariable::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::BinaryVariable.

Definition at line 64 of file VarRowsVariable.cc.

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

Here is the call graph for this function:

void PLearn::VarRowsVariable::build_ ( ) [protected]

This does the actual building.

Reimplemented from PLearn::BinaryVariable.

Definition at line 71 of file VarRowsVariable.cc.

References PLearn::BinaryVariable::input1.

Referenced by build(), and VarRowsVariable().

{
    if (input1)
        input1->allowPartialUpdates();
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 65 of file VarRowsVariable.h.

:
    void build_();
VarRowsVariable * PLearn::VarRowsVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file VarRowsVariable.cc.

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

compute output given input

Implements PLearn::Variable.

Definition at line 86 of file VarRowsVariable.cc.

References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLearn::Variable::matValue.

{
    matValue << input1->matValue.rows(input2->value);
}
OptionList & PLearn::VarRowsVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file VarRowsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file VarRowsVariable.cc.

void PLearn::VarRowsVariable::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 77 of file VarRowsVariable.cc.

References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Var::length(), and PLearn::Var::width().

{
    if (input1 && input2) {
        l = input2->length();
        w = input1->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:

void PLearn::VarRowsVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 103 of file VarRowsVariable.cc.

References PLERROR.

{
    PLERROR("VarRowsVariable::symbolicBprop() not implemented");
}

Member Data Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 65 of file VarRowsVariable.h.


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