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

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

#include <RowSumVariable.h>

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

List of all members.

Public Member Functions

 RowSumVariable ()
 Default constructor for persistence.
 RowSumVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual RowSumVariabledeepCopy (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_ ()
 RowSumVariable.
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 column that contains the sum of each row of the input

Definition at line 53 of file RowSumVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file RowSumVariable.h.


Constructor & Destructor Documentation

PLearn::RowSumVariable::RowSumVariable ( ) [inline]

Default constructor for persistence.

Definition at line 59 of file RowSumVariable.h.

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

Definition at line 55 of file RowSumVariable.cc.

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

Member Function Documentation

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

RowSumVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 78 of file RowSumVariable.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[i];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file RowSumVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 68 of file RowSumVariable.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[i] += input->valuedata[k];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumVariable.cc.

void PLearn::RowSumVariable::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 59 of file RowSumVariable.cc.

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

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

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 87 of file RowSumVariable.cc.

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

{
    input->accg(g);
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file RowSumVariable.h.


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