31 static_assert(std::is_same_v<T, float> || std::is_same_v<T, double>,
32 "centroidShift<T> requires T to be float or double");
39 const std::size_t k = cOld.
dim(0);
44 auto runRowRange = [&](std::size_t lo, std::size_t hi)
noexcept {
45 for (std::size_t c = lo; c < hi; ++c) {
52 ->submit_blocks(std::size_t{0}, k,
53 [&](std::size_t lo, std::size_t hi) { runRowRange(lo, hi); })
#define CLUSTERING_ALWAYS_ASSERT(cond)
Release-active assertion: evaluates cond in every build configuration.
Represents a multidimensional array (NDArray) of a fixed number of dimensions N and element type T.
size_t dim(std::size_t index) const noexcept
Returns the size of a specific dimension of the NDArray.
bool isMutable() const noexcept
Reports whether writes through operator(), Accessor, or flatIndex are allowed.
T sqEuclideanRow(const NDArray< T, 2, LX > &X, std::size_t i, const NDArray< T, 2, LY > &Y, std::size_t j) noexcept
void centroidShift(const NDArray< T, 2, Layout::Contig > &cOld, const NDArray< T, 2, Layout::Contig > &cNew, NDArray< T, 1 > &outShiftSq, Pool pool)
Per-row squared shift between two centroid matrices of identical shape.
Thin injection wrapper around a BS::light_thread_pool.
BS::light_thread_pool * pool
Underlying pool, or nullptr to force serial execution.
bool shouldParallelize(std::size_t totalWork, std::size_t minChunk, std::size_t minTasksPerWorker=2) const noexcept
Decide whether totalWork warrants parallel dispatch.