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

#include <RowSumSquareVariable.h>

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

List of all members.

Public Member Functions

 RowSumSquareVariable ()
 Default constructor.
 RowSumSquareVariable (Variable *input, bool call_build_=true)
 Convenience constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual RowSumSquareVariabledeepCopy (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.

Static Public Member Functions

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

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Detailed Description

Definition at line 50 of file RowSumSquareVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 52 of file RowSumSquareVariable.h.


Constructor & Destructor Documentation

PLearn::RowSumSquareVariable::RowSumSquareVariable ( ) [inline]

Default constructor.

Definition at line 56 of file RowSumSquareVariable.h.

{}
PLearn::RowSumSquareVariable::RowSumSquareVariable ( Variable input,
bool  call_build_ = true 
)

Convenience constructor.

Definition at line 58 of file RowSumSquareVariable.cc.

References build_().

                                                                           :
    inherited(input, input->length(), 1, call_build_)
{
    if (call_build_)
        build_();
}

Here is the call graph for this function:


Member Function Documentation

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

RowSumSquareVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 103 of file RowSumSquareVariable.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] += 2* gradientdata[i] * input->valuedata[k];
}

Here is the call graph for this function:

void PLearn::RowSumSquareVariable::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 68 of file RowSumSquareVariable.cc.

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

Here is the call graph for this function:

void PLearn::RowSumSquareVariable::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 76 of file RowSumSquareVariable.cc.

Referenced by build(), and RowSumSquareVariable().

                                  {
    // Nothing to do here.
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file RowSumSquareVariable.h.

:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 92 of file RowSumSquareVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file RowSumSquareVariable.cc.

void PLearn::RowSumSquareVariable::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 83 of file RowSumSquareVariable.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:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file RowSumSquareVariable.h.


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