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

PLearn::SelectRowsFileIndexVMatrix Class Reference

#include <SelectRowsFileIndexVMatrix.h>

Inheritance diagram for PLearn::SelectRowsFileIndexVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SelectRowsFileIndexVMatrix ()
 default constructor (for automatic deserialization)

 SelectRowsFileIndexVMatrix (VMat the_distr, const string &indexfile)
 Copy the original fieldinfos upon construction.

 PLEARN_DECLARE_OBJECT (SelectRowsFileIndexVMatrix)
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 getRow (int i, Vec v) const
 copies row i into v (which must have appropriate length equal to the VMat's width)

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 string->value mapping for field 'fld'

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


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 Attributes

VMat distr
IntVecFile indices
string index_file

Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Detailed Description

selects samples from a sub-distribution according to given vector of indices that is stored on disk as an IntVecFile

Definition at line 57 of file SelectRowsFileIndexVMatrix.h.


Member Typedef Documentation

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

Reimplemented from PLearn::VMatrix.

Definition at line 59 of file SelectRowsFileIndexVMatrix.h.

Referenced by SelectRowsFileIndexVMatrix().


Constructor & Destructor Documentation

PLearn::SelectRowsFileIndexVMatrix::SelectRowsFileIndexVMatrix  ) 
 

default constructor (for automatic deserialization)

Definition at line 50 of file SelectRowsFileIndexVMatrix.cc.

PLearn::SelectRowsFileIndexVMatrix::SelectRowsFileIndexVMatrix VMat  the_distr,
const string indexfile
 

Copy the original fieldinfos upon construction.

Definition at line 54 of file SelectRowsFileIndexVMatrix.cc.

References build(), and inherited.


Member Function Documentation

void PLearn::SelectRowsFileIndexVMatrix::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 61 of file SelectRowsFileIndexVMatrix.cc.

References build_().

Referenced by SelectRowsFileIndexVMatrix().

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 68 of file SelectRowsFileIndexVMatrix.cc.

References distr, index_file, indices, PLearn::IntVecFile::length(), and PLearn::IntVecFile::open().

Referenced by build().

void PLearn::SelectRowsFileIndexVMatrix::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 82 of file SelectRowsFileIndexVMatrix.cc.

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

real PLearn::SelectRowsFileIndexVMatrix::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 101 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

real PLearn::SelectRowsFileIndexVMatrix::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 98 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

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

returns element (i,j)

Reimplemented from PLearn::VMatrix.

Definition at line 89 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

void PLearn::SelectRowsFileIndexVMatrix::getRow int  i,
Vec  v
const [virtual]
 

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

Reimplemented from PLearn::VMatrix.

Definition at line 95 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

string PLearn::SelectRowsFileIndexVMatrix::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 110 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 113 of file SelectRowsFileIndexVMatrix.cc.

References distr.

real PLearn::SelectRowsFileIndexVMatrix::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 104 of file SelectRowsFileIndexVMatrix.cc.

References distr.

void PLearn::SelectRowsFileIndexVMatrix::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 92 of file SelectRowsFileIndexVMatrix.cc.

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

string PLearn::SelectRowsFileIndexVMatrix::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 107 of file SelectRowsFileIndexVMatrix.cc.

References distr, and val.

PLearn::SelectRowsFileIndexVMatrix::PLEARN_DECLARE_OBJECT SelectRowsFileIndexVMatrix   ) 
 

virtual void PLearn::SelectRowsFileIndexVMatrix::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 SelectRowsFileIndexVMatrix.h.

References distr, and PLearn::VMat::width().


Member Data Documentation

VMat PLearn::SelectRowsFileIndexVMatrix::distr [protected]
 

Definition at line 62 of file SelectRowsFileIndexVMatrix.h.

Referenced by build_(), dot(), get(), getRow(), getString(), getStringToRealMapping(), getStringVal(), getSubRow(), getValString(), and reset_dimensions().

string PLearn::SelectRowsFileIndexVMatrix::index_file [protected]
 

Definition at line 64 of file SelectRowsFileIndexVMatrix.h.

Referenced by build_().

IntVecFile PLearn::SelectRowsFileIndexVMatrix::indices [protected]
 

Definition at line 63 of file SelectRowsFileIndexVMatrix.h.

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


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