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

#include <TransposeVariable.h>

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

List of all members.

Public Member Functions

 TransposeVariable ()
 Default constructor for persistence.
 TransposeVariable (Variable *v)
 TransposeVariable.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual TransposeVariabledeepCopy (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
virtual void rfprop ()

Static Public Member Functions

static string _classname_ ()
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_

Protected Attributes

int startk

Private Types

typedef UnaryVariable inherited

Detailed Description

Definition at line 11 of file TransposeVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 14 of file TransposeVariable.h.


Constructor & Destructor Documentation

PLearn::TransposeVariable::TransposeVariable ( ) [inline]

Default constructor for persistence.

Definition at line 19 of file TransposeVariable.h.

: startk(0) {}
PLearn::TransposeVariable::TransposeVariable ( Variable v)

TransposeVariable.

Definition at line 11 of file TransposeVariable.cc.

    :UnaryVariable(v, v->width(), v->length()), startk(0)
{}

Member Function Documentation

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 51 of file TransposeVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, j, PLearn::Var::length(), PLearn::Variable::length(), PLearn::Variable::nelems(), PLearn::Variable::width(), and PLearn::Var::width().

{
    if(input->length()==1 || input->width()==1) 
    {
        real* inputdata = input->gradientdata;
        for(int k=0; k<nelems(); k++)
            inputdata[k] += gradientdata[k];
    }
    else // general case
    {
        real* inputrowdata = input->gradientdata;
        int thiskcolstart = 0; // element index of start of column in this var
        for(int i=0; i<width(); i++) // the width() of this var is the length() of the submat
        {
            int thisk = thiskcolstart++;
            for(int j=0; j<length(); j++, thisk+=width()) // the length() of this var is the width() of the submat
                *inputrowdata++ += gradientdata[thisk];
        }
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 26 of file TransposeVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 29 of file TransposeVariable.cc.

References i, PLearn::UnaryVariable::input, j, PLearn::Var::length(), PLearn::Variable::length(), PLearn::Variable::nelems(), PLearn::Variable::valuedata, PLearn::Variable::width(), and PLearn::Var::width().

{
    if(input->length()==1 || input->width()==1) 
    {
        real* inputdata = input->valuedata;
        for(int k=0; k<nelems(); k++)
            valuedata[k] = inputdata[k];
    }
    else // general case
    {
        real* inputrowdata = input->valuedata;
        int thiskcolstart = 0; // element index of start of column in this var
        for(int i=0; i<width(); i++) // the width() of this var is the length() of the submat
        {
            int thisk = thiskcolstart++;
            for(int j=0; j<length(); j++, thisk+=width()) // the length() of this var is the width() of the submat
                valuedata[thisk] = *inputrowdata++;
        }
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 16 of file TransposeVariable.cc.

void PLearn::TransposeVariable::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 19 of file TransposeVariable.cc.

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

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

Here is the call graph for this function:

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

Reimplemented from PLearn::Variable.

Definition at line 88 of file TransposeVariable.cc.

References PLERROR.

{
    PLERROR("Not implemented yet!");
    /*
      if (rValue.length()==0) resizeRValue();
      if(input->length()==1 || input->width()==1) // optimized version for this special case...
      {
      real* inputdata = input->rvaluedata+startk;
      for(int k=0; k<nelems(); k++)
      rvaluedata[k] = inputdata[k];
      }
      else // general case
      {
      real* inputrowdata = input->rvaluedata+startk;
      int thiskcolstart = 0; // element index of start of column in this var
      for(int i=0; i<width(); i++) // the width() of this var is the length() of the submat
      {
      int thisk = thiskcolstart++;
      for(int j=0; j<length(); j++, thisk+=width()) // the length() of this var is the width() of the submat
      rvaluedata[thisk] = inputrowdata[j];
      inputrowdata += input->width();
      }
      }
    */
}
void PLearn::TransposeVariable::symbolicBprop ( ) [virtual]

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

Reimplemented from PLearn::Variable.

Definition at line 73 of file TransposeVariable.cc.

References PLERROR.

{
    PLERROR("Not implemented yet!");
    /*
      int i = startk/input->width();
      int j = startk%input->width();
      int topextent = i;
      int bottomextent = input->length()-(i+width()); // the width() of this var is the length() of the submat
      int leftextent = j;
      int rightextent = input->width()-(j+length()); // the length() of this var is the width() of the submat
      input->accg(extend(transpose(g),topextent,bottomextent,leftextent,rightextent));
    */
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 26 of file TransposeVariable.h.

Definition at line 22 of file TransposeVariable.h.


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