#include <MemoryVMatrix.h>
Inheritance diagram for PLearn::MemoryVMatrix:
Public Member Functions | |
MemoryVMatrix () | |
MemoryVMatrix (const Mat &the_data) | |
MemoryVMatrix (int l, int w) | |
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 void | getColumn (int i, Vec v) const |
copies column i into v (which must have appropriate length equal to the VMat's length) | |
virtual void | getMat (int i, int j, Mat m) const |
copies the submatrix starting at i,j into m (which must have appropriate length and width) | |
virtual void | put (int i, int j, real value) |
sets element (i,j) to value | |
virtual void | putSubRow (int i, int j, Vec v) |
virtual void | putRow (int i, Vec v) |
virtual void | appendRow (Vec v) |
This method must be implemented for matrices that are allowed to grow. | |
virtual void | fill (real value) |
virtual void | putMat (int i, int j, Mat m) |
copies matrix m at position i,j of this VMat | |
virtual Mat | toMat () const |
virtual VMat | subMat (int i, int j, int l, int w) |
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 | build () |
simply calls inherited::build() then build_() | |
PLEARN_DECLARE_OBJECT (MemoryVMatrix) | |
void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Public Attributes | |
Mat | data |
VMat | data_vm |
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) | |
Private Types | |
typedef VMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
|
Reimplemented from PLearn::VMatrix. Reimplemented in PLearn::GramVMatrix, and PLearn::StrTableVMatrix. Definition at line 54 of file MemoryVMatrix.h. |
|
Definition at line 56 of file MemoryVMatrix.cc. References PLearn::Mat. Referenced by subMat(). |
|
Definition at line 65 of file MemoryVMatrix.cc. References PLearn::TMat< T >::width(). |
|
Definition at line 59 of file MemoryVMatrix.cc. References data, PLearn::TMat< T >::resize(), and PLearn::TMat< T >::width(). |
|
This method must be implemented for matrices that are allowed to grow.
Reimplemented from PLearn::VMatrix. Definition at line 175 of file MemoryVMatrix.cc. References PLearn::TMat< T >::appendRow(), and data. |
|
simply calls inherited::build() then build_()
Reimplemented from PLearn::VMatrix. Reimplemented in PLearn::GramVMatrix. Definition at line 120 of file MemoryVMatrix.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::VMatrix. Reimplemented in PLearn::GramVMatrix. Definition at line 92 of file MemoryVMatrix.cc. References data, data_vm, PLearn::TMat< T >::length(), PLearn::VMatrix::length(), PLearn::TMat< T >::resize(), PLearn::VMat::toMat(), PLearn::VMatrix::width(), and PLearn::TMat< T >::width(). 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. Reimplemented in PLearn::GramVMatrix. Definition at line 71 of file MemoryVMatrix.cc. References PLearn::declareOption(), and 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::VMatrix. Definition at line 220 of file MemoryVMatrix.cc. References PLearn::TVec< T >::data(), data, k, PLearn::TVec< T >::length(), PLERROR, PLearn::TMat< T >::rowdata(), 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::VMatrix. Definition at line 206 of file MemoryVMatrix.cc. References data, k, PLERROR, PLearn::TMat< T >::rowdata(), and PLearn::VMatrix::width(). |
|
Reimplemented from PLearn::VMatrix. Definition at line 166 of file MemoryVMatrix.cc. References data, and PLearn::TMat< T >::fill(). |
|
returns element (i,j)
Reimplemented from PLearn::VMatrix. Definition at line 126 of file MemoryVMatrix.cc. References data. |
|
copies column i into v (which must have appropriate length equal to the VMat's length)
Reimplemented from PLearn::VMatrix. Definition at line 132 of file MemoryVMatrix.cc. References PLearn::TMat< T >::column(), data, and PLearn::Vec. |
|
copies the submatrix starting at i,j into m (which must have appropriate length and width)
Reimplemented from PLearn::VMatrix. Definition at line 153 of file MemoryVMatrix.cc. References data, PLearn::TMat< T >::length(), PLearn::TMat< T >::subMat(), and PLearn::TMat< T >::width(). |
|
copies row i into v (which must have appropriate length equal to the VMat's width)
Reimplemented from PLearn::VMatrix. Definition at line 148 of file MemoryVMatrix.cc. References PLearn::TVec< T >::copyFrom(), and data. |
|
fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive)
Reimplemented from PLearn::VMatrix. Definition at line 135 of file MemoryVMatrix.cc. References PLearn::TVec< T >::copyFrom(), data, PLearn::TVec< T >::length(), PLERROR, and PLearn::VMatrix::width(). |
|
Reimplemented from PLearn::VMatrix. Reimplemented in PLearn::GramVMatrix. Definition at line 82 of file MemoryVMatrix.cc. References data, data_vm, and PLearn::deepCopyField(). |
|
|
|
sets element (i,j) to value
Reimplemented from PLearn::VMatrix. Definition at line 129 of file MemoryVMatrix.cc. References data. |
|
copies matrix m at position i,j of this VMat
Reimplemented from PLearn::VMatrix. Definition at line 172 of file MemoryVMatrix.cc. References data, PLearn::TMat< T >::length(), PLearn::TMat< T >::subMat(), and PLearn::TMat< T >::width(). |
|
Reimplemented from PLearn::VMatrix. Definition at line 169 of file MemoryVMatrix.cc. References PLearn::TVec< T >::copyTo(), and data. |
|
It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead) Reimplemented from PLearn::VMatrix. Definition at line 156 of file MemoryVMatrix.cc. References PLearn::TVec< T >::copyTo(), data, PLearn::TVec< T >::length(), PLERROR, and PLearn::VMatrix::width(). |
|
default version returns a SubVMatrix referencing the current VMatrix however this can be overridden to provide more efficient shortcuts (see MemoryVMatrix::subMat and SubVMatrix::subMat for examples) Reimplemented from PLearn::VMatrix. Definition at line 200 of file MemoryVMatrix.cc. References data, MemoryVMatrix(), and PLearn::TMat< T >::subMat(). |
|
returns a Mat with the same data as this VMat The default version of this method copies the data in a fresh Mat created in memory However this method will typically be overrided by subclasses (such as MemoryVMatrix) whose internal representation is already a Mat in order to return this Mat directly to avoid a new memory allocation and copy of elements. In this case, and in this case only, modifying the elements of the returned Mat will logically result in modified elements in the original VMatrix view of it. Reimplemented from PLearn::VMatrix. Definition at line 197 of file MemoryVMatrix.cc. References data. |
|
Definition at line 58 of file MemoryVMatrix.h. Referenced by appendRow(), build_(), dot(), fill(), get(), getColumn(), getMat(), getRow(), getSubRow(), makeDeepCopyFromShallowCopy(), MemoryVMatrix(), put(), putMat(), putRow(), putSubRow(), subMat(), and toMat(). |
|
Definition at line 59 of file MemoryVMatrix.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |