kmeans_tatami
tatami wrappers for k-means clustering
Loading...
Searching...
No Matches
kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ > Class Template Referencefinal

kmeans-compatible wrapper around a tatami matrix. More...

#include <kmeans_tatami.hpp>

Inheritance diagram for kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >:
Collaboration diagram for kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >:

Public Member Functions

 Matrix (MatrixPointer_ matrix, bool transposed=false)
 
KIndex_ num_observations () const
 
std::size_t num_dimensions () const
 
std::unique_ptr< kmeans::RandomAccessExtractor< KIndex_, KData_ > > new_extractor () const
 
std::unique_ptr< kmeans::ConsecutiveAccessExtractor< KIndex_, KData_ > > new_extractor (KIndex_ start, KIndex_ length) const
 
std::unique_ptr< kmeans::IndexedAccessExtractor< KIndex_, KData_ > > new_extractor (const KIndex_ *sequence, std::size_t length) const
 
- Public Member Functions inherited from kmeans::Matrix< KIndex_, KData_ >
virtual std::unique_ptr< ConsecutiveAccessExtractor< Index_, Data_ > > new_extractor (Index_ start, Index_ length) const =0
 
virtual std::unique_ptr< IndexedAccessExtractor< Index_, Data_ > > new_extractor (const Index_ *sequence, std::size_t length) const =0
 
auto new_known_extractor () const
 
auto new_known_extractor (Index_ start, Index_ length) const
 
auto new_known_extractor (const Index_ *sequence, std::size_t length) const
 

Detailed Description

template<typename KIndex_, typename KData_, typename TValue_, typename TIndex_, class MatrixPointer_ = std::shared_ptr<const tatami::Matrix<TValue_, TIndex_> >>
class kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >

kmeans-compatible wrapper around a tatami matrix.

Template Parameters
KIndex_Integer type of observation indices for kmeans.
KData_Numeric type of the data for kmeans.
TValue_Numeric type of matrix values for tatami.
TIndex_Integer type of the row/column indices for tatami.
Matrix_Pointer to an instance to a tatami::Matrix or one of its subclasses. This may be a raw or smart pointer.

Pretty much as it says on the tin - implements a kmeans::Matrix subclass to wrap a tatami::Matrix. The idea is to enable the use of arbitrary tatami matrix representations in kmeans functions, e.g., to support clustering from a file-backed matrix.

Constructor & Destructor Documentation

◆ Matrix()

template<typename KIndex_ , typename KData_ , typename TValue_ , typename TIndex_ , class MatrixPointer_ = std::shared_ptr<const tatami::Matrix<TValue_, TIndex_> >>
kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >::Matrix ( MatrixPointer_ matrix,
bool transposed = false )
inline
Parameters
matrixRaw or smart pointer to a tatami::Matrix.
transposedWhether to transpose the matrix during extraction in kmeans functions. If true, new_extractor() will extract rows instead of columns.

Member Function Documentation

◆ new_extractor()

template<typename KIndex_ , typename KData_ , typename TValue_ , typename TIndex_ , class MatrixPointer_ = std::shared_ptr<const tatami::Matrix<TValue_, TIndex_> >>
std::unique_ptr< kmeans::RandomAccessExtractor< KIndex_, KData_ > > kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >::new_extractor ( ) const
inlinevirtual

◆ num_dimensions()

template<typename KIndex_ , typename KData_ , typename TValue_ , typename TIndex_ , class MatrixPointer_ = std::shared_ptr<const tatami::Matrix<TValue_, TIndex_> >>
std::size_t kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >::num_dimensions ( ) const
inlinevirtual

◆ num_observations()

template<typename KIndex_ , typename KData_ , typename TValue_ , typename TIndex_ , class MatrixPointer_ = std::shared_ptr<const tatami::Matrix<TValue_, TIndex_> >>
KIndex_ kmeans_tatami::Matrix< KIndex_, KData_, TValue_, TIndex_, MatrixPointer_ >::num_observations ( ) const
inlinevirtual

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