kmeans
A C++ library for k-means
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
kmeans::MockMatrix Class Reference

Compile-time interface for matrix data. More...

#include <MockMatrix.hpp>

Classes

struct  ConsecutiveAccessWorkspace
 Workspace for access to consecutive observations. More...
 
struct  IndexedAccessWorkspace
 Workspace for access to a indexed subset of observations. More...
 
struct  RandomAccessWorkspace
 Workspace for random access to observations. More...
 

Public Types

typedef double data_type
 
typedef int index_type
 
typedef int dimension_type
 

Public Member Functions

index_type num_observations () const
 
dimension_type num_dimensions () const
 
RandomAccessWorkspace create_workspace () const
 
ConsecutiveAccessWorkspace create_workspace (index_type start, index_type length) const
 
IndexedAccessWorkspace create_workspace (const index_type *sequence, index_type length) const
 
const data_typeget_observation (int i, RandomAccessWorkspace &workspace) const
 
const data_typeget_observation (ConsecutiveAccessWorkspace &workspace) const
 
const data_typeget_observation (IndexedAccessWorkspace &workspace) const
 

Detailed Description

Compile-time 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.

Member Typedef Documentation

◆ data_type

Type of the data. Any floating-point type may be used here. Note that this type is only used for data storage; all calculations are done using the Float_ type in Refine and Initialize.

◆ dimension_type

Integer type for the dimension indices. Any integer type may be used here, as long as it is large enough to hold the number of dimensions..

◆ index_type

Type for the observation indices. Any integer type may be used here, as long as it is large enough to hold the number of observations.

Member Function Documentation

◆ create_workspace() [1/3]

RandomAccessWorkspace kmeans::MockMatrix::create_workspace ( ) const
inline
Returns
A new random-access workspace, to be passed to get_observation().

◆ create_workspace() [2/3]

IndexedAccessWorkspace kmeans::MockMatrix::create_workspace ( const index_type sequence,
index_type  length 
) const
inline
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 IndexedAccessWorkspace.
lengthNumber of observations in sequence.
Returns
A new indexed-access workspace, to be passed to get_observation().

◆ create_workspace() [3/3]

ConsecutiveAccessWorkspace kmeans::MockMatrix::create_workspace ( index_type  start,
index_type  length 
) const
inline
Parameters
startStart of the contiguous block to be accessed consecutively.
lengthLength of the contiguous block to be accessed consecutively.
Returns
A new consecutive-access workspace, to be passed to get_observation().

◆ get_observation() [1/3]

const data_type * kmeans::MockMatrix::get_observation ( ConsecutiveAccessWorkspace workspace) const
inline
Parameters
workspaceConsecutive access workspace.
Returns
Pointer to an array of length equal to num_dimensions(), containing the coordinates for the next observation.

◆ get_observation() [2/3]

const data_type * kmeans::MockMatrix::get_observation ( IndexedAccessWorkspace workspace) const
inline
Parameters
workspaceIndexed access workspace.
Returns
Pointer to an array of length equal to num_dimensions(), containing the coordinates for the next observation in the sequence.

◆ get_observation() [3/3]

const data_type * kmeans::MockMatrix::get_observation ( int  i,
RandomAccessWorkspace workspace 
) const
inline
Parameters
iIndex of the observation .
workspaceRandom-access workspace.
Returns
Pointer to an array of length equal to num_dimensions(), containing the coordinates for observation i.

◆ num_dimensions()

dimension_type kmeans::MockMatrix::num_dimensions ( ) const
inline
Returns
Number of dimensions.

◆ num_observations()

index_type kmeans::MockMatrix::num_observations ( ) const
inline
Returns
Number of observations.

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