PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions
PLearn::RemoveRowsVMatrix Class Reference

sees an underlying VMat with the specified rows excluded More...

#include <RemoveRowsVMatrix.h>

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

List of all members.

Public Member Functions

virtual void reset_dimensions ()
 In case the dimensions of an underlying VMat has changed, recompute it.
 RemoveRowsVMatrix ()
 RemoveRowsVMatrix (VMat the_distr, Vec the_indices=Vec())
 default constructor (for automatic deserialization)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual RemoveRowsVMatrixdeepCopy (CopiesMap &copies) const
virtual void build ()
 Simply calls inherited::build() then build_().
void remove (int rownum)
 the given rownum of the underlying distr will also be excluded
void unremove (int rownum)
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 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).

Static Public Member Functions

static string _classname_ ()
 RemoveRowsVMatrix.
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 Member Functions

int getrownum (int i) const
 returns the row number in distr corresponding to i in this VMat

Protected Attributes

VMat distr
Vec indices

Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

sees an underlying VMat with the specified rows excluded

Definition at line 53 of file RemoveRowsVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 55 of file RemoveRowsVMatrix.h.


Constructor & Destructor Documentation

PLearn::RemoveRowsVMatrix::RemoveRowsVMatrix ( ) [inline]

Definition at line 70 of file RemoveRowsVMatrix.h.

{}; 
PLearn::RemoveRowsVMatrix::RemoveRowsVMatrix ( VMat  the_distr,
Vec  the_indices = Vec() 
)

default constructor (for automatic deserialization)

Copy the original fieldinfos upon construction

Definition at line 50 of file RemoveRowsVMatrix.cc.

References build().

    : inherited(the_distr->length()-the_indices.length(), the_distr->width()),
      distr(the_distr), indices(the_indices.copy())
{
    build();
}

Here is the call graph for this function:


Member Function Documentation

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

RemoveRowsVMatrix.

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 58 of file RemoveRowsVMatrix.cc.

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

Referenced by RemoveRowsVMatrix().

Here is the call graph for this function:

Here is the caller graph for this function:

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 65 of file RemoveRowsVMatrix.cc.

References distr, PLearn::VMatrix::fieldinfos, indices, and PLearn::sortElements().

Referenced by build().

{
    if (distr)
        fieldinfos = distr->fieldinfos;
    if (indices)
        sortElements(indices);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Declare this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 74 of file RemoveRowsVMatrix.cc.

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

Here is the call graph for this function:

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

Reimplemented from PLearn::VMatrix.

Definition at line 75 of file RemoveRowsVMatrix.h.

{ 
RemoveRowsVMatrix * PLearn::RemoveRowsVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::VMatrix.

Definition at line 48 of file RemoveRowsVMatrix.cc.

real PLearn::RemoveRowsVMatrix::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 RemoveRowsVMatrix.cc.

References distr, and getrownum().

{ return distr->dot(getrownum(i1),getrownum(i2),inputsize); }

Here is the call graph for this function:

real PLearn::RemoveRowsVMatrix::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 RemoveRowsVMatrix.cc.

References distr, and getrownum().

{ return distr->dot(getrownum(i),v); }

Here is the call graph for this function:

real PLearn::RemoveRowsVMatrix::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 92 of file RemoveRowsVMatrix.cc.

References distr, and getrownum().

{ return distr->get(getrownum(i), j); }

Here is the call graph for this function:

OptionList & PLearn::RemoveRowsVMatrix::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file RemoveRowsVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file RemoveRowsVMatrix.cc.

int PLearn::RemoveRowsVMatrix::getrownum ( int  i) const [protected]

returns the row number in distr corresponding to i in this VMat

Definition at line 81 of file RemoveRowsVMatrix.cc.

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

Referenced by dot(), get(), and getSubRow().

{
    int k=0;
    while(k<indices.length() && indices[k]<=i)
    {
        i++;
        k++;
    }
    return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemoveRowsVMatrix::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 95 of file RemoveRowsVMatrix.cc.

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

{ distr->getSubRow(getrownum(i), j, v); }

Here is the call graph for this function:

void PLearn::RemoveRowsVMatrix::remove ( int  rownum) [inline]

the given rownum of the underlying distr will also be excluded

Definition at line 81 of file RemoveRowsVMatrix.h.

    { 
        indices.insertSorted(rownum,true); 
        length_--;
    }
virtual void PLearn::RemoveRowsVMatrix::reset_dimensions ( ) [inline, virtual]

In case the dimensions of an underlying VMat has changed, recompute it.

Reimplemented from PLearn::VMatrix.

Definition at line 65 of file RemoveRowsVMatrix.h.

{ distr->reset_dimensions(); width_=distr->width(); }
void PLearn::RemoveRowsVMatrix::unremove ( int  rownum) [inline]

Definition at line 87 of file RemoveRowsVMatrix.h.

    {
        indices.removeSorted(rownum);
        length_++;
    }

Member Data Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 75 of file RemoveRowsVMatrix.h.

Definition at line 58 of file RemoveRowsVMatrix.h.

Referenced by build_(), declareOptions(), dot(), get(), and getSubRow().

Definition at line 59 of file RemoveRowsVMatrix.h.

Referenced by build_(), declareOptions(), and getrownum().


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