STAG C++  2.0.0
Spectral Toolkit of Algorithms for Graphs
Loading...
Searching...
No Matches
stag::DataPoint Class Reference

#include <data.h>

Description

A data point in d-dimensional space.

A point is defined by its dimension, and a pointer to a C-style array of coordinates. This structure uses C arrays in order that the calling code can use any structure desired to store the underlying data.

The calling code is always responsible for the underlying data, and ensuring that for the life of the DataPoint object, the underlying data array does not move.

For example, the data can be stored in C++ vectors or an Eigen matrix.

Public Member Functions

 DataPoint (StagUInt d, StagReal *coords)
 
 DataPoint (DenseMat &all_data, StagInt row_index)
 
 DataPoint (std::vector< StagReal > &point_vector)
 
std::vector< StagRealto_vector ()
 

Public Attributes

StagUInt dimension
 
StagRealcoordinates
 

Constructor & Destructor Documentation

◆ DataPoint() [1/3]

stag::DataPoint::DataPoint ( StagUInt  d,
StagReal coords 
)
inline

Initialise a data point with an explicit dimension, and a pointer to the data array.

Parameters
dthe dimension of the data point
coordsa pointer to the array of coordinates

◆ DataPoint() [2/3]

stag::DataPoint::DataPoint ( DenseMat all_data,
StagInt  row_index 
)

Initialise a data point to point to a given row of a dense matrix.

Parameters
all_dataa dense matrix containing a full data set
row_indexthe index of the row containing this data point

◆ DataPoint() [3/3]

stag::DataPoint::DataPoint ( std::vector< StagReal > &  point_vector)
explicit

Initialise a data point to point to the data array of a given vector.

Parameters
point_vectora vector containing one data point.

Member Function Documentation

◆ to_vector()

std::vector< StagReal > stag::DataPoint::to_vector ( )

Convert the data point to a vector.

Returns
a vector of StagReal values

Member Data Documentation

◆ dimension

StagUInt stag::DataPoint::dimension

The dimension of the data point.

◆ coordinates

StagReal* stag::DataPoint::coordinates

A pointer to a C-style array containing the data point.