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

#include <NegateElementsVariable.h>

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

List of all members.

Public Member Functions

 NegateElementsVariable ()
 Default constructor.
 NegateElementsVariable (Variable *input, bool call_build_=true)
 Convenience constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual NegateElementsVariabledeepCopy (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 bbprop ()
 compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...
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_ ()
 NegateElementsVariable.
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 52 of file NegateElementsVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file NegateElementsVariable.h.


Constructor & Destructor Documentation

PLearn::NegateElementsVariable::NegateElementsVariable ( ) [inline]

Default constructor.

Definition at line 59 of file NegateElementsVariable.h.

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

Convenience constructor.

Definition at line 62 of file NegateElementsVariable.cc.

References build_().

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

Here is the call graph for this function:


Member Function Documentation

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

NegateElementsVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

void PLearn::NegateElementsVariable::bbprop ( ) [virtual]

compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...

d^2C/dx^2 = d^2C/dy^2 * (dy/dx)^2 + dC/dy * d^2y/dx^2 (diaghessian) (gradient)

Reimplemented from PLearn::Variable.

Definition at line 112 of file NegateElementsVariable.cc.

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

{
    if (input->diaghessian.length()==0)
        input->resizeDiagHessian();
    for(int k=0; k<nelems(); k++)
        input->diaghessiandata[k] -= diaghessiandata[k];
}

Here is the call graph for this function:

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 105 of file NegateElementsVariable.cc.

References PLearn::Variable::gradientdata, PLearn::UnaryVariable::input, and PLearn::Variable::nelems().

{
    for(int k=0; k<nelems(); k++)
        input->gradientdata[k] -= gradientdata[k];
}

Here is the call graph for this function:

void PLearn::NegateElementsVariable::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 74 of file NegateElementsVariable.cc.

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

Here is the call graph for this function:

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

Referenced by build(), and NegateElementsVariable().

{
    // Nothing to do here.
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file NegateElementsVariable.h.

:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 98 of file NegateElementsVariable.cc.

References PLearn::UnaryVariable::input, PLearn::Variable::nelems(), and PLearn::Variable::valuedata.

{
    for(int k=0; k<nelems(); k++)
        valuedata[k] = -input->valuedata[k];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file NegateElementsVariable.cc.

void PLearn::NegateElementsVariable::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 89 of file NegateElementsVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::Variable.

Definition at line 128 of file NegateElementsVariable.cc.

References PLearn::UnaryVariable::input, PLearn::TVec< T >::length(), PLearn::Variable::nelems(), PLearn::UnaryVariable::resizeRValue(), PLearn::Variable::rValue, and PLearn::Variable::rvaluedata.

{
    if (rValue.length()==0) resizeRValue();
    for(int k=0; k<nelems(); k++)
        rvaluedata[k] = -input->rvaluedata[k];
}

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 121 of file NegateElementsVariable.cc.

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

{
    input->accg(-g);
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file NegateElementsVariable.h.


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