Efficient special case if the kernel is Gaussian and the inputs are sparse vectors. More...
#include <shark/LinAlg/GaussianKernelMatrix.h>
Public Types | |
typedef CacheType | QpFloatType |
typedef T | InputType |
Public Member Functions | |
GaussianKernelMatrix (double gamma, 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 Data< InputType >::const_element_range::iterator | PointerType |
Protected Attributes | |
std::vector< PointerType > | x |
Array of data pointers for kernel evaluations. More... | |
RealVector | m_squaredNorms |
double | m_gamma |
unsigned long long | m_accessCounter |
counter for the kernel accesses More... | |
Efficient special case if the kernel is Gaussian and the inputs are sparse vectors.
Definition at line 54 of file GaussianKernelMatrix.h.
typedef T shark::GaussianKernelMatrix< T, CacheType >::InputType |
Definition at line 59 of file GaussianKernelMatrix.h.
|
protected |
Definition at line 140 of file GaussianKernelMatrix.h.
typedef CacheType shark::GaussianKernelMatrix< T, CacheType >::QpFloatType |
Definition at line 58 of file GaussianKernelMatrix.h.
|
inline |
Constructor
gamma | bandwidth parameter of Gaussian kernel |
data | data evaluated by the kernel function |
Definition at line 64 of file GaussianKernelMatrix.h.
References shark::Data< Type >::elements(), shark::GaussianKernelMatrix< T, CacheType >::m_squaredNorms, shark::Data< Type >::numberOfElements(), and shark::GaussianKernelMatrix< T, CacheType >::x.
|
inline |
return a single matrix entry
Definition at line 86 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::m_accessCounter.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::operator()().
|
inline |
swap two variables
Definition at line 119 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::m_squaredNorms, shark::swap(), and shark::GaussianKernelMatrix< T, CacheType >::x.
|
inline |
query the kernel access counter
Definition at line 130 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::m_accessCounter.
|
inline |
Computes the kernel-matrix.
Definition at line 110 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::row(), and shark::GaussianKernelMatrix< T, CacheType >::size().
|
inline |
return a single matrix entry
Definition at line 82 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::entry().
|
inline |
reset the kernel access counter
Definition at line 134 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::m_accessCounter.
|
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 97 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::m_accessCounter, SHARK_PARALLEL_FOR, and shark::GaussianKernelMatrix< T, CacheType >::x.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::matrix().
|
inline |
return the size of the quadratic matrix
Definition at line 126 of file GaussianKernelMatrix.h.
References shark::GaussianKernelMatrix< T, CacheType >::x.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::matrix().
|
mutableprotected |
counter for the kernel accesses
Definition at line 149 of file GaussianKernelMatrix.h.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::entry(), shark::GaussianKernelMatrix< T, CacheType >::getAccessCount(), shark::GaussianKernelMatrix< T, CacheType >::resetAccessCount(), and shark::GaussianKernelMatrix< T, CacheType >::row().
|
protected |
Definition at line 146 of file GaussianKernelMatrix.h.
|
protected |
Definition at line 144 of file GaussianKernelMatrix.h.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::flipColumnsAndRows(), and shark::GaussianKernelMatrix< T, CacheType >::GaussianKernelMatrix().
|
protected |
Array of data pointers for kernel evaluations.
Definition at line 142 of file GaussianKernelMatrix.h.
Referenced by shark::GaussianKernelMatrix< T, CacheType >::flipColumnsAndRows(), shark::GaussianKernelMatrix< T, CacheType >::GaussianKernelMatrix(), shark::GaussianKernelMatrix< T, CacheType >::row(), and shark::GaussianKernelMatrix< T, CacheType >::size().