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

#include <CrossReferenceVMatrix.h>

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

List of all members.

Public Member Functions

 CrossReferenceVMatrix ()
 default constructor (for automatic deserialization)
 CrossReferenceVMatrix (VMat the_master, int the_index, VMat the_slave)
 The column headings are simply the concatenation of the headings in the two vmatrices.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual CrossReferenceVMatrixdeepCopy (CopiesMap &copies) const
virtual void build ()
 Simply calls inherited::build() then build_().
virtual void getRow (int i, Vec samplevec) const
 These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)
virtual real get (int i, int j) const
 This method must be implemented in all subclasses.
virtual void reset_dimensions ()
 In case the dimensions of an underlying VMat has changed, recompute it.

Static Public Member Functions

static string _classname_ ()
 CrossReferenceVMatrix.
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 this class' options.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

VMat master
int index
VMat slave

Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

This VMat is a concatenation of 2 VMat, a 'master' and a 'slave'. The row of the 'slave' corresponding to the index set by 'index' of 'master', is merged with 'master'.

for i=1,master.length() this->row(i) <- [ master.row(i), slave.row(slave(i,index)) ]

Definition at line 61 of file CrossReferenceVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 63 of file CrossReferenceVMatrix.h.


Constructor & Destructor Documentation

PLearn::CrossReferenceVMatrix::CrossReferenceVMatrix ( )

default constructor (for automatic deserialization)

Definition at line 51 of file CrossReferenceVMatrix.cc.

    : index(0)
{
}
PLearn::CrossReferenceVMatrix::CrossReferenceVMatrix ( VMat  the_master,
int  the_index,
VMat  the_slave 
)

The column headings are simply the concatenation of the headings in the two vmatrices.

Definition at line 56 of file CrossReferenceVMatrix.cc.

References build().

    : inherited(the_master.length(), the_master.width()+the_slave.width()-1),
      master(the_master),
      index(the_index),
      slave(the_slave)
{
    //fieldinfos = the_master->getFieldInfos();
    // fieldinfos &= the_slave->getFieldInfos();
    build();
}

Here is the call graph for this function:


Member Function Documentation

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

CrossReferenceVMatrix.

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

void PLearn::CrossReferenceVMatrix::build ( ) [virtual]

Simply calls inherited::build() then build_().

Reimplemented from PLearn::VMatrix.

Definition at line 86 of file CrossReferenceVMatrix.cc.

References PLearn::VMatrix::build(), and build_().

Referenced by CrossReferenceVMatrix().

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::CrossReferenceVMatrix::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 93 of file CrossReferenceVMatrix.cc.

References PLearn::VMatrix::fieldinfos, master, slave, and PLearn::VMatrix::updateMtime().

Referenced by build().

{
    if (master && slave) {
        fieldinfos = master->getFieldInfos();
        fieldinfos &= slave->getFieldInfos();
        updateMtime(master);
        updateMtime(slave);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 49 of file CrossReferenceVMatrix.cc.

void PLearn::CrossReferenceVMatrix::declareOptions ( OptionList ol) [static]
static const PPath& PLearn::CrossReferenceVMatrix::declaringFile ( ) [inline, static]

Reimplemented from PLearn::VMatrix.

Definition at line 82 of file CrossReferenceVMatrix.h.

{ PLERROR("CrossReferenceVMatrix::reset_dimensions() not implemented"); }
CrossReferenceVMatrix * PLearn::CrossReferenceVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::VMatrix.

Definition at line 49 of file CrossReferenceVMatrix.cc.

real PLearn::CrossReferenceVMatrix::get ( int  i,
int  j 
) const [virtual]

This method must be implemented in all subclasses.

Returns element (i,j).

Implements PLearn::VMatrix.

Definition at line 121 of file CrossReferenceVMatrix.cc.

References index, PLearn::VMatrix::length(), master, PLERROR, slave, PLearn::VMat::width(), and PLearn::VMatrix::width().

{
#ifdef BOUNDCHECK
    if(i<0 || i>=length() || j<0 || j>=width())
        PLERROR("In CrossReferenceVMatrix::get OUT OF BOUNDS");
#endif

    if (j < index)
        return master->get(i,j);
    else if (j < master.width()-1)
        return master->get(i,j+1);
    else {
        int ii = (int)master->get(i,index);
        int jj = j - master.width() + 1;
        return slave->get(ii,jj);
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 49 of file CrossReferenceVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 49 of file CrossReferenceVMatrix.cc.

void PLearn::CrossReferenceVMatrix::getRow ( int  i,
Vec  v 
) const [virtual]

These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)

Copies row i into v (which must have appropriate length equal to the VMat's width).

Reimplemented from PLearn::VMatrix.

Definition at line 103 of file CrossReferenceVMatrix.cc.

References index, j, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), master, PLERROR, slave, PLearn::VMat::width(), and PLearn::VMatrix::width().

{
#ifdef BOUNDCHECK
    if (i<0 || i>=length() || samplevec.length()!=width())
        PLERROR("In CrossReferenceVMatrix::getRow OUT OF BOUNDS");
#endif

    Vec v1(master.width());
    Vec v2(slave.width());
    master->getRow(i, v1);
    int index = (int)v1[index];
    slave->getRow(index, v2);

    for (int j=0; j<index; j++) samplevec[j] = v1[j];
    for (int j=index+1; j<v1.length(); j++) samplevec[j-1] = v1[j];
    for (int j=0; j<v2.length(); j++) samplevec[j+v1.length()-1] = v2[j];
}

Here is the call graph for this function:

virtual void PLearn::CrossReferenceVMatrix::reset_dimensions ( ) [inline, virtual]

In case the dimensions of an underlying VMat has changed, recompute it.

Reimplemented from PLearn::VMatrix.

Definition at line 89 of file CrossReferenceVMatrix.h.

References PLERROR.

{ PLERROR("CrossReferenceVMatrix::reset_dimensions() not implemented"); }

Member Data Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 82 of file CrossReferenceVMatrix.h.

Definition at line 67 of file CrossReferenceVMatrix.h.

Referenced by declareOptions(), get(), and getRow().

Definition at line 66 of file CrossReferenceVMatrix.h.

Referenced by build_(), declareOptions(), get(), and getRow().

Definition at line 68 of file CrossReferenceVMatrix.h.

Referenced by build_(), declareOptions(), get(), and getRow().


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