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

PLearn::SelectColumnsVMatrix Class Reference

selects variables (columns) from a source matrix according to given vector of indices. More...

#include <SelectColumnsVMatrix.h>

Inheritance diagram for PLearn::SelectColumnsVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SelectColumnsVMatrix ()
 Default constructor.

 SelectColumnsVMatrix (VMat the_source, TVec< string > the_fields)
 The appropriate fieldinfos are copied upon construction.

 SelectColumnsVMatrix (VMat the_source, TVec< int > the_indices)
 The appropriate fieldinfos are copied upon construction Here the indices will be shared for efficiency.

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

 PLEARN_DECLARE_OBJECT (SelectColumnsVMatrix)
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 void reset_dimensions ()
 in case the dimensions of an underlying vmat has changed, recompute it

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

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

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.


Public Attributes

TVec< intindices
 Public build options.

TVec< stringfields

Protected Member Functions

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


Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Private Types

typedef SourceVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Detailed Description

selects variables (columns) from a source matrix according to given vector of indices.

NC: removed the unused field raw_sample.

Definition at line 56 of file SelectColumnsVMatrix.h.


Member Typedef Documentation

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

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::GetInputVMatrix.

Definition at line 61 of file SelectColumnsVMatrix.h.


Constructor & Destructor Documentation

PLearn::SelectColumnsVMatrix::SelectColumnsVMatrix  ) 
 

Default constructor.

Definition at line 57 of file SelectColumnsVMatrix.cc.

PLearn::SelectColumnsVMatrix::SelectColumnsVMatrix VMat  the_source,
TVec< string the_fields
 

The appropriate fieldinfos are copied upon construction.

Here the indices will be shared for efficiency. But you should not modify them afterwards!

Definition at line 60 of file SelectColumnsVMatrix.cc.

References build_().

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

The appropriate fieldinfos are copied upon construction Here the indices will be shared for efficiency.

But you should not modify them afterwards!

Definition at line 67 of file SelectColumnsVMatrix.cc.

References build_().

PLearn::SelectColumnsVMatrix::SelectColumnsVMatrix VMat  the_source,
Vec  the_indices
 

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

Definition at line 74 of file SelectColumnsVMatrix.cc.

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


Member Function Documentation

void PLearn::SelectColumnsVMatrix::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::GetInputVMatrix.

Definition at line 112 of file SelectColumnsVMatrix.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::GetInputVMatrix.

Definition at line 121 of file SelectColumnsVMatrix.cc.

References PLearn::TVec< int >::append(), PLearn::TVec< int >::clear(), fields, PLearn::VMat::getFieldIndex(), indices, PLearn::TVec< string >::isNotEmpty(), PLearn::VMat::length(), PLearn::TVec< int >::length(), PLearn::TVec< string >::length(), PLearn::TVec< VMField >::resize(), and PLearn::VMatrix::width().

Referenced by build(), and SelectColumnsVMatrix().

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

Declares this class' options.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::GetInputVMatrix.

Definition at line 92 of file SelectColumnsVMatrix.cc.

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

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

returns element (i,j)

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 83 of file SelectColumnsVMatrix.cc.

References indices.

void PLearn::SelectColumnsVMatrix::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 93 of file SelectColumnsVMatrix.h.

References getNewRow(), and getSubRow().

Referenced by getNewRow().

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 160 of file SelectColumnsVMatrix.cc.

References indices.

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 145 of file SelectColumnsVMatrix.cc.

References indices.

real PLearn::SelectColumnsVMatrix::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 152 of file SelectColumnsVMatrix.cc.

References indices.

void PLearn::SelectColumnsVMatrix::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 86 of file SelectColumnsVMatrix.cc.

References indices, and PLearn::TVec< T >::length().

Referenced by getNewRow().

string PLearn::SelectColumnsVMatrix::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 167 of file SelectColumnsVMatrix.cc.

References indices, and val.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SourceVMatrix.

Reimplemented in PLearn::GetInputVMatrix.

Definition at line 103 of file SelectColumnsVMatrix.cc.

References PLearn::deepCopyField(), and indices.

PLearn::SelectColumnsVMatrix::PLEARN_DECLARE_OBJECT SelectColumnsVMatrix   ) 
 

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 99 of file SelectColumnsVMatrix.h.

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


Member Data Documentation

TVec<string> PLearn::SelectColumnsVMatrix::fields
 

Definition at line 67 of file SelectColumnsVMatrix.h.

Referenced by build_().

TVec<int> PLearn::SelectColumnsVMatrix::indices
 

Public build options.

Definition at line 66 of file SelectColumnsVMatrix.h.

Referenced by build_(), get(), getRealToStringMapping(), getStringToRealMapping(), getStringVal(), getSubRow(), getValString(), makeDeepCopyFromShallowCopy(), reset_dimensions(), and SelectColumnsVMatrix().


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