#include <SparseVMatrix.h>
Inheritance diagram for PLearn::SparseVMatrix:
Public Member Functions | |
SparseVMatrix () | |
SparseVMatrix (VMat m) | |
This builds a sparse representation in memory of the VMat m passed as argument. | |
SparseVMatrix (const string &filename) | |
This reloads a previously saved sparse VMatrix. | |
PLEARN_DECLARE_OBJECT (SparseVMatrix) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
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 | save (const string &filename) |
calls write | |
virtual | ~SparseVMatrix () |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
This is the only method requiring implementation in subclasses. | |
Static Protected 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 | |
int | nelements |
total number of non-zero elements in the VMatrix | |
unsigned short * | positions |
float * | values |
SparseVMatrixRow * | rows |
Private Types | |
typedef RowBufferedVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
|
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 70 of file SparseVMatrix.h. Referenced by SparseVMatrix(). |
|
Definition at line 81 of file SparseVMatrix.h. |
|
This builds a sparse representation in memory of the VMat m passed as argument. The original fieldinfos are copied as-is. Definition at line 57 of file SparseVMatrix.cc. References PLearn::TVec< T >::data(), inherited, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), PLearn::VMat::length(), PLearn::SparseVMatrixRow::nelements, nelements, PLearn::VMFieldStat::nmissing(), PLearn::VMFieldStat::nnegative(), PLearn::VMFieldStat::npositive(), PLERROR, positions, PLearn::SparseVMatrixRow::row_startpos, rows, values, PLearn::Vec, and PLearn::VMat::width(). |
|
This reloads a previously saved sparse VMatrix.
Definition at line 51 of file SparseVMatrix.cc. References PLearn::load(). |
|
Definition at line 300 of file SparseVMatrix.cc. |
|
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 118 of file SparseVMatrix.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::VMatrix. Definition at line 125 of file SparseVMatrix.cc. Referenced by build(). |
|
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 131 of file SparseVMatrix.cc. References PLearn::OptionList. |
|
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 223 of file SparseVMatrix.cc. References PLearn::TVec< T >::data(), PLearn::TVec< T >::length(), PLearn::VMatrix::length(), PLearn::SparseVMatrixRow::nelements, nelements, PLERROR, positions, PLearn::SparseVMatrixRow::row_startpos, rows, values, and PLearn::VMatrix::width(). |
|
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 170 of file SparseVMatrix.cc. References PLearn::VMatrix::length(), PLearn::SparseVMatrixRow::nelements, nelements, PLERROR, positions, PLearn::SparseVMatrixRow::row_startpos, rows, values, and PLearn::VMatrix::width(). |
|
This is the only method requiring implementation in subclasses.
Implements PLearn::RowBufferedVMatrix. Definition at line 136 of file SparseVMatrix.cc. References PLearn::TVec< T >::clear(), PLearn::TVec< T >::data(), PLearn::TVec< T >::length(), PLearn::VMatrix::length(), PLearn::SparseVMatrixRow::nelements, nelements, PLERROR, positions, PLearn::SparseVMatrixRow::row_startpos, rows, values, and PLearn::VMatrix::width(). |
|
|
|
calls write
Definition at line 109 of file SparseVMatrix.h. |
|
total number of non-zero elements in the VMatrix
Definition at line 73 of file SparseVMatrix.h. Referenced by dot(), getNewRow(), SparseVMatrix(), and ~SparseVMatrix(). |
|
Definition at line 74 of file SparseVMatrix.h. Referenced by dot(), getNewRow(), SparseVMatrix(), and ~SparseVMatrix(). |
|
Definition at line 77 of file SparseVMatrix.h. Referenced by dot(), getNewRow(), SparseVMatrix(), and ~SparseVMatrix(). |
|
Definition at line 75 of file SparseVMatrix.h. Referenced by dot(), getNewRow(), SparseVMatrix(), and ~SparseVMatrix(). |