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

result is a single row that contains the sum of each column of the input More...

#include <ColumnSumVariable.h>

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

List of all members.

Public Member Functions

 ColumnSumVariable ()
 Default constructor for persistence.
 ColumnSumVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ColumnSumVariabledeepCopy (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 ()
 Nothing to do by default.
virtual void bprop ()
 Nothing to do by default.
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_ ()
 ColumnSumVariable.
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

Detailed Description

result is a single row that contains the sum of each column of the input

Definition at line 53 of file ColumnSumVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 58 of file ColumnSumVariable.h.


Constructor & Destructor Documentation

PLearn::ColumnSumVariable::ColumnSumVariable ( ) [inline]

Default constructor for persistence.

Definition at line 63 of file ColumnSumVariable.h.

{}
PLearn::ColumnSumVariable::ColumnSumVariable ( Variable input)

Definition at line 60 of file ColumnSumVariable.cc.

                                                   :
    inherited(input, 1, input->width())
{}

Member Function Documentation

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

ColumnSumVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 88 of file ColumnSumVariable.cc.

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

{
    int k=0;
    for(int i=0; i<input->length(); i++)
        for(int j=0; j<input->width(); j++, k++)
            input->gradientdata[k] += gradientdata[j];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 67 of file ColumnSumVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 76 of file ColumnSumVariable.cc.

References PLearn::TVec< T >::clear(), i, PLearn::UnaryVariable::input, j, PLearn::Var::length(), PLearn::Variable::value, PLearn::Variable::valuedata, and PLearn::Var::width().

{
    value.clear();
    int k=0;
    for(int i=0; i<input->length(); i++)
        for(int j=0; j<input->width(); j++, k++)
            valuedata[j] += input->valuedata[k];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file ColumnSumVariable.cc.

void PLearn::ColumnSumVariable::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 67 of file ColumnSumVariable.cc.

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

{
    l = 1;
    w = input->width();
}

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 99 of file ColumnSumVariable.cc.

References PLearn::Variable::g, and PLearn::UnaryVariable::input.

{
    input->accg(g);
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 67 of file ColumnSumVariable.h.


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