usearch 2.16.2 → 2.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -544,7 +544,7 @@ doi = {10.5281/zenodo.7949416},
544
544
  author = {Vardanian, Ash},
545
545
  title = {{USearch by Unum Cloud}},
546
546
  url = {https://github.com/unum-cloud/usearch},
547
- version = {2.16.2},
547
+ version = {2.16.3},
548
548
  year = {2023},
549
549
  month = oct,
550
550
  }
package/c/lib.cpp CHANGED
@@ -354,7 +354,7 @@ USEARCH_EXPORT void usearch_change_metric(usearch_index_t index, usearch_metric_
354
354
  USEARCH_ASSERT(index && error && "Missing arguments");
355
355
  auto& index_dense = *reinterpret_cast<index_dense_t*>(index);
356
356
  auto metric_punned =
357
- state ? metric_punned_t::stateful(reinterpret_cast<std::uintptr_t>(metric),
357
+ state ? metric_punned_t::stateful(index_dense.dimensions(), reinterpret_cast<std::uintptr_t>(metric),
358
358
  reinterpret_cast<std::uintptr_t>(state), metric_kind_to_cpp(kind),
359
359
  index_dense.scalar_kind())
360
360
  : metric_punned_t::stateless(index_dense.dimensions(), reinterpret_cast<std::uintptr_t>(metric),
@@ -9,7 +9,7 @@
9
9
 
10
10
  #define USEARCH_VERSION_MAJOR 2
11
11
  #define USEARCH_VERSION_MINOR 16
12
- #define USEARCH_VERSION_PATCH 2
12
+ #define USEARCH_VERSION_PATCH 3
13
13
 
14
14
  // Inferring C++ version
15
15
  // https://stackoverflow.com/a/61552074
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usearch",
3
- "version": "2.16.2",
3
+ "version": "2.16.3",
4
4
  "description": "Smaller & Faster Single-File Vector Search Engine from Unum",
5
5
  "author": "Ash Vardanian (https://ashvardanian.com/)",
6
6
  "license": "Apache 2.0",
Binary file
Binary file