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

multiplies a matrix var by a scalar var More...

#include <TimesConstantScalarVariable2.h>

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

List of all members.

Public Member Functions

 TimesConstantScalarVariable2 ()
 Default constructor for persistence.
 TimesConstantScalarVariable2 (Variable *input1, Variable *input2)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual
TimesConstantScalarVariable2
deepCopy (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 ()
 compute output given input
virtual void bprop ()
virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var
virtual void rfprop ()

Static Public Member Functions

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

Protected Member Functions

void build_ ()
 This does the actual building.

Private Types

typedef BinaryVariable inherited

Detailed Description

multiplies a matrix var by a scalar var

Definition at line 51 of file TimesConstantScalarVariable2.h.


Member Typedef Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.h.


Constructor & Destructor Documentation

PLearn::TimesConstantScalarVariable2::TimesConstantScalarVariable2 ( ) [inline]

Default constructor for persistence.

Definition at line 57 of file TimesConstantScalarVariable2.h.

{}
PLearn::TimesConstantScalarVariable2::TimesConstantScalarVariable2 ( Variable input1,
Variable input2 
)

Definition at line 55 of file TimesConstantScalarVariable2.cc.

References build_().

    : inherited(input1, input2, input1->length(), input1->width())
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

string PLearn::TimesConstantScalarVariable2::_classname_ ( ) [static]
OptionList & PLearn::TimesConstantScalarVariable2::_getOptionList_ ( ) [static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Implements PLearn::Variable.

Definition at line 92 of file TimesConstantScalarVariable2.cc.

References PLearn::Variable::gradientdata, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLearn::Variable::nelems().

{
    real scal = input2->valuedata[0];
    for(int k=0; k<nelems(); k++)
        input1->gradientdata[k] += scal*gradientdata[k];
}

Here is the call graph for this function:

void PLearn::TimesConstantScalarVariable2::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::BinaryVariable.

Definition at line 62 of file TimesConstantScalarVariable2.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::BinaryVariable.

Definition at line 69 of file TimesConstantScalarVariable2.cc.

References PLearn::BinaryVariable::input2, and PLERROR.

Referenced by build(), and TimesConstantScalarVariable2().

{
    if (input2 && !input2->isScalar())
        PLERROR("IN TimesConstantScalarVariable2: input2 is not a scalar");
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 60 of file TimesConstantScalarVariable2.h.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

compute output given input

Implements PLearn::Variable.

Definition at line 84 of file TimesConstantScalarVariable2.cc.

References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Variable::nelems(), and PLearn::Variable::valuedata.

{
    real scal = input2->valuedata[0];
    for(int k=0; k<nelems(); k++)
        valuedata[k] = input1->valuedata[k] * scal;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file TimesConstantScalarVariable2.cc.

void PLearn::TimesConstantScalarVariable2::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 75 of file TimesConstantScalarVariable2.cc.

References PLearn::BinaryVariable::input1, PLearn::Var::length(), and PLearn::Var::width().

{
    if (input1) {
        l = input1->length();
        w = input1->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:

void PLearn::TimesConstantScalarVariable2::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 107 of file TimesConstantScalarVariable2.cc.

References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::TVec< T >::length(), PLearn::Variable::nelems(), PLearn::BinaryVariable::resizeRValue(), PLearn::Variable::rValue, and PLearn::Variable::rvaluedata.

{
    if (rValue.length()==0) resizeRValue();
    real scal = input2->valuedata[0];
    real rscal = input2->rvaluedata[0];
    for(int k=0; k<nelems(); k++)
        rvaluedata[k] = input1->rvaluedata[k] * scal + input1->valuedata[k] * rscal;
}

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 100 of file TimesConstantScalarVariable2.cc.

References PLearn::Variable::g, PLearn::BinaryVariable::input1, and PLearn::BinaryVariable::input2.

{
    input1->accg(g*input2);
}

Member Data Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 60 of file TimesConstantScalarVariable2.h.


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