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

sign(x) = 1 if x>0, -1 if x<0, 0 if x=0, all done element by element. More...

#include <SignVariable.h>

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

List of all members.

Public Member Functions

 SignVariable ()
 Default constructor for persistence.
 SignVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual SignVariabledeepCopy (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_ ()
 SignVariable.
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

sign(x) = 1 if x>0, -1 if x<0, 0 if x=0, all done element by element.

Definition at line 53 of file SignVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file SignVariable.h.


Constructor & Destructor Documentation

PLearn::SignVariable::SignVariable ( ) [inline]

Default constructor for persistence.

Definition at line 59 of file SignVariable.h.

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

Definition at line 55 of file SignVariable.cc.

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

Member Function Documentation

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

SignVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 76 of file SignVariable.cc.

{}
string PLearn::SignVariable::classname ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file SignVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 68 of file SignVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file SignVariable.cc.

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

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

Reimplemented from PLearn::Variable.

Definition at line 81 of file SignVariable.cc.

{}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 62 of file SignVariable.h.


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