Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'
This commit is contained in:
35
vendor/ruvector/crates/rvlite/examples/env-polyfill.js
vendored
Normal file
35
vendor/ruvector/crates/rvlite/examples/env-polyfill.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// env-polyfill.js
|
||||
// Polyfill for WASM 'env' module imports
|
||||
// Provides JavaScript implementations of SimSIMD functions for browser WASM
|
||||
|
||||
/**
|
||||
* Cosine similarity between two f32 vectors
|
||||
* Returns similarity value (higher = more similar)
|
||||
*/
|
||||
export function simsimd_cos_f32(a_ptr, b_ptr, n, result_ptr, memory) {
|
||||
// This function is called with raw pointers - we need the WASM memory
|
||||
// The actual implementation happens in the calling code
|
||||
// Return 0 to indicate success
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dot product of two f32 vectors
|
||||
*/
|
||||
export function simsimd_dot_f32(a_ptr, b_ptr, n, result_ptr, memory) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* L2 squared distance between two f32 vectors
|
||||
*/
|
||||
export function simsimd_l2sq_f32(a_ptr, b_ptr, n, result_ptr, memory) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Default export for ES module compatibility
|
||||
export default {
|
||||
simsimd_cos_f32,
|
||||
simsimd_dot_f32,
|
||||
simsimd_l2sq_f32
|
||||
};
|
||||
Reference in New Issue
Block a user