shark::BlockMatrix2x2< Matrix > Class Template Reference

SVM regression matrix. More...

#include <shark/LinAlg/BlockMatrix2x2.h>

Public Types

typedef Matrix::QpFloatType QpFloatType
 

Public Member Functions

 BlockMatrix2x2 (Matrix *base)
 
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...
 

Protected Attributes

Matrix * m_base
 underlying KernelMatrix object More...
 
std::vector< std::size_t > m_mapping
 coordinate permutation More...
 

Detailed Description

template<class Matrix>
class shark::BlockMatrix2x2< Matrix >

SVM regression matrix.

The BlockMatrix2x2 class is a \( 2n \times 2n \) block matrix of the form
    \( \left( \begin{array}{lr} M & M \\ M & M \end{array} \right) \)
where M is an \( n \times n \) matrix. This matrix form is needed in SVM regression problems.

Definition at line 62 of file BlockMatrix2x2.h.

Member Typedef Documentation

◆ QpFloatType

template<class Matrix >
typedef Matrix::QpFloatType shark::BlockMatrix2x2< Matrix >::QpFloatType

Definition at line 65 of file BlockMatrix2x2.h.

Constructor & Destructor Documentation

◆ BlockMatrix2x2()

template<class Matrix >
shark::BlockMatrix2x2< Matrix >::BlockMatrix2x2 ( Matrix *  base)
inline

Constructor.

Parameters
baseunderlying matrix M, see class description of BlockMatrix2x2.

Definition at line 69 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::m_base, shark::BlockMatrix2x2< Matrix >::m_mapping, and shark::BlockMatrix2x2< Matrix >::size().

Member Function Documentation

◆ entry()

template<class Matrix >
QpFloatType shark::BlockMatrix2x2< Matrix >::entry ( std::size_t  i,
std::size_t  j 
) const
inline

◆ flipColumnsAndRows()

template<class Matrix >
void shark::BlockMatrix2x2< Matrix >::flipColumnsAndRows ( std::size_t  i,
std::size_t  j 
)
inline

swap two variables

Definition at line 117 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::m_mapping, and shark::swap().

◆ matrix()

template<class Matrix >
template<class M >
void shark::BlockMatrix2x2< Matrix >::matrix ( blas::matrix_expression< M, blas::cpu_tag > &  storage) const
inline

Computes the kernel-matrix.

Definition at line 106 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::entry(), and shark::BlockMatrix2x2< Matrix >::size().

◆ operator()()

template<class Matrix >
QpFloatType shark::BlockMatrix2x2< Matrix >::operator() ( std::size_t  i,
std::size_t  j 
) const
inline

return a single matrix entry

Definition at line 85 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::entry().

◆ row()

template<class Matrix >
void shark::BlockMatrix2x2< Matrix >::row ( std::size_t  i,
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 98 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::m_base, and shark::BlockMatrix2x2< Matrix >::m_mapping.

◆ size()

template<class Matrix >
std::size_t shark::BlockMatrix2x2< Matrix >::size ( ) const
inline

return the size of the quadratic matrix

Definition at line 123 of file BlockMatrix2x2.h.

References shark::BlockMatrix2x2< Matrix >::m_base.

Referenced by shark::BlockMatrix2x2< Matrix >::BlockMatrix2x2(), and shark::BlockMatrix2x2< Matrix >::matrix().

Member Data Documentation

◆ m_base

◆ m_mapping

template<class Matrix >
std::vector<std::size_t> shark::BlockMatrix2x2< Matrix >::m_mapping
protected

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