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

#include <SquareRootVariable.h>

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

List of all members.

Public Member Functions

 SquareRootVariable ()
 Default constructor for persistence.
 SquareRootVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual SquareRootVariabledeepCopy (CopiesMap &copies) const
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_ ()
 SquareRootVariable.
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

Detailed Description

Definition at line 53 of file SquareRootVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file SquareRootVariable.h.


Constructor & Destructor Documentation

PLearn::SquareRootVariable::SquareRootVariable ( ) [inline]

Default constructor for persistence.

Definition at line 59 of file SquareRootVariable.h.

{}
PLearn::SquareRootVariable::SquareRootVariable ( Variable input)

Definition at line 56 of file SquareRootVariable.cc.

    : inherited(input, input->length(), input->width())
{}

Member Function Documentation

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

SquareRootVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 78 of file SquareRootVariable.cc.

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

{
    if (rValue.length()==0) resizeRValue();
    int n=nelems();
    for(int i=0; i<n; i++)
    {
        input->gradientdata[i] += 0.5/sqrt(input->valuedata[i]) * gradientdata[i];
        rvaluedata[i] = 2*input->valuedata[i]*input->rvaluedata[i];
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file SquareRootVariable.h.

{ return new SquareRootVariable(v);}
SquareRootVariable * PLearn::SquareRootVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 69 of file SquareRootVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file SquareRootVariable.cc.

void PLearn::SquareRootVariable::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 60 of file SquareRootVariable.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:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file SquareRootVariable.h.


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