Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::ConcatRowsSubVMatrix Class Reference

#include <ConcatRowsSubVMatrix.h>

Inheritance diagram for PLearn::ConcatRowsSubVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ConcatRowsSubVMatrix ()
 default constructor (for automatic deserialization)

 ConcatRowsSubVMatrix (VMat the_distr, TVec< int > &the_start, TVec< int > &the_len)
 The field names of the parent VMat are copied upon construction.

 ConcatRowsSubVMatrix (VMat the_distr, int start1, int len1, int start2, int len2)
 PLEARN_DECLARE_OBJECT (ConcatRowsSubVMatrix)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

virtual real get (int i, int j) const
 returns element (i,j)

virtual void getSubRow (int i, int j, Vec v) const
 fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive)

virtual void reset_dimensions ()
 in case the dimensions of an underlying vmat has changed, recompute it

virtual real dot (int i1, int i2, int inputsize) const
virtual real dot (int i, const Vec &v) const
 returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered).


Static Public Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Protected Member Functions

void check ()
 check ranges are compatible

void getpositions (int i, int &whichvm, int &rowofvm) const
 returns the index of the correct sub-VMat in the array and the the row number in this VMat that correspond to row i in the ConcatRowsVMat


Protected Attributes

VMat distr
TVec< intstart
TVec< intlen

Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Detailed Description

This class concatenates several (virtual) subVMatrices of the same underlying VMatrix. For each sub-vmatrix block, the user specifies the starting row and the number of rows in the underlying VMatrix. The resulting vmatrix sees first all the rows of the first sub-vmatrix, then all the rows of the 2nd, etc...

Definition at line 60 of file ConcatRowsSubVMatrix.h.


Member Typedef Documentation

typedef VMatrix PLearn::ConcatRowsSubVMatrix::inherited [private]
 

Reimplemented from PLearn::VMatrix.

Definition at line 62 of file ConcatRowsSubVMatrix.h.

Referenced by ConcatRowsSubVMatrix().


Constructor & Destructor Documentation

PLearn::ConcatRowsSubVMatrix::ConcatRowsSubVMatrix  ) 
 

default constructor (for automatic deserialization)

Definition at line 51 of file ConcatRowsSubVMatrix.cc.

PLearn::ConcatRowsSubVMatrix::ConcatRowsSubVMatrix VMat  the_distr,
TVec< int > &  the_start,
TVec< int > &  the_len
 

The field names of the parent VMat are copied upon construction.

Copy parent field names

Definition at line 55 of file ConcatRowsSubVMatrix.cc.

References build(), and inherited.

PLearn::ConcatRowsSubVMatrix::ConcatRowsSubVMatrix VMat  the_distr,
int  start1,
int  len1,
int  start2,
int  len2
 

Copy parent field names

Definition at line 67 of file ConcatRowsSubVMatrix.cc.

References build(), len, and start.


Member Function Documentation

void PLearn::ConcatRowsSubVMatrix::build  )  [virtual]
 

Should call simply inherited::build(), then this class's build_().

This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::VMatrix.

Definition at line 154 of file ConcatRowsSubVMatrix.cc.

References build_().

Referenced by ConcatRowsSubVMatrix().

void PLearn::ConcatRowsSubVMatrix::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 161 of file ConcatRowsSubVMatrix.cc.

References distr, len, PLearn::VMat::length(), PLearn::TVec< int >::length(), PLERROR, and start.

Referenced by build().

void PLearn::ConcatRowsSubVMatrix::check  )  [protected]
 

check ranges are compatible

void PLearn::ConcatRowsSubVMatrix::declareOptions OptionList ol  )  [static]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::VMatrix.

Definition at line 145 of file ConcatRowsSubVMatrix.cc.

References PLearn::declareOption(), and PLearn::OptionList.

real PLearn::ConcatRowsSubVMatrix::dot int  i,
const Vec v
const [virtual]
 

returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered).

Reimplemented from PLearn::VMatrix.

Definition at line 137 of file ConcatRowsSubVMatrix.cc.

References distr, getpositions(), and start.

real PLearn::ConcatRowsSubVMatrix::dot int  i1,
int  i2,
int  inputsize
const [virtual]
 

returns the dot product between row i1 and row i2 (considering only the inputsize first elements). The default version in VMatrix is somewhat inefficient, as it repeatedly calls get(i,j) The default version in RowBufferedVMatrix is a little better as it buffers the 2 Vecs between calls in case one of them is needed again. But the real strength of this method is for specialised and efficient versions in subbclasses. This method is typically used by SmartKernels so that they can compute kernel values between input samples efficiently.

Reimplemented from PLearn::VMatrix.

Definition at line 128 of file ConcatRowsSubVMatrix.cc.

References distr, getpositions(), and start.

real PLearn::ConcatRowsSubVMatrix::get int  i,
int  j
const [virtual]
 

returns element (i,j)

Reimplemented from PLearn::VMatrix.

Definition at line 114 of file ConcatRowsSubVMatrix.cc.

References distr, getpositions(), and start.

void PLearn::ConcatRowsSubVMatrix::getpositions int  i,
int whichvm,
int rowofvm
const [protected]
 

returns the index of the correct sub-VMat in the array and the the row number in this VMat that correspond to row i in the ConcatRowsVMat

Definition at line 95 of file ConcatRowsSubVMatrix.cc.

References k, len, PLearn::VMatrix::length(), and PLERROR.

Referenced by dot(), get(), and getSubRow().

void PLearn::ConcatRowsSubVMatrix::getSubRow int  i,
int  j,
Vec  v
const [virtual]
 

fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive)

Reimplemented from PLearn::VMatrix.

Definition at line 121 of file ConcatRowsSubVMatrix.cc.

References distr, getpositions(), PLearn::VMat::getSubRow(), start, and PLearn::Vec.

PLearn::ConcatRowsSubVMatrix::PLEARN_DECLARE_OBJECT ConcatRowsSubVMatrix   ) 
 

virtual void PLearn::ConcatRowsSubVMatrix::reset_dimensions  )  [inline, virtual]
 

in case the dimensions of an underlying vmat has changed, recompute it

Reimplemented from PLearn::VMatrix.

Definition at line 92 of file ConcatRowsSubVMatrix.h.

References distr, len, PLearn::TVec< int >::length(), and PLearn::VMat::width().


Member Data Documentation

VMat PLearn::ConcatRowsSubVMatrix::distr [protected]
 

Definition at line 65 of file ConcatRowsSubVMatrix.h.

Referenced by build_(), dot(), get(), getSubRow(), and reset_dimensions().

TVec<int> PLearn::ConcatRowsSubVMatrix::len [protected]
 

Definition at line 67 of file ConcatRowsSubVMatrix.h.

Referenced by build_(), ConcatRowsSubVMatrix(), getpositions(), and reset_dimensions().

TVec<int> PLearn::ConcatRowsSubVMatrix::start [protected]
 

Definition at line 66 of file ConcatRowsSubVMatrix.h.

Referenced by build_(), ConcatRowsSubVMatrix(), dot(), get(), and getSubRow().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:26:06 2004 for PLearn by doxygen 1.3.7