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

A scalar var; equal 1 if input1!=c, 0 otherwise. More...

#include <UnequalConstantVariable.h>

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

List of all members.

Public Member Functions

 UnequalConstantVariable ()
 Default constructor for persistence.
 UnequalConstantVariable (Variable *input1, real c)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual UnequalConstantVariabledeepCopy (CopiesMap &copies) const
virtual string info () const
 Returns a bit more informative string about object (default returns classname())
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_ ()
 UnequalConstantVariable.
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 void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

real c

Private Types

typedef UnaryVariable inherited

Detailed Description

A scalar var; equal 1 if input1!=c, 0 otherwise.

Definition at line 54 of file UnequalConstantVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file UnequalConstantVariable.h.


Constructor & Destructor Documentation

PLearn::UnequalConstantVariable::UnequalConstantVariable ( ) [inline]

Default constructor for persistence.

Definition at line 63 of file UnequalConstantVariable.h.

: c() {}
PLearn::UnequalConstantVariable::UnequalConstantVariable ( Variable input1,
real  c 
)

Definition at line 55 of file UnequalConstantVariable.cc.

    : inherited(input1, input1->length(), input1->width()), c(c_)
{}

Member Function Documentation

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

UnequalConstantVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 83 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

void PLearn::UnequalConstantVariable::declareOptions ( OptionList ol) [static]

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::UnaryVariable.

Definition at line 60 of file UnequalConstantVariable.cc.

References PLearn::OptionBase::buildoption, c, PLearn::declareOption(), and PLearn::UnaryVariable::declareOptions().

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 66 of file UnequalConstantVariable.h.

{ return string("EqualConstantVariable (!= ")+tostring(c)+")"; }
UnequalConstantVariable * PLearn::UnequalConstantVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 75 of file UnequalConstantVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file UnequalConstantVariable.cc.

virtual string PLearn::UnequalConstantVariable::info ( ) const [inline, virtual]

Returns a bit more informative string about object (default returns classname())

Returns:
Information about the object

Reimplemented from PLearn::Object.

Definition at line 69 of file UnequalConstantVariable.h.

References c, and PLearn::tostring().

    { return string("EqualConstantVariable (!= ")+tostring(c)+")"; }

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 85 of file UnequalConstantVariable.cc.

{}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 66 of file UnequalConstantVariable.h.

Definition at line 59 of file UnequalConstantVariable.h.

Referenced by declareOptions(), and fprop().


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