knncolle
Collection of KNN methods in C++
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
knncolle::MockMatrix Class Reference

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

#include <MockMatrix.hpp>

Classes

struct  Workspace
 Workspace for consecutive access to all 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
 
Workspace create_workspace () const
 
const data_typeget_observation (Workspace &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 Builder::build_raw(). 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.

◆ dimension_type

Integer type for the dimension indices. Any integer type may be used here.

◆ index_type

Type for the observation indices. Any integer type may be used here.

Member Function Documentation

◆ create_workspace()

Workspace knncolle::MockMatrix::create_workspace ( ) const
inline
Returns
A new consecutive-access workspace, to be passed to get_observation().

◆ get_observation()

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

For a newly created Workspace, the first call to get_observation() should return the coordinates of the first observation in the dataset; the next call should return the coordinates of the second observation; and so on, for up to num_observations() calls, after which the Workspace should no longer be used.

◆ num_dimensions()

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

◆ num_observations()

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

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