Partly Precomputed version of a matrix for quadratic programming. More...
#include <shark/LinAlg/PartlyPrecomputedMatrix.h>
Public Types | |
typedef Matrix::QpFloatType | QpFloatType |
Public Member Functions | |
PartlyPrecomputedMatrix (Matrix *base, std::size_t cachesize=0x4000000) | |
bool | isCached (std::size_t k) const |
void | row (std::size_t k, blas::vector< QpFloatType > &storage) const |
QpFloatType | operator() (std::size_t i, std::size_t j) const |
QpFloatType | entry (std::size_t i, std::size_t j) const |
std::size_t | size () const |
std::size_t | getMaxCacheSize () |
std::size_t | getCacheRowSize () const |
Protected Attributes | |
blas::matrix< QpFloatType > | m_cachedMatrix |
container for precomputed values More... | |
size_t | m_cacheSize |
Matrix * | m_baseMatrix |
size_t | m_originalNumberOfRows |
Partly Precomputed version of a matrix for quadratic programming.
Definition at line 68 of file PartlyPrecomputedMatrix.h.
typedef Matrix::QpFloatType shark::PartlyPrecomputedMatrix< Matrix >::QpFloatType |
Definition at line 71 of file PartlyPrecomputedMatrix.h.
|
inline |
Constructor
[in] | base | matrix to be cached. it is assumed that this matrix is not precomputed, but the (costy) computation takes place every time an entry is queried. |
[in] | cachesize | size of the cache to use in bytes. the size of the cached matrix will |
Definition at line 78 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::m_baseMatrix, shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix, shark::PartlyPrecomputedMatrix< Matrix >::m_cacheSize, shark::PartlyPrecomputedMatrix< Matrix >::m_originalNumberOfRows, SHARK_RUNTIME_CHECK, and shark::PartlyPrecomputedMatrix< Matrix >::size().
|
inline |
return a single matrix entry param[in] i row of entry param[in] j column entry
Definition at line 168 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::isCached(), shark::PartlyPrecomputedMatrix< Matrix >::m_baseMatrix, and shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::operator()().
|
inline |
return the dimension of a row in the cache (as we do not shorten our rows, this must be the same as the dimension of a row in the original kernel matrix).
Definition at line 201 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix.
|
inline |
return size of cached matrix in QpFloatType units
Definition at line 191 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix.
|
inline |
return, if a given row is cached
[in] | k | row to check |
Definition at line 116 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::entry(), and shark::PartlyPrecomputedMatrix< Matrix >::row().
|
inline |
return a single matrix entry param[in] i row of entry param[in] j column entry
Definition at line 157 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::entry().
|
inline |
return a complete row of the matrix. if the row is cached, it will be returned from there, if not, it will be recomputed on-the-fly and not stored. param[in] k row to compute param[in] storage vector to store the row. must be the same size as a row!
Definition at line 130 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::isCached(), shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix, shark::PartlyPrecomputedMatrix< Matrix >::m_originalNumberOfRows, RANGE_CHECK, and SIZE_CHECK.
|
inline |
return the number of cached rows
Definition at line 182 of file PartlyPrecomputedMatrix.h.
References shark::PartlyPrecomputedMatrix< Matrix >::m_cachedMatrix.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::PartlyPrecomputedMatrix().
|
protected |
Definition at line 216 of file PartlyPrecomputedMatrix.h.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::entry(), and shark::PartlyPrecomputedMatrix< Matrix >::PartlyPrecomputedMatrix().
|
protected |
container for precomputed values
Definition at line 210 of file PartlyPrecomputedMatrix.h.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::entry(), shark::PartlyPrecomputedMatrix< Matrix >::getCacheRowSize(), shark::PartlyPrecomputedMatrix< Matrix >::getMaxCacheSize(), shark::PartlyPrecomputedMatrix< Matrix >::isCached(), shark::PartlyPrecomputedMatrix< Matrix >::PartlyPrecomputedMatrix(), shark::PartlyPrecomputedMatrix< Matrix >::row(), and shark::PartlyPrecomputedMatrix< Matrix >::size().
|
protected |
Definition at line 213 of file PartlyPrecomputedMatrix.h.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::PartlyPrecomputedMatrix().
|
protected |
Definition at line 219 of file PartlyPrecomputedMatrix.h.
Referenced by shark::PartlyPrecomputedMatrix< Matrix >::PartlyPrecomputedMatrix(), and shark::PartlyPrecomputedMatrix< Matrix >::row().