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

PLearn::SelectRowsVMatrix Class Reference

selects samples from a source matrix according to given vector of indices More...

#include <SelectRowsVMatrix.h>

Inheritance diagram for PLearn::SelectRowsVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SelectRowsVMatrix ()
 SelectRowsVMatrix (VMat the_source, TVec< int > the_indices)
 Also copies the original fieldinfos upon construction Here the indices will be shared for efficiency.

 SelectRowsVMatrix (VMat the_source, Vec the_indices)
 Here the indices will be copied locally into an integer vector.

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

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

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 laying between columns j (inclusive) and j+v.length() (exclusive)

virtual real getStringVal (int col, const string &str) const
 returns value associated with a string (or MISSING_VALUE if there's no association for this string)

virtual string getValString (int col, real val) const
 returns the string associated with value val for field# col.

virtual string getString (int row, int col) const
 returns element as a string, even if value doesn't map to a string, in which case tostring(value) is returned

virtual const map< string,
real > & 
getStringToRealMapping (int col) const
 returns the whole string->value mapping

virtual const map< real, string > & getRealToStringMapping (int col) const
 returns the value->string mapping for field 'fld'

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)
 Declares this class' options.


Public Attributes

TVec< intindices
 Public build options.


Protected Member Functions

void getNewRow (int i, const Vec &v) const
 Must be implemented in subclasses: default version returns an error.


Private Types

typedef SourceVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Detailed Description

selects samples from a source matrix according to given vector of indices

Definition at line 55 of file SelectRowsVMatrix.h.


Member Typedef Documentation

typedef SourceVMatrix PLearn::SelectRowsVMatrix::inherited [private]
 

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::BootstrapVMatrix, PLearn::RemoveDuplicateVMatrix, and PLearn::SortRowsVMatrix.

Definition at line 60 of file SelectRowsVMatrix.h.


Constructor & Destructor Documentation

PLearn::SelectRowsVMatrix::SelectRowsVMatrix  ) 
 

Definition at line 54 of file SelectRowsVMatrix.cc.

PLearn::SelectRowsVMatrix::SelectRowsVMatrix VMat  the_source,
TVec< int the_indices
 

Also copies the original fieldinfos upon construction Here the indices will be shared for efficiency.

But you should not modify them afterwards!

Definition at line 58 of file SelectRowsVMatrix.cc.

References build_().

PLearn::SelectRowsVMatrix::SelectRowsVMatrix VMat  the_source,
Vec  the_indices
 

Here the indices will be copied locally into an integer vector.

Definition at line 66 of file SelectRowsVMatrix.cc.

References build_(), indices, PLearn::TVec< T >::length(), PLearn::TVec< int >::resize(), and PLearn::Vec.


Member Function Documentation

void PLearn::SelectRowsVMatrix::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::SourceVMatrix.

Reimplemented in PLearn::BootstrapVMatrix, PLearn::RemoveDuplicateVMatrix, and PLearn::SortRowsVMatrix.

Definition at line 117 of file SelectRowsVMatrix.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::BootstrapVMatrix, PLearn::RemoveDuplicateVMatrix, and PLearn::SortRowsVMatrix.

Definition at line 126 of file SelectRowsVMatrix.cc.

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

Referenced by build(), and SelectRowsVMatrix().

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

Declares this class' options.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::BootstrapVMatrix, PLearn::RemoveDuplicateVMatrix, and PLearn::SortRowsVMatrix.

Definition at line 101 of file SelectRowsVMatrix.cc.

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

real PLearn::SelectRowsVMatrix::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::RowBufferedVMatrix.

Definition at line 83 of file SelectRowsVMatrix.cc.

References indices.

real PLearn::SelectRowsVMatrix::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::RowBufferedVMatrix.

Definition at line 80 of file SelectRowsVMatrix.cc.

References indices.

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

returns element (i,j)

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 74 of file SelectRowsVMatrix.cc.

References indices.

void PLearn::SelectRowsVMatrix::getNewRow int  i,
const Vec v
const [inline, protected, virtual]
 

Must be implemented in subclasses: default version returns an error.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 89 of file SelectRowsVMatrix.h.

References getNewRow(), and getSubRow().

Referenced by getNewRow().

const map< real, string > & PLearn::SelectRowsVMatrix::getRealToStringMapping int  col  )  const [virtual]
 

returns the value->string mapping for field 'fld'

Reimplemented from PLearn::VMatrix.

Definition at line 98 of file SelectRowsVMatrix.cc.

string PLearn::SelectRowsVMatrix::getString int  row,
int  col
const [virtual]
 

returns element as a string, even if value doesn't map to a string, in which case tostring(value) is returned

Reimplemented from PLearn::VMatrix.

Definition at line 92 of file SelectRowsVMatrix.cc.

References indices.

const map< string, real > & PLearn::SelectRowsVMatrix::getStringToRealMapping int  col  )  const [virtual]
 

returns the whole string->value mapping

Reimplemented from PLearn::VMatrix.

Definition at line 95 of file SelectRowsVMatrix.cc.

real PLearn::SelectRowsVMatrix::getStringVal int  col,
const string str
const [virtual]
 

returns value associated with a string (or MISSING_VALUE if there's no association for this string)

Reimplemented from PLearn::VMatrix.

Definition at line 86 of file SelectRowsVMatrix.cc.

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

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 77 of file SelectRowsVMatrix.cc.

References PLearn::VMat::getSubRow(), and indices.

Referenced by getNewRow().

string PLearn::SelectRowsVMatrix::getValString int  col,
real  val
const [virtual]
 

returns the string associated with value val for field# col.

Or returns "" if no string is associated.

Reimplemented from PLearn::VMatrix.

Definition at line 89 of file SelectRowsVMatrix.cc.

References val.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::RemoveDuplicateVMatrix, and PLearn::SortRowsVMatrix.

Definition at line 108 of file SelectRowsVMatrix.cc.

References PLearn::deepCopyField(), and indices.

PLearn::SelectRowsVMatrix::PLEARN_DECLARE_OBJECT SelectRowsVMatrix   ) 
 

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 102 of file SelectRowsVMatrix.h.

References PLearn::VMat::width().


Member Data Documentation

TVec<int> PLearn::SelectRowsVMatrix::indices
 

Public build options.

Definition at line 65 of file SelectRowsVMatrix.h.

Referenced by build_(), dot(), get(), getString(), getSubRow(), makeDeepCopyFromShallowCopy(), and SelectRowsVMatrix().


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