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

#include <VarColumnsVariable.h>

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

List of all members.

Public Member Functions

 VarColumnsVariable ()
 Default constructor for persistence.
 VarColumnsVariable (Variable *input1, Variable *input2)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual VarColumnsVariabledeepCopy (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 ()
 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_ ()
 VarColumnsVariable.
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 BinaryVariable inherited

Detailed Description

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

Definition at line 56 of file VarColumnsVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 58 of file VarColumnsVariable.h.


Constructor & Destructor Documentation

PLearn::VarColumnsVariable::VarColumnsVariable ( ) [inline]

Default constructor for persistence.

Definition at line 62 of file VarColumnsVariable.h.

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

Definition at line 53 of file VarColumnsVariable.cc.

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

Member Function Documentation

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

VarColumnsVariable.

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

Implements PLearn::Variable.

Definition at line 76 of file VarColumnsVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 65 of file VarColumnsVariable.h.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 51 of file VarColumnsVariable.cc.

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

compute output given input

Implements PLearn::Variable.

Definition at line 70 of file VarColumnsVariable.cc.

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

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

Reimplemented from PLearn::Object.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file VarColumnsVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file VarColumnsVariable.cc.

void PLearn::VarColumnsVariable::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 60 of file VarColumnsVariable.cc.

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

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

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 83 of file VarColumnsVariable.cc.

References PLERROR.

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

Member Data Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 65 of file VarColumnsVariable.h.


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