PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Types | Private Member Functions
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.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual
SelectRowsFileIndexVMatrix
deepCopy (CopiesMap &copies) const
virtual void build ()
 Simply calls inherited::build() then build_().
virtual real get (int i, int j) const
 This method must be implemented in all subclasses.
virtual void getSubRow (int i, int j, Vec v) const
 It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).
virtual void getRow (int i, Vec v) const
 These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)
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->real mapping for column 'col'.
virtual real dot (int i1, int i2, int inputsize) const
 Returns the dot product between row i1 and row i2 (considering only the inputsize first elements).
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

static string _classname_ ()
 SelectRowsFileIndexVMatrix.
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()
static void declareOptions (OptionList &ol)
 Declare this class' options.

Static Public Attributes

static StaticInitializer _static_initializer_

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 58 of file SelectRowsFileIndexVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 60 of file SelectRowsFileIndexVMatrix.h.


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().

    : inherited(0,the_distr->width()), distr(the_distr), indices(indexfile), index_file(indexfile)
{
    build();
}

Here is the call graph for this function:


Member Function Documentation

string PLearn::SelectRowsFileIndexVMatrix::_classname_ ( ) [static]

SelectRowsFileIndexVMatrix.

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

OptionList & PLearn::SelectRowsFileIndexVMatrix::_getOptionList_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

RemoteMethodMap & PLearn::SelectRowsFileIndexVMatrix::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

bool PLearn::SelectRowsFileIndexVMatrix::_isa_ ( const Object o) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

Object * PLearn::SelectRowsFileIndexVMatrix::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

StaticInitializer SelectRowsFileIndexVMatrix::_static_initializer_ & PLearn::SelectRowsFileIndexVMatrix::_static_initialize_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

void PLearn::SelectRowsFileIndexVMatrix::build ( ) [virtual]

Simply calls inherited::build() then build_().

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file SelectRowsFileIndexVMatrix.cc.

References PLearn::VMatrix::build(), and build_().

Referenced by SelectRowsFileIndexVMatrix().

Here is the call graph for this function:

Here is the caller graph for this function:

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 68 of file SelectRowsFileIndexVMatrix.cc.

References PLearn::VMatrix::defineSizes(), distr, PLearn::VMatrix::fieldinfos, index_file, indices, PLearn::IntVecFile::length(), PLearn::VMatrix::length_, PLearn::IntVecFile::open(), PLearn::VMatrix::updateMtime(), PLearn::VMat::width(), and PLearn::VMatrix::width_.

Referenced by build().

{
    if (distr) {
        updateMtime(distr);
        fieldinfos = distr->fieldinfos;
        length_ = indices.length();
        if (length_ == -1) {
            indices.open(index_file);
            length_ = indices.length();
        }
        width_= distr->width();
        defineSizes(distr->inputsize(), distr->targetsize(), distr->weightsize());
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

string PLearn::SelectRowsFileIndexVMatrix::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

void PLearn::SelectRowsFileIndexVMatrix::declareOptions ( OptionList ol) [static]

Declare this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 84 of file SelectRowsFileIndexVMatrix.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), distr, and index_file.

Here is the call graph for this function:

static const PPath& PLearn::SelectRowsFileIndexVMatrix::declaringFile ( ) [inline, static]

Reimplemented from PLearn::VMatrix.

Definition at line 75 of file SelectRowsFileIndexVMatrix.h.

{ distr->reset_dimensions(); width_=distr->width(); }
SelectRowsFileIndexVMatrix * PLearn::SelectRowsFileIndexVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

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 103 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

{ return distr->dot(indices[i],v); }
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 100 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

{ return distr->dot(indices[i1],indices[i2],inputsize); }
real PLearn::SelectRowsFileIndexVMatrix::get ( int  i,
int  j 
) const [virtual]

This method must be implemented in all subclasses.

Returns element (i,j).

Implements PLearn::VMatrix.

Definition at line 91 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

{ return distr->get(indices[i], j); }
OptionList & PLearn::SelectRowsFileIndexVMatrix::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

OptionMap & PLearn::SelectRowsFileIndexVMatrix::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

RemoteMethodMap & PLearn::SelectRowsFileIndexVMatrix::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 48 of file SelectRowsFileIndexVMatrix.cc.

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

These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)

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

Reimplemented from PLearn::VMatrix.

Definition at line 97 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

{ distr->getRow(indices[i], v); }
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 112 of file SelectRowsFileIndexVMatrix.cc.

References distr, and indices.

{ return distr->getString(indices[row], col); }
const map< string, real > & PLearn::SelectRowsFileIndexVMatrix::getStringToRealMapping ( int  col) const [virtual]

Returns the string->real mapping for column 'col'.

Reimplemented from PLearn::VMatrix.

Definition at line 115 of file SelectRowsFileIndexVMatrix.cc.

References distr.

{ return distr->getStringToRealMapping(col);}
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 106 of file SelectRowsFileIndexVMatrix.cc.

References distr.

{ return distr->getStringVal(col, str); }
void PLearn::SelectRowsFileIndexVMatrix::getSubRow ( int  i,
int  j,
Vec  v 
) const [virtual]

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 94 of file SelectRowsFileIndexVMatrix.cc.

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

{ distr->getSubRow(indices[i], j, v); }

Here is the call graph for this function:

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 109 of file SelectRowsFileIndexVMatrix.cc.

References distr.

{ return distr->getValString(col,val); }
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 90 of file SelectRowsFileIndexVMatrix.h.

{ distr->reset_dimensions(); width_=distr->width(); }

Member Data Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 75 of file SelectRowsFileIndexVMatrix.h.

Definition at line 65 of file SelectRowsFileIndexVMatrix.h.

Referenced by build_(), and declareOptions().

Definition at line 64 of file SelectRowsFileIndexVMatrix.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines