shark::RegularizedKernelMatrix< InputType, CacheType > Class Template Reference

Kernel Gram matrix with modified diagonal. More...

#include <shark/LinAlg/RegularizedKernelMatrix.h>

Public Types

typedef Matrix::QpFloatType QpFloatType
 

Public Member Functions

 RegularizedKernelMatrix (AbstractKernelFunction< InputType > const &kernelfunction, Data< InputType > const &data, const RealVector &diagModification)
 
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 k, 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 Attributes

Matrix m_matrix
 
RealVector m_diagMod
 

Detailed Description

template<class InputType, class CacheType>
class shark::RegularizedKernelMatrix< InputType, CacheType >

Kernel Gram matrix with modified diagonal.

Regularized version of KernelMatrix. The regularization is achieved by adding a vector to the matrix diagonal. In particular, this is useful for support vector machines with 2-norm penalty term.

Definition at line 62 of file RegularizedKernelMatrix.h.

Member Typedef Documentation

◆ QpFloatType

template<class InputType , class CacheType >
typedef Matrix::QpFloatType shark::RegularizedKernelMatrix< InputType, CacheType >::QpFloatType

Definition at line 67 of file RegularizedKernelMatrix.h.

Constructor & Destructor Documentation

◆ RegularizedKernelMatrix()

template<class InputType , class CacheType >
shark::RegularizedKernelMatrix< InputType, CacheType >::RegularizedKernelMatrix ( AbstractKernelFunction< InputType > const &  kernelfunction,
Data< InputType > const &  data,
const RealVector &  diagModification 
)
inline

Constructor

Parameters
kernelfunctionkernel function
datadata to evaluate the kernel function
diagModificationvector d of diagonal modifiers

Definition at line 73 of file RegularizedKernelMatrix.h.

References shark::RegularizedKernelMatrix< InputType, CacheType >::size(), and SIZE_CHECK.

Member Function Documentation

◆ entry()

template<class InputType , class CacheType >
QpFloatType shark::RegularizedKernelMatrix< InputType, CacheType >::entry ( std::size_t  i,
std::size_t  j 
) const
inline

◆ flipColumnsAndRows()

template<class InputType , class CacheType >
void shark::RegularizedKernelMatrix< InputType, CacheType >::flipColumnsAndRows ( std::size_t  i,
std::size_t  j 
)
inline

◆ getAccessCount()

template<class InputType , class CacheType >
unsigned long long shark::RegularizedKernelMatrix< InputType, CacheType >::getAccessCount ( ) const
inline

◆ matrix()

template<class InputType , class CacheType >
template<class M >
void shark::RegularizedKernelMatrix< InputType, CacheType >::matrix ( blas::matrix_expression< M, blas::cpu_tag > &  storage) const
inline

◆ operator()()

template<class InputType , class CacheType >
QpFloatType shark::RegularizedKernelMatrix< InputType, CacheType >::operator() ( std::size_t  i,
std::size_t  j 
) const
inline

return a single matrix entry

Definition at line 82 of file RegularizedKernelMatrix.h.

References shark::RegularizedKernelMatrix< InputType, CacheType >::entry().

◆ resetAccessCount()

template<class InputType , class CacheType >
void shark::RegularizedKernelMatrix< InputType, CacheType >::resetAccessCount ( )
inline

◆ row()

template<class InputType , class CacheType >
void shark::RegularizedKernelMatrix< InputType, CacheType >::row ( std::size_t  k,
std::size_t  start,
std::size_t  end,
QpFloatType storage 
) const
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 RegularizedKernelMatrix.h.

References shark::RegularizedKernelMatrix< InputType, CacheType >::m_diagMod, shark::RegularizedKernelMatrix< InputType, CacheType >::m_matrix, and shark::KernelMatrix< InputType, CacheType >::row().

◆ size()

Member Data Documentation

◆ m_diagMod

◆ m_matrix


The documentation for this class was generated from the following file: