Cluster centroids

Provides functions for computing the centroids of clusters.

Authors

Simone Balducci, Felice Pantaleo, Marco Rovere, Wahid Redjeb, Aurora Perego, Francesco Giacomini

namespace clue

Typedefs

template<std::size_t Ndim>
using Centroid = std::array<float, Ndim>

Type alias for a centroid in Ndim dimensions.

template<std::size_t Ndim>
using Centroids = std::vector<Centroid<Ndim>>

Type alias for a collection of centroids in Ndim dimensions.

Functions

template<std::size_t Ndim>
inline Centroid<Ndim> cluster_centroid(const clue::PointsHost<Ndim> &points, std::size_t cluster_id)

Compute the centroid of a specific cluster from the given Points.

Template Parameters:
std::size_t Ndim

The number of dimensions of the points

Parameters:
const clue::PointsHost<Ndim> &points

The PointsHost object containing the points

std::size_t cluster_id

The ID of the cluster for which to compute the centroid

Returns:

The centroid of the specified cluster as an array of floats

template<std::size_t Ndim>
inline Centroids<Ndim> cluster_centroids(const clue::PointsHost<Ndim> &points)

Compute the centroids of all clusters from the given Points.

Template Parameters:
std::size_t Ndim

The number of dimensions of the points

Parameters:
const clue::PointsHost<Ndim> &points

The PointsHost object containing the points

Returns:

A vector of centroids, one for each cluster