MCPcopy Create free account
hub / github.com/cosdata/cosdata / compute_vector_hash

Function compute_vector_hash

org/src/cluster_hierarchy.rs:400–409  ·  view source on GitHub ↗

Add this function somewhere with the other utility functions

(vector: &Vector)

Source from the content-addressed store, hash-verified

398}
399// Add this function somewhere with the other utility functions
400fn compute_vector_hash(vector: &Vector) -> u64 {
401 use std::collections::hash_map::DefaultHasher;
402 use std::hash::{Hash, Hasher};
403
404 let mut hasher = DefaultHasher::new();
405 for val in vector {
406 val.to_bits().hash(&mut hasher); // Convert f64 to bits before hashing
407 }
408 hasher.finish()
409}
410fn main() {
411 let n_base_vectors = 200;
412 let n_perturbations = 50;

Callers 1

mainFunction · 0.85

Calls 1

hashMethod · 0.80

Tested by

no test coverage detected