Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
greedy_kmpp_seeder.h File Reference
#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <type_traits>
#include <vector>
#include "clustering/always_assert.h"
#include "clustering/math/detail/avx2_helpers.h"
#include "clustering/math/detail/gemm_outer.h"
#include "clustering/math/detail/inverse_cdf_blocks.h"
#include "clustering/math/detail/matrix_desc.h"
#include "clustering/math/detail/sq_distances_block.h"
#include "clustering/math/pairwise.h"
#include "clustering/math/rng.h"
#include "clustering/math/thread.h"
#include "clustering/ndarray.h"
#include <immintrin.h>
#include "clustering/math/detail/kmpp_score_avx2.h"
Include dependency graph for greedy_kmpp_seeder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  clustering::kmeans::GreedyKmppSeeder< T >
 Greedy k-means++ seeder. More...

Namespaces

namespace  clustering
namespace  clustering::kmeans
namespace  clustering::kmeans::detail

Functions

std::size_t clustering::kmeans::detail::greedyKmppLocalTrials (std::size_t k) noexcept
 Compute the local-trials count used by greedy k-means++.
constexpr std::size_t clustering::kmeans::detail::greedyKmppTransposedWidth (std::size_t L) noexcept
 Round L up to the nearest multiple of 8 used by the transposed scoring layout.
std::size_t clustering::kmeans::detail::greedyKmppSweepBlocks (math::Pool pool, std::size_t rows, std::size_t opsPerRow) noexcept
 Fan-out width for one of the seeder's per-round O(n*d) sweeps.
template<std::size_t B>
void clustering::kmeans::detail::sqEuclideanRowToBatchAvx2Fixed (const float *x, const float *candData, std::size_t d, float *out) noexcept
 Compile-time batched scoring kernel: stream x once across B parallel AVX2 accumulators to compute B squared distances against candData rows.
template<std::size_t B>
void clustering::kmeans::detail::sqEuclideanRowToBatchAvx2Fixed (const double *x, const double *candData, std::size_t d, double *out) noexcept
template<class T>
void clustering::kmeans::detail::sqEuclideanRowToBatchAvx2 (const T *x, const T *candData, std::size_t L, std::size_t d, T *out) noexcept
 Compute L squared Euclidean distances against an (L, d) row-batched candidate layout in a single streaming pass over the x row.
void clustering::kmeans::detail::sqEuclideanRowAgainst8Transposed (const float *x, const float *candData, std::size_t d, float *out) noexcept
 Compute L squared distances against an (d, 8) transposed candidate layout with one streaming pass over the x row.
__m256 clustering::kmeans::detail::sqEuclideanRowAgainst8TransposedReg (const float *x, const float *candData, std::size_t d) noexcept
 Register-only variant of sqEuclideanRowAgainst8Transposed.
std::pair< __m256, __m256 > clustering::kmeans::detail::sqEuclideanRowAgainst16TransposedReg (const float *x, const float *candData, std::size_t d) noexcept
 Register-only 16-wide variant of sqEuclideanRowAgainst16Transposed.
void clustering::kmeans::detail::sqEuclideanRowAgainst16Transposed (const float *x, const float *candData, std::size_t d, float *out) noexcept
 Compute two 8-way squared distance slabs against an (d, 16) transposed candidate layout in one streaming pass over the x row.
void clustering::kmeans::detail::sqEuclideanRowAgainst8TransposedStrided (const float *x, const float *candData, std::size_t d, std::size_t rowStride, float *out) noexcept
 Compute one 8-way squared distance slab against an (d, W) transposed candidate layout with an explicit row stride W.
template<class T>
void clustering::kmeans::detail::sqEuclideanRowToBatch (const T *x, const T *candData, std::size_t L, std::size_t d, T *out) noexcept
 Squared Euclidean distance from one x row to a batch of L candidate rows.