Skip to content

Expose usearch distance functions in C bindings#4

Merged
Ngalstyan4 merged 1 commit intopg-rebasefrom
feature/narek-expose-distance-funcs
Aug 11, 2023
Merged

Expose usearch distance functions in C bindings#4
Ngalstyan4 merged 1 commit intopg-rebasefrom
feature/narek-expose-distance-funcs

Conversation

@Ngalstyan4
Copy link
Copy Markdown
Owner

@Ngalstyan4 Ngalstyan4 commented Aug 11, 2023

This can then be used to directly used usearch's optimized distance functions.
Lantern example diff:

@@ -179,6 +179,7 @@ static float4 calc_distance(ArrayType *a, ArrayType *b)
     if(a_dim != b_dim) {
         elog(ERROR, "expected equally sized arrays but got arrays with dimensions %d and %d", a_dim, b_dim);
     }
+    return usearch_dist(ax, bx, usearch_metric_l2sq_k, a_dim, usearch_scalar_f32_k);

     return l2sq_dist_impl(ax, bx, a_dim);
 }

@Ngalstyan4 Ngalstyan4 merged commit 1ca8598 into pg-rebase Aug 11, 2023
@Ngalstyan4 Ngalstyan4 deleted the feature/narek-expose-distance-funcs branch August 11, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants