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

A simple matrix of observations. More...

#include <SimpleMatrix.hpp>

Inheritance diagram for kmeans::SimpleMatrix< Index_, Data_ >:
Collaboration diagram for kmeans::SimpleMatrix< Index_, Data_ >:

Public Member Functions

 SimpleMatrix (const std::size_t num_dimensions, const Index_ num_observations, const Data_ *const data)
 
Index_ num_observations () const
 
std::size_t num_dimensions () const
 
std::unique_ptr< RandomAccessExtractor< Index_, Data_ > > new_extractor () const
 
std::unique_ptr< ConsecutiveAccessExtractor< Index_, Data_ > > new_extractor (const Index_ start, const Index_ length) const
 
std::unique_ptr< IndexedAccessExtractor< Index_, Data_ > > new_extractor (const Index_ *sequence, const std::size_t length) const
 
auto new_known_extractor () const
 
auto new_known_extractor (const Index_ start, const Index_) const
 
auto new_known_extractor (const Index_ *sequence, const std::size_t) const
 
- Public Member Functions inherited from kmeans::Matrix< Index_, Data_ >
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
 

Friends

class SimpleMatrixRandomAccessExtractor< Index_, Data_ >
 
class SimpleMatrixConsecutiveAccessExtractor< Index_, Data_ >
 
class SimpleMatrixIndexedAccessExtractor< Index_, Data_ >
 

Detailed Description

template<typename Index_, typename Data_>
class kmeans::SimpleMatrix< Index_, Data_ >

A simple matrix of observations.

This defines a simple column-major matrix of observations where the columns are observations and the rows are dimensions.

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

Constructor & Destructor Documentation

◆ SimpleMatrix()

template<typename Index_ , typename Data_ >
kmeans::SimpleMatrix< Index_, Data_ >::SimpleMatrix ( const std::size_t num_dimensions,
const Index_ num_observations,
const Data_ *const data )
inline
Parameters
num_dimensionsNumber of dimensions.
num_observationsNumber of observations.
[in]dataPointer to an array of length equal to the product of num_dimensions and num_observations, containing a column-major matrix of observation data. It is expected that the array will not be deallocated during the lifetime of this SimpleMatrix instance.

Member Function Documentation

◆ new_extractor() [1/3]

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

Implements kmeans::Matrix< Index_, Data_ >.

◆ new_extractor() [2/3]

template<typename Index_ , typename Data_ >
std::unique_ptr< IndexedAccessExtractor< Index_, Data_ > > kmeans::SimpleMatrix< Index_, Data_ >::new_extractor ( const Index_ * sequence,
const std::size_t length ) const
inlinevirtual
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.

Implements kmeans::Matrix< Index_, Data_ >.

◆ new_extractor() [3/3]

template<typename Index_ , typename Data_ >
std::unique_ptr< ConsecutiveAccessExtractor< Index_, Data_ > > kmeans::SimpleMatrix< Index_, Data_ >::new_extractor ( const Index_ start,
const Index_ length ) const
inlinevirtual
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.

Implements kmeans::Matrix< Index_, Data_ >.

◆ new_known_extractor() [1/3]

template<typename Index_ , typename Data_ >
auto kmeans::SimpleMatrix< Index_, Data_ >::new_known_extractor ( ) const
inline

Override to assist devirtualization when creating a RandomAccessExtractor.

◆ new_known_extractor() [2/3]

template<typename Index_ , typename Data_ >
auto kmeans::SimpleMatrix< Index_, Data_ >::new_known_extractor ( const Index_ * sequence,
const std::size_t  ) const
inline

Override to assist devirtualization when creating a IndexedAccessExtractor.

◆ new_known_extractor() [3/3]

template<typename Index_ , typename Data_ >
auto kmeans::SimpleMatrix< Index_, Data_ >::new_known_extractor ( const Index_ start,
const Index_  ) const
inline

Override to assist devirtualization when creating a ConsecutiveAccessExtractor.

◆ num_dimensions()

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

Implements kmeans::Matrix< Index_, Data_ >.

◆ num_observations()

template<typename Index_ , typename Data_ >
Index_ kmeans::SimpleMatrix< Index_, Data_ >::num_observations ( ) const
inlinevirtual
Returns
Number of observations.

Implements kmeans::Matrix< Index_, Data_ >.


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