-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Euclidean distance example #315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @abner-ma! Just a couple brief and minor things. Overall, contributions like this are very welcome!
@@ -0,0 +1,105 @@ | |||
#include <cuvs/core/c_api.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need the copyright here. You can copy this over from other files.
examples/c/src/L2_c_example.c
Outdated
} | ||
/* Ended by AICoder, pid:96cd0bcb6ad27b1149870b5f20ef16170f62a328 */ | ||
|
||
int calcL2Distance(int64_t n_cols,float x[], float y[], float *ret) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide some docs in this file, that briefly describe what the different steps are doing? Bonus points for function-level descriptions also (though not required).
examples/c/src/L2_c_example.c
Outdated
|
||
int initResources(void){ | ||
// Create a cuvsResources_t object | ||
cuvsResourcesCreate(&res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are one-liners anyways, it reduces the size of the code and clarity of the example to keep these inline in the example. Another small nitpick: we have intentionally named the C API functions consistently- cuvsNounVerb
and changing that to verbNoun
breaks this consistently. I'd keep initializeTensor
below but rename it to tensor_initialize
just to separate the casing from the C API. I'd also rename calcL2Distance
to l2_distance_calc
/ok to test |
Modified in accordance with review comments
examples/c/src/L2_c_example.c
Outdated
@@ -0,0 +1,123 @@ | |||
/* | |||
* Copyright (c) 2022-2024, NVIDIA CORPORATION. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please only use the current year for new files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
/ok to test |
/merge |
Add euclidean distance calculation example in c.