Kernel Gram matrix. More...
#include <shark/LinAlg/KernelMatrix.h>
Public Types | |
typedef CacheType | QpFloatType |
Public Member Functions | |
KernelMatrix (AbstractKernelFunction< InputType > const &kernelfunction, Data< InputType > const &data) | |
QpFloatType | operator() (std::size_t i, std::size_t j) const |
return a single matrix entry More... | |
QpFloatType | entry (std::size_t i, std::size_t j) const |
return a single matrix entry More... | |
void | row (std::size_t i, std::size_t start, std::size_t end, QpFloatType *storage) const |
Computes the i-th row of the kernel matrix. More... | |
template<class M > | |
void | matrix (blas::matrix_expression< M, blas::cpu_tag > &storage) const |
Computes the kernel-matrix. More... | |
void | flipColumnsAndRows (std::size_t i, std::size_t j) |
swap two variables More... | |
std::size_t | size () const |
return the size of the quadratic matrix More... | |
unsigned long long | getAccessCount () const |
query the kernel access counter More... | |
void | resetAccessCount () |
reset the kernel access counter More... | |
Protected Types | |
typedef Batch< InputType >::const_iterator | PointerType |
Protected Attributes | |
const AbstractKernelFunction< InputType > & | kernel |
Kernel function defining the kernel Gram matrix. More... | |
Data< InputType > | m_data |
std::vector< PointerType > | x |
Array of data pointers for kernel evaluations. More... | |
unsigned long long | m_accessCounter |
counter for the kernel accesses More... | |
Kernel Gram matrix.
Definition at line 71 of file KernelMatrix.h.
|
protected |
Definition at line 150 of file KernelMatrix.h.
typedef CacheType shark::KernelMatrix< InputType, CacheType >::QpFloatType |
Definition at line 74 of file KernelMatrix.h.
|
inline |
Constructor
kernelfunction | kernel function defining the Gram matrix |
data | data to evaluate the kernel function |
Definition at line 79 of file KernelMatrix.h.
References shark::Data< Type >::elements(), shark::KernelMatrix< InputType, CacheType >::m_data, shark::Data< Type >::numberOfElements(), and shark::KernelMatrix< InputType, CacheType >::x.
|
inline |
return a single matrix entry
Definition at line 98 of file KernelMatrix.h.
References shark::AbstractKernelFunction< InputTypeT >::eval(), shark::KernelMatrix< InputType, CacheType >::kernel, shark::KernelMatrix< InputType, CacheType >::m_accessCounter, and shark::KernelMatrix< InputType, CacheType >::x.
Referenced by shark::KernelMatrix< InputType, CacheType >::operator()().
|
inline |
swap two variables
Definition at line 127 of file KernelMatrix.h.
References shark::swap(), and shark::KernelMatrix< InputType, CacheType >::x.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::flipColumnsAndRows(), and shark::ModifiedKernelMatrix< InputType, CacheType >::flipColumnsAndRows().
|
inline |
query the kernel access counter
Definition at line 137 of file KernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::m_accessCounter.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::getAccessCount(), and shark::ModifiedKernelMatrix< InputType, CacheType >::getAccessCount().
|
inline |
Computes the kernel-matrix.
Definition at line 120 of file KernelMatrix.h.
References shark::calculateRegularizedKernelMatrix(), shark::KernelMatrix< InputType, CacheType >::kernel, and shark::KernelMatrix< InputType, CacheType >::m_data.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::matrix(), and shark::ModifiedKernelMatrix< InputType, CacheType >::matrix().
|
inline |
return a single matrix entry
Definition at line 94 of file KernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::entry().
|
inline |
reset the kernel access counter
Definition at line 141 of file KernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::m_accessCounter.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::resetAccessCount(), and shark::ModifiedKernelMatrix< InputType, CacheType >::resetAccessCount().
|
inline |
Computes the i-th row of the kernel matrix.
The entries start,...,end of the i-th row are computed and stored in storage. There must be enough room for this operation preallocated.
Definition at line 108 of file KernelMatrix.h.
References shark::AbstractKernelFunction< InputTypeT >::eval(), shark::KernelMatrix< InputType, CacheType >::kernel, shark::KernelMatrix< InputType, CacheType >::m_accessCounter, SHARK_PARALLEL_FOR, and shark::KernelMatrix< InputType, CacheType >::x.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::row(), and shark::ModifiedKernelMatrix< InputType, CacheType >::row().
|
inline |
return the size of the quadratic matrix
Definition at line 133 of file KernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::x.
Referenced by shark::RegularizedKernelMatrix< InputType, CacheType >::size(), and shark::ModifiedKernelMatrix< InputType, CacheType >::size().
|
protected |
Kernel function defining the kernel Gram matrix.
Definition at line 146 of file KernelMatrix.h.
Referenced by shark::KernelMatrix< InputType, CacheType >::entry(), shark::KernelMatrix< InputType, CacheType >::matrix(), and shark::KernelMatrix< InputType, CacheType >::row().
|
mutableprotected |
counter for the kernel accesses
Definition at line 155 of file KernelMatrix.h.
Referenced by shark::KernelMatrix< InputType, CacheType >::entry(), shark::KernelMatrix< InputType, CacheType >::getAccessCount(), shark::KernelMatrix< InputType, CacheType >::resetAccessCount(), and shark::KernelMatrix< InputType, CacheType >::row().
|
protected |
Definition at line 148 of file KernelMatrix.h.
Referenced by shark::KernelMatrix< InputType, CacheType >::KernelMatrix(), and shark::KernelMatrix< InputType, CacheType >::matrix().
|
protected |
Array of data pointers for kernel evaluations.
Definition at line 152 of file KernelMatrix.h.
Referenced by shark::KernelMatrix< InputType, CacheType >::entry(), shark::KernelMatrix< InputType, CacheType >::flipColumnsAndRows(), shark::KernelMatrix< InputType, CacheType >::KernelMatrix(), shark::KernelMatrix< InputType, CacheType >::row(), and shark::KernelMatrix< InputType, CacheType >::size().