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

Method quantize

src/models/usv_index.rs:241–245  ·  view source on GitHub ↗
(&self, value: f32, values_upper_bound: f32)

Source from the content-addressed store, hash-verified

239 }
240
241 pub fn quantize(&self, value: f32, values_upper_bound: f32) -> u8 {
242 let quantization = ((1u32 << self.quantization_bits) - 1) as u8;
243 let max_val = quantization as f32;
244 (((value / values_upper_bound) * max_val).clamp(0.0, max_val) as u8).min(quantization)
245 }
246
247 pub fn insert(
248 &self,

Callers 9

create_root_nodeFunction · 0.45
create_pseudo_root_nodeFunction · 0.45
preprocess_embeddingFunction · 0.45
delete_embeddingFunction · 0.45
search_internalMethod · 0.45
sequential_searchMethod · 0.45
usv_searchMethod · 0.45
insertMethod · 0.45
deleteMethod · 0.45

Calls 1

minMethod · 0.80

Tested by

no test coverage detected