Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
pairwise_argmin.h File Reference
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include "clustering/always_assert.h"
#include "clustering/math/defaults.h"
#include "clustering/math/detail/pairwise_argmin_outer.h"
#include "clustering/math/pairwise.h"
#include "clustering/math/thread.h"
#include "clustering/ndarray.h"
Include dependency graph for pairwise_argmin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  clustering
namespace  clustering::math
namespace  clustering::math::detail

Enumerations

enum class  clustering::math::detail::ArgminPath : std::uint8_t { clustering::math::detail::Fused , clustering::math::detail::Materialized }
 Tag identifying which outer driver executed for a pairwiseArgminSqEuclidean request. More...

Functions

std::array< std::size_t, 2 > clustering::math::chunkedMaterializedScratchShape (std::size_t n, std::size_t k) noexcept
 Required shape for the chunked materialized argmin scratch buffer.
template<class T, Layout LX, Layout LC>
void clustering::math::detail::pairwiseArgminMaterializedWithScratch (const NDArray< T, 2, LX > &X, const NDArray< T, 2, LC > &C, NDArray< std::int32_t, 1 > &labels, NDArray< T, 1 > &outMinSq, NDArray< T, 2 > &distsScratch, Pool pool)
 Compute per-row argmin + minimum squared distance over n in 256-row strips using a caller-owned distance tile.
template<class T, Layout LX, Layout LC>
void clustering::math::detail::pairwiseArgminMaterialized (const NDArray< T, 2, LX > &X, const NDArray< T, 2, LC > &C, NDArray< std::int32_t, 1 > &labels, NDArray< T, 1 > &outMinSq, Pool pool)
 Compute per-row argmin and minimum squared distance via the materialized two-step.
template<class T, Layout LX, Layout LC>
bool clustering::math::detail::canUseFusedArgmin (const NDArray< T, 2, LX > &X, const NDArray< T, 2, LC > &C, const NDArray< T, 1 > &cSqNorms) noexcept
 Runtime predicate: true when the fused AVX2 path is eligible for this call.
template<class T, Layout LX = Layout::Contig, Layout LC = Layout::Contig>
void clustering::math::pairwiseArgminSqEuclidean (const NDArray< T, 2, LX > &X, const NDArray< T, 2, LC > &C, const NDArray< T, 1 > &cSqNorms, NDArray< std::int32_t, 1 > &labels, NDArray< T, 1 > &outMinDistSq, Pool pool)
 Per-row argmin and minimum squared distance of rows of X against rows of C.
template<class T, Layout LX = Layout::Contig, Layout LC = Layout::Contig>
ArgminPath clustering::math::detail::pairwiseArgminSqEuclideanWithDispatchInfo (const NDArray< T, 2, LX > &X, const NDArray< T, 2, LC > &C, const NDArray< T, 1 > &cSqNorms, NDArray< std::int32_t, 1 > &labels, NDArray< T, 1 > &outMinDistSq, Pool pool)
 Test-only: runs the same dispatch as pairwiseArgminSqEuclidean and reports which outer driver fired.

Variables

constexpr std::size_t clustering::math::pairwiseArgminChunkRows = 256
 Chunk height used by the materialized argmin path when striping over n.