Clusterer¶
-
template<std::size_t Ndim>
class Clusterer¶ The Clusterer class is the interface for running the clustering algorithm. It provides methods to set up the clustering parameters, initializes the internal buffers and runs the clustering algorithm on host or device points.
Public Functions¶
-
Clusterer(DistanceParameter<Ndim> dc, float rhoc, DistanceParameter<Ndim> dm = -1.f, DistanceParameter<Ndim> seed_dc = -1.f, int pPBin = 128)¶
Constuct a Clusterer object.
- Parameters:¶
- DistanceParameter<Ndim> dc¶
Distance threshold for clustering. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- float rhoc¶
Density threshold for clustering
- DistanceParameter<Ndim> dm = -1.f¶
Minimum distance between clusters. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- DistanceParameter<Ndim> seed_dc = -1.f¶
Distance threshold for seed points, if -1.f, dc is used. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- int pPBin = 128¶
Number of points per bin, used to determine the tile size
-
Clusterer(Queue &queue, DistanceParameter<Ndim> dc, float rhoc, DistanceParameter<Ndim> dm = -1.f, DistanceParameter<Ndim> seed_dc = -1.f, int pPBin = 128)¶
Constuct a Clusterer object.
- Parameters:¶
- Queue &queue¶
The queue to use for the device operations
- DistanceParameter<Ndim> dc¶
Distance threshold for clustering. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- float rhoc¶
Density threshold for clustering
- DistanceParameter<Ndim> dm = -1.f¶
Minimum distance between clusters. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- DistanceParameter<Ndim> seed_dc = -1.f¶
Distance threshold for seed points, if the default value -1.f, dc is used. This parameter can be a single float or an array of floats specifying the distance threshold for each dimension.
- int pPBin = 128¶
Number of points per bin, used to determine the tile size
-
void setParameters(DistanceParameter<Ndim> dc, float rhoc, DistanceParameter<Ndim> dm = -1.f, DistanceParameter<Ndim> seed_dc = -1.f, int pPBin = 128)¶
Set the parameters for the clustering algorithm.
- Parameters:¶
- DistanceParameter<Ndim> dc¶
Distance threshold for clustering
- float rhoc¶
Density threshold for clustering
- DistanceParameter<Ndim> dm = -1.f¶
Minimum distance between clusters
- DistanceParameter<Ndim> seed_dc = -1.f¶
Distance threshold for seed points, if the defualt value -1.f, dc is used
- int pPBin = 128¶
Number of points per bin, used to determine the tile size
-
template<concepts::convolutional_kernel Kernel = FlatKernel>
void make_clusters(Queue &queue, PointsHost &h_points, const Kernel &kernel = FlatKernel{.5f}, std::size_t block_size = 256)¶ Construct the clusters from host points.
- Parameters:¶
- Queue &queue¶
The queue to use for the device operations
- PointsHost &h_points¶
Host points to cluster
- const Kernel &kernel = FlatKernel{.5f}¶
The convolutional kernel to use for computing the local densities, default is FlatKernel with height 0.5
- std::size_t block_size = 256¶
The size of the blocks to use for clustering, default is 256
-
template<concepts::convolutional_kernel Kernel = FlatKernel>
void make_clusters(PointsHost &h_points, const Kernel &kernel = FlatKernel{.5f}, std::size_t block_size = 256)¶ Construct the clusters from host points.
Note
This method creates a temporary queue for the operations on the device
- Parameters:¶
- PointsHost &h_points¶
Host points to cluster
- const Kernel &kernel = FlatKernel{.5f}¶
The convolutional kernel to use for computing the local densities, default is FlatKernel with height 0.5
- std::size_t block_size = 256¶
The size of the blocks to use for clustering, default is 256
-
template<concepts::convolutional_kernel Kernel = FlatKernel>
void make_clusters(Queue &queue, PointsHost &h_points, PointsDevice &dev_points, const Kernel &kernel = FlatKernel{.5f}, std::size_t block_size = 256)¶ Construct the clusters from host and device points.
- Parameters:¶
- Queue &queue¶
The queue to use for the device operations
- PointsHost &h_points¶
Host points to cluster
- PointsDevice &dev_points¶
Device points to cluster
- const Kernel &kernel = FlatKernel{.5f}¶
The convolutional kernel to use for computing the local densities, default is FlatKernel with height 0.5
- std::size_t block_size = 256¶
The size of the blocks to use for clustering, default is 256
-
template<concepts::convolutional_kernel Kernel = FlatKernel>
void make_clusters(Queue &queue, PointsDevice &dev_points, const Kernel &kernel = FlatKernel{.5f}, std::size_t block_size = 256)¶ Construct the clusters from device points.
- Parameters:¶
- Queue &queue¶
The queue to use for the device operations
- PointsDevice &dev_points¶
Device points to cluster
- const Kernel &kernel = FlatKernel{.5f}¶
The convolutional kernel to use for computing the local densities, default is FlatKernel with height 0.5
- std::size_t block_size = 256¶
The size of the blocks to use for clustering, default is 256
-
template<std::ranges::contiguous_range TRange>
void setWrappedCoordinates(const TRange &wrapped_coordinates)¶ Specify which coordinates are periodic.
- Parameters:¶
- wrappedCoordinates
Array of wrapped coordinates, where 1 means periodic and 0 means non-periodic
-
template<std::integral... TArgs>
void setWrappedCoordinates(TArgs... wrapped_coordinates)¶ Specify which coordinates are periodic.
-
host_associator getClusters(const PointsHost &h_points)¶
Get the clusters from the host points.
- Parameters:¶
- const PointsHost &h_points¶
Host points
- Returns:¶
An associator mapping clusters and points
-
AssociationMap<Device> getClusters(Queue &queue, const PointsDevice &d_points)¶
Get the clusters from the device points This function returns an associator object mapping the clusters to the points they contain.
- Parameters:¶
- const PointsDevice &d_points¶
Device points
- Returns:¶
An associator mapping clusters and points
-
Clusterer(DistanceParameter<Ndim> dc, float rhoc, DistanceParameter<Ndim> dm = -1.f, DistanceParameter<Ndim> seed_dc = -1.f, int pPBin = 128)¶