MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / dequantize

Function dequantize

src/utils/quantization.rs:13–21  ·  view source on GitHub ↗
(vec: &[u8; QUANTIZED_VECTOR_SIZE])

Source from the content-addressed store, hash-verified

11}
12
13pub fn dequantize(vec: &[u8; QUANTIZED_VECTOR_SIZE]) -> [f32; VECTOR_SIZE] {
14 let mut result = [0.0; VECTOR_SIZE];
15 for i in 0..QUANTIZED_VECTOR_SIZE {
16 for j in 0..8 {
17 result[i * 8 + j] = if (vec[i] & (1 << j)) > 0 { 1.0 } else { -1.0 };
18 }
19 }
20 result
21}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected