Kernel Quantum Probability Library
The KQP library aims at providing tools for working with quantums probabilities
Public Types | Public Member Functions
kqp::Sparse< Scalar > Class Template Reference

A feature matrix where vectors are sparse vectors in a high dimensional space. More...

#include <sparse.hpp>

Inheritance diagram for kqp::Sparse< Scalar >:
kqp::FeatureMatrixBase< Scalar >

Public Types

typedef Sparse< Scalar > Self
 
typedef Eigen::SparseMatrix
< Scalar, Eigen::ColMajor > 
Storage
 

Public Member Functions

 KQP_SCALAR_TYPEDEFS (Scalar)
 
 Sparse (Index dimension)
 
 Sparse (const Self &other)
 
 Sparse (Storage &&storage)
 
 Sparse (Self &&other)
 
 Sparse (const ScalarMatrix &mat, double threshold=0)
 
 Sparse (const Storage &storage)
 
 Sparse (const Eigen::SparseMatrix< Scalar, Eigen::RowMajor > &storage)
 
ScalarMatrix toDense ()
 
Index size () const
 
Index dimension () const
 
void add (const FMatrixBase &_other, const std::vector< bool > *which=NULL) override
 
const ScalarMatrix & gramMatrix () const
 
FMatrixBasePtr subset (const std::vector< bool >::const_iterator &begin, const std::vector< bool >::const_iterator &end) const override
 Reduces the feature matrix to a subset of its vectors.
 
FMatrixBasePtr copy () const override
 
const Storage * operator-> () const
 Direct access to underlying matrix.
 
const Storage & operator* () const
 
FMatrixBase & operator= (const Self &other)
 
virtual FMatrixBase & operator= (const FMatrixBase &other) override
 
const Storage & getMatrix () const
 Get the dense matrix.
 
- Public Member Functions inherited from kqp::FeatureMatrixBase< Scalar >
 KQP_SCALAR_TYPEDEFS (Scalar)
 
FMatrixPtr subset (const std::vector< bool > &list) const
 Reduces the feature matrix to a subset of its vectors.
 
virtual FMatrixBase & operator= (const FeatureMatrixBase< Scalar > &other)=0
 
template<typename T >
const T & as () const
 
template<typename T >
T & as ()
 
void add (const FMatrixCPtr &f, const std::vector< bool > *which=NULL)
 

Detailed Description

template<typename Scalar>
class kqp::Sparse< Scalar >

A feature matrix where vectors are sparse vectors in a high dimensional space.

This class makes the hypothesis that vectors have only a few non null components (compared to the dimensionality of the space).

Member Function Documentation

template<typename Scalar >
void kqp::Sparse< Scalar >::add ( const FMatrixBase &  f,
const std::vector< bool > *  which = NULL 
)
inlineoverridevirtual

Add pre-images vectors

Implements kqp::FeatureMatrixBase< Scalar >.

template<typename Scalar >
FMatrixBasePtr kqp::Sparse< Scalar >::copy ( ) const
inlineoverridevirtual
template<typename Scalar >
Index kqp::Sparse< Scalar >::size ( ) const
inlinevirtual

Number of pre-image vectors

Implements kqp::FeatureMatrixBase< Scalar >.

template<typename Scalar >
FMatrixBasePtr kqp::Sparse< Scalar >::subset ( const std::vector< bool >::const_iterator &  begin,
const std::vector< bool >::const_iterator &  end 
) const
inlineoverridevirtual

Reduces the feature matrix to a subset of its vectors.

The list of indices is supposed to be ordered.

Parameters
beginBeginning of the list of indices
endEnd of the list of indices

Implements kqp::FeatureMatrixBase< Scalar >.


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