@@ -1767,20 +1767,22 @@ class metric_punned_t {
1767
1767
* @brief Creates a metric using the provided function pointer for a stateful metric.
1768
1768
* The third argument is the state that will be passed to the metric function.
1769
1769
*
1770
+ * @param dimensions The number of elements in the input arrays.
1770
1771
* @param metric_uintptr The function pointer to the metric function.
1771
1772
* @param metric_state The state to pass to the metric function.
1772
1773
* @param metric_kind The kind of metric to use.
1773
1774
* @param scalar_kind The kind of scalar to use.
1774
1775
* @return A metric object that can be used to compute distances between vectors.
1775
1776
*/
1776
- inline static metric_punned_t stateful (std::uintptr_t metric_uintptr, std::uintptr_t metric_state,
1777
- metric_kind_t metric_kind = metric_kind_t ::unknown_k,
1778
- scalar_kind_t scalar_kind = scalar_kind_t ::unknown_k) noexcept {
1777
+ inline static metric_punned_t stateful ( //
1778
+ std::size_t dimensions, std::uintptr_t metric_uintptr, std::uintptr_t metric_state,
1779
+ metric_kind_t metric_kind = metric_kind_t ::unknown_k,
1780
+ scalar_kind_t scalar_kind = scalar_kind_t ::unknown_k) noexcept {
1779
1781
metric_punned_t metric;
1780
1782
metric.metric_routed_ = &metric_punned_t ::invoke_array_array_third;
1781
1783
metric.metric_ptr_ = metric_uintptr;
1782
1784
metric.metric_third_arg_ = metric_state;
1783
- metric.dimensions_ = 0 ;
1785
+ metric.dimensions_ = dimensions ;
1784
1786
metric.metric_kind_ = metric_kind;
1785
1787
metric.scalar_kind_ = scalar_kind;
1786
1788
return metric;
@@ -2223,6 +2225,8 @@ template <typename allocator_at = std::allocator<char>> class kmeans_clustering_
2223
2225
scalar_kind_t original_scalar_kind, std::size_t dimensions, executor_at&& executor = executor_at{},
2224
2226
progress_at&& progress = progress_at{}) {
2225
2227
2228
+ (void )progress; // TODO
2229
+
2226
2230
// Perform sanity checks for algorithm settings.
2227
2231
kmeans_clustering_result_t result;
2228
2232
if (max_iterations < 1 )
@@ -2332,7 +2336,7 @@ template <typename allocator_at = std::allocator<char>> class kmeans_clustering_
2332
2336
2333
2337
// For every point, find the closest centroid.
2334
2338
std::atomic<std::size_t > points_shifted{0 };
2335
- executor.dynamic (points_count, [&](std::size_t thread_idx , std::size_t points_idx) {
2339
+ executor.dynamic (points_count, [&](std::size_t , std::size_t points_idx) {
2336
2340
byte_t const * quantized_point =
2337
2341
points_quantized_buffer.data () + points_idx * stride_per_vector_quantized;
2338
2342
byte_t const * quantized_centroids = centroids_quantized_buffer.data ();
0 commit comments