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

PLearn::SubVMatrix Class Reference

#include <SubVMatrix.h>

Inheritance diagram for PLearn::SubVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SubVMatrix ()
 The appropriate VMFields of the parent VMat are copied upon construction.

 SubVMatrix (VMat the_parent, int the_istart, int the_jstart, int the_length, int the_width)
 SubVMatrix (VMat the_parent, real the_fistart, int the_jstart, real the_flength, int the_width)
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 getMat (int i, int j, Mat m) const
 copies the submatrix starting at i,j into m (which must have appropriate length and width)

virtual void put (int i, int j, real value)
 sets element (i,j) to value

virtual void putSubRow (int i, int j, Vec v)
virtual void putMat (int i, int j, Mat m)
 copies matrix m at position i,j of this VMat

virtual VMat subMat (int i, int j, int l, int w)
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).

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

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.

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


Public Attributes

VMat parent
 Build options.

int istart
int jstart
real fistart
real flength

Static Protected 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)


Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

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

Reimplemented from PLearn::VMatrix.

Definition at line 57 of file SubVMatrix.h.


Constructor & Destructor Documentation

PLearn::SubVMatrix::SubVMatrix  ) 
 

The appropriate VMFields of the parent VMat are copied upon construction.

Definition at line 54 of file SubVMatrix.cc.

PLearn::SubVMatrix::SubVMatrix VMat  the_parent,
int  the_istart,
int  the_jstart,
int  the_length,
int  the_width
 

Definition at line 61 of file SubVMatrix.cc.

References build_().

PLearn::SubVMatrix::SubVMatrix VMat  the_parent,
real  the_fistart,
int  the_jstart,
real  the_flength,
int  the_width
 

Definition at line 68 of file SubVMatrix.cc.

References build_().


Member Function Documentation

void PLearn::SubVMatrix::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 91 of file SubVMatrix.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 97 of file SubVMatrix.cc.

References fistart, flength, istart, jstart, PLearn::VMatrix::length(), PLearn::VMat::length(), parent, PLERROR, PLearn::TVec< map< string, real > >::resize(), PLearn::TVec< map< real, string > >::resize(), PLearn::TVec< VMField >::resize(), PLearn::VMatrix::width(), and PLearn::VMat::width().

Referenced by build(), and SubVMatrix().

void PLearn::SubVMatrix::declareOptions OptionList ol  )  [static, protected]
 

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 79 of file SubVMatrix.cc.

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

real PLearn::SubVMatrix::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 222 of file SubVMatrix.cc.

References istart, jstart, and parent.

real PLearn::SubVMatrix::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 214 of file SubVMatrix.cc.

References istart, jstart, and parent.

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

returns element (i,j)

Reimplemented from PLearn::VMatrix.

Definition at line 154 of file SubVMatrix.cc.

References istart, jstart, PLearn::VMatrix::length(), parent, PLERROR, and PLearn::VMatrix::width().

void PLearn::SubVMatrix::getMat int  i,
int  j,
Mat  m
const [virtual]
 

copies the submatrix starting at i,j into m (which must have appropriate length and width)

Reimplemented from PLearn::VMatrix.

Definition at line 171 of file SubVMatrix.cc.

References istart, jstart, PLearn::VMatrix::length(), PLearn::TMat< T >::length(), PLearn::Mat, parent, PLERROR, PLearn::VMatrix::width(), and PLearn::TMat< T >::width().

void PLearn::SubVMatrix::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 162 of file SubVMatrix.cc.

References PLearn::VMat::getSubRow(), istart, jstart, PLearn::TVec< T >::length(), PLearn::VMatrix::length(), parent, PLERROR, PLearn::Vec, and PLearn::VMatrix::width().

void PLearn::SubVMatrix::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::VMatrix.

Definition at line 233 of file SubVMatrix.cc.

References PLearn::deepCopyField(), and parent.

PLearn::SubVMatrix::PLEARN_DECLARE_OBJECT SubVMatrix   ) 
 

void PLearn::SubVMatrix::put int  i,
int  j,
real  value
[virtual]
 

sets element (i,j) to value

Reimplemented from PLearn::VMatrix.

Definition at line 180 of file SubVMatrix.cc.

References istart, jstart, PLearn::VMatrix::length(), parent, PLERROR, and PLearn::VMatrix::width().

void PLearn::SubVMatrix::putMat int  i,
int  j,
Mat  m
[virtual]
 

copies matrix m at position i,j of this VMat

Reimplemented from PLearn::VMatrix.

Definition at line 197 of file SubVMatrix.cc.

References istart, jstart, PLearn::VMatrix::length(), PLearn::TMat< T >::length(), parent, PLERROR, PLearn::VMatrix::width(), and PLearn::TMat< T >::width().

void PLearn::SubVMatrix::putSubRow int  i,
int  j,
Vec  v
[virtual]
 

It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead)

Reimplemented from PLearn::VMatrix.

Definition at line 188 of file SubVMatrix.cc.

References istart, jstart, PLearn::VMatrix::length(), parent, PLERROR, and PLearn::VMatrix::width().

void PLearn::SubVMatrix::reset_dimensions  )  [virtual]
 

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

Reimplemented from PLearn::VMatrix.

Definition at line 145 of file SubVMatrix.cc.

References PLearn::VMat::length(), parent, and PLearn::VMat::width().

VMat PLearn::SubVMatrix::subMat int  i,
int  j,
int  l,
int  w
[virtual]
 

default version returns a SubVMatrix referencing the current VMatrix however this can be overridden to provide more efficient shortcuts (see MemoryVMatrix::subMat and SubVMatrix::subMat for examples)

Reimplemented from PLearn::VMatrix.

Definition at line 206 of file SubVMatrix.cc.

References istart, jstart, parent, and PLearn::VMat::subMat().


Member Data Documentation

real PLearn::SubVMatrix::fistart
 

Definition at line 65 of file SubVMatrix.h.

Referenced by build_().

real PLearn::SubVMatrix::flength
 

Definition at line 66 of file SubVMatrix.h.

Referenced by build_().

int PLearn::SubVMatrix::istart
 

Definition at line 63 of file SubVMatrix.h.

Referenced by build_(), dot(), get(), getMat(), getSubRow(), put(), putMat(), putSubRow(), and subMat().

int PLearn::SubVMatrix::jstart
 

Definition at line 64 of file SubVMatrix.h.

Referenced by build_(), dot(), get(), getMat(), getSubRow(), put(), putMat(), putSubRow(), and subMat().

VMat PLearn::SubVMatrix::parent
 

Build options.

Definition at line 62 of file SubVMatrix.h.

Referenced by build_(), dot(), get(), getMat(), getSubRow(), makeDeepCopyFromShallowCopy(), put(), putMat(), putSubRow(), reset_dimensions(), and subMat().


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