kmeans
k-means clustering in C++
Loading...
Searching...
No Matches
kmeans::Matrix< Index_, Data_ > Class Template Referenceabstract

Interface for matrix data. More...

#include <Matrix.hpp>

Inheritance diagram for kmeans::Matrix< Index_, Data_ >:

Public Member Functions

virtual Index_ num_observations () const =0
 
virtual std::size_t num_dimensions () const =0
 
virtual std::unique_ptr< RandomAccessExtractor< Index_, Data_ > > new_extractor () const =0
 
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 Index_, typename Data_>
class kmeans::Matrix< Index_, Data_ >

Interface for matrix data.

This defines the expectations for a matrix of observation-level data to be used in Initialize::run() and Refine::run(). Each matrix should support extraction of the vector of coordinates for each observation.

Template Parameters
Index_Integer type of the observation indices.
Data_Numeric type of the data.

Member Function Documentation

◆ new_extractor() [1/3]

template<typename Index_ , typename Data_ >
virtual std::unique_ptr< RandomAccessExtractor< Index_, Data_ > > kmeans::Matrix< Index_, Data_ >::new_extractor ( ) const
pure virtual
Returns
A new random-access extractor.

Implemented in kmeans::SimpleMatrix< Index_, Data_ >.

◆ new_extractor() [2/3]

template<typename Index_ , typename Data_ >
virtual std::unique_ptr< IndexedAccessExtractor< Index_, Data_ > > kmeans::Matrix< Index_, Data_ >::new_extractor ( const Index_ * sequence,
std::size_t length ) const
pure virtual
Parameters
[in]sequencePointer to an array of sorted and unique indices of observations, to be accessed in the provided order. It is assumed that the vector will not be deallocated before the destruction of the returned IndexedAccessExtractor.
lengthNumber of observations in sequence.
Returns
A new indexed-access extractor.

Implemented in kmeans::SimpleMatrix< Index_, Data_ >.

◆ new_extractor() [3/3]

template<typename Index_ , typename Data_ >
virtual std::unique_ptr< ConsecutiveAccessExtractor< Index_, Data_ > > kmeans::Matrix< Index_, Data_ >::new_extractor ( Index_ start,
Index_ length ) const
pure virtual
Parameters
startStart of the contiguous block of observations to be accessed consecutively.
lengthLength of the contiguous block of observations to be accessed consecutively.
Returns
A new consecutive-access extractor.

Implemented in kmeans::SimpleMatrix< Index_, Data_ >.

◆ new_known_extractor() [1/3]

template<typename Index_ , typename Data_ >
auto kmeans::Matrix< Index_, Data_ >::new_known_extractor ( ) const
inline
Returns
A new random-access extractor.

Subclasses may override this method to return a pointer to a specific RandomAccessExtractor subclass. This is used for devirtualization in other kmeans functions. If no override is provided, new_extractor() is called instead.

◆ new_known_extractor() [2/3]

template<typename Index_ , typename Data_ >
auto kmeans::Matrix< Index_, Data_ >::new_known_extractor ( const Index_ * sequence,
std::size_t length ) const
inline
Parameters
sequencePointer to a sorted and unique array of observations, see the equivalent new_extractor() overload.
lengthLength of the array, see the equivalent new_extractor() overload.
Returns
A new indexed-access extractor.

Subclasses may override this method to return a pointer to a specific IndexedAccessExtractor subclass. This is used for devirtualization in other kmeans functions. If no override is provided, the relevant new_extractor() overload is called instead.

◆ new_known_extractor() [3/3]

template<typename Index_ , typename Data_ >
auto kmeans::Matrix< Index_, Data_ >::new_known_extractor ( Index_ start,
Index_ length ) const
inline
Parameters
startStart of the contiguous block, see the equivalent new_extractor() overload.
lengthLength of the contiguous block, see the equivalent new_extractor() overload.
Returns
A new consecutive-access extractor.

Subclasses may override this method to return a pointer to a specific ConsecutiveAccessExtractor subclass. This is used for devirtualization in other kmeans functions. If no override is provided, the relevant new_extractor() overload is called instead.

◆ num_dimensions()

template<typename Index_ , typename Data_ >
virtual std::size_t kmeans::Matrix< Index_, Data_ >::num_dimensions ( ) const
pure virtual
Returns
Number of dimensions.

Implemented in kmeans::SimpleMatrix< Index_, Data_ >.

◆ num_observations()

template<typename Index_ , typename Data_ >
virtual Index_ kmeans::Matrix< Index_, Data_ >::num_observations ( ) const
pure virtual
Returns
Number of observations.

Implemented in kmeans::SimpleMatrix< Index_, Data_ >.


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