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 +1 -1
- package/c/lib.cpp +1 -1
- package/include/usearch/index.hpp +1 -1
- package/include/usearch/index_plugins.hpp +9 -5
- package/package.json +1 -1
- package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
- package/prebuilds/linux-arm64/usearch.node +0 -0
- package/prebuilds/linux-x64/usearch.node +0 -0
package/README.md
CHANGED
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),
|
|
@@ -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(
|
|
1777
|
-
|
|
1778
|
-
|
|
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_ =
|
|
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
|
|
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
|
Binary file
|
|
Binary file
|
|
Binary file
|