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

#include <PlusManyVariable.h>

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

List of all members.

Public Member Functions

 PlusManyVariable ()
 ### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
 PlusManyVariable (const VarArray &the_array, bool call_build_=true)
 Convenience 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 string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual PlusManyVariabledeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

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

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Private Types

typedef NaryVariable inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

* PlusManyVariable *

Definition at line 50 of file PlusManyVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::NaryVariable.

Definition at line 52 of file PlusManyVariable.h.


Constructor & Destructor Documentation

PLearn::PlusManyVariable::PlusManyVariable ( )

### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!

Default constructor.

Definition at line 56 of file PlusManyVariable.cc.

{}
PLearn::PlusManyVariable::PlusManyVariable ( const VarArray the_array,
bool  call_build_ = true 
)

Convenience constructor.

Definition at line 59 of file PlusManyVariable.cc.

References build_().

                                                    :
    inherited(the_array, the_array[0]->length(), the_array[0]->width(),
              call_build_)
{
    if (call_build_)
        build_();
}

Here is the call graph for this function:


Member Function Documentation

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

PlusManyVariable.

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

Implements PLearn::Variable.

Definition at line 97 of file PlusManyVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::TVec< T >::length(), n, PLearn::Variable::nelems(), and PLearn::NaryVariable::varray.

{
    int n = nelems();
    for (int i = 0; i < varray.length(); i++) {
        real* vi = varray[i]->gradientdata;
        for (int k=0; k<n; k++)
            vi[k] += gradientdata[k];
    }
}

Here is the call graph for this function:

void PLearn::PlusManyVariable::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::NaryVariable.

Definition at line 110 of file PlusManyVariable.cc.

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

Here is the call graph for this function:

void PLearn::PlusManyVariable::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::NaryVariable.

Definition at line 136 of file PlusManyVariable.cc.

References i, PLearn::Variable::length(), PLearn::TVec< T >::length(), PLERROR, PLearn::NaryVariable::varray, and w.

Referenced by build(), and PlusManyVariable().

{
    // Check sizes are coherent.
    if (varray.length() >= 2) {
        int l = varray[0]->length();
        int w = varray[1]->width();
        for (int i = 1; i < varray.length(); i++)
            if (varray[i]->length() != l || varray[i]->width() != w)
                PLERROR("In PlusManyVariable::build_ - All source variables "
                        "must have the same size");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 51 of file PlusManyVariable.cc.

void PLearn::PlusManyVariable::declareOptions ( OptionList ol) [static, protected]

Declares the class options.

Reimplemented from PLearn::NaryVariable.

Definition at line 127 of file PlusManyVariable.cc.

References PLearn::NaryVariable::declareOptions().

{
    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::NaryVariable.

Definition at line 79 of file PlusManyVariable.h.

:
    //#####  Protected Options  ###############################################
PlusManyVariable * PLearn::PlusManyVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::NaryVariable.

Definition at line 51 of file PlusManyVariable.cc.

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

compute output given input

Implements PLearn::Variable.

Definition at line 83 of file PlusManyVariable.cc.

References PLearn::Variable::fillValue(), i, PLearn::TVec< T >::length(), n, PLearn::Variable::nelems(), PLearn::Variable::valuedata, and PLearn::NaryVariable::varray.

{
    fillValue(0);
    int n = nelems();
    for (int i = 0; i < varray.length(); i++) {
        real* vi = varray[i]->valuedata;
        for (int k=0; k<n; k++)
            valuedata[k] += vi[k];
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file PlusManyVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 51 of file PlusManyVariable.cc.

void PLearn::PlusManyVariable::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::NaryVariable.

Definition at line 119 of file PlusManyVariable.cc.

References PLearn::NaryVariable::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

void PLearn::PlusManyVariable::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 71 of file PlusManyVariable.cc.

References PLearn::TVec< T >::length(), and PLearn::NaryVariable::varray.

{
    if (varray.length() > 0) {
        l = varray[0]->length();
        w = varray[0]->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::NaryVariable.

Definition at line 79 of file PlusManyVariable.h.


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