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

#include <DuplicateColumnVariable.h>

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

List of all members.

Public Member Functions

 DuplicateColumnVariable ()
 Default constructor for persistence.
 DuplicateColumnVariable (Variable *input, int thewidth)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual DuplicateColumnVariabledeepCopy (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.
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_ ()
 DuplicateColumnVariable.
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 void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

void build_ ()
 Object-specific post-constructor.

Protected Attributes

int width_

Private Types

typedef UnaryVariable inherited

Detailed Description

Definition at line 52 of file DuplicateColumnVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file DuplicateColumnVariable.h.


Constructor & Destructor Documentation

PLearn::DuplicateColumnVariable::DuplicateColumnVariable ( ) [inline]

Default constructor for persistence.

Definition at line 62 of file DuplicateColumnVariable.h.

{}
PLearn::DuplicateColumnVariable::DuplicateColumnVariable ( Variable input,
int  thewidth 
)

Definition at line 57 of file DuplicateColumnVariable.cc.

References build_().

    : inherited(input, input->length(), thewidth), width_(thewidth)
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

DuplicateColumnVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 102 of file DuplicateColumnVariable.cc.

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

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

Here is the call graph for this function:

void PLearn::DuplicateColumnVariable::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 64 of file DuplicateColumnVariable.cc.

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

Here is the call graph for this function:

void PLearn::DuplicateColumnVariable::build_ ( ) [protected]

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 71 of file DuplicateColumnVariable.cc.

References PLearn::UnaryVariable::input, and PLERROR.

Referenced by build(), and DuplicateColumnVariable().

{
    if (input && !input->isColumnVec())
        PLERROR("In DuplicateColumnVariable input is not a column");
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

void PLearn::DuplicateColumnVariable::declareOptions ( OptionList ol) [static]

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::UnaryVariable.

Definition at line 78 of file DuplicateColumnVariable.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and width_.

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 65 of file DuplicateColumnVariable.h.

:
    void build_();
DuplicateColumnVariable * PLearn::DuplicateColumnVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 93 of file DuplicateColumnVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file DuplicateColumnVariable.cc.

void PLearn::DuplicateColumnVariable::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 84 of file DuplicateColumnVariable.cc.

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

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

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 111 of file DuplicateColumnVariable.cc.

References PLearn::Variable::g, PLearn::UnaryVariable::input, and PLearn::rowSum().

{
    input->accg(rowSum(g));
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 65 of file DuplicateColumnVariable.h.

Definition at line 57 of file DuplicateColumnVariable.h.

Referenced by declareOptions(), and recomputeSize().


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