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

#include <ErfVariable.h>

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

List of all members.

Public Member Functions

 ErfVariable ()
 Default constructor for persistence.
 ErfVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ErfVariabledeepCopy (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.
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_ ()
 ErfVariable.
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 52 of file ErfVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file ErfVariable.h.


Constructor & Destructor Documentation

PLearn::ErfVariable::ErfVariable ( ) [inline]

Default constructor for persistence.

Definition at line 58 of file ErfVariable.h.

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

Definition at line 59 of file ErfVariable.cc.

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

Member Function Documentation

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

ErfVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 79 of file ErfVariable.cc.

References PLearn::exp(), PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), Pi, and PLearn::sqrt().

{
    real cst = 2.0/sqrt(Pi);
    for(int i=0; i<nelems(); i++)
        input->gradientdata[i] += gradientdata[i] * cst*exp(input->valuedata[i]*input->valuedata[i]);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file ErfVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 72 of file ErfVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file ErfVariable.cc.

void PLearn::ErfVariable::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 63 of file ErfVariable.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::ErfVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 87 of file ErfVariable.cc.

References PLearn::exp(), PLearn::Variable::g, PLearn::UnaryVariable::input, Pi, PLearn::sqrt(), and PLearn::square().

{
    Var v(this);
    input->accg(g * 2.0/sqrt(Pi)*exp(square(input)));
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 61 of file ErfVariable.h.


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