MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / bbq_dequantize

Function bbq_dequantize

nodedb-vector/src/rerank/codecs/bbq.rs:69–81  ·  view source on GitHub ↗
(packed: &[u8], residual_norm: f32, dim: usize)

Source from the content-addressed store, hash-verified

67/// `pack_signs`).
68#[inline]
69fn bbq_dequantize(packed: &[u8], residual_norm: f32, dim: usize) -> Vec<f32> {
70 let scale = if dim > 0 {
71 residual_norm / (dim as f32).sqrt()
72 } else {
73 0.0
74 };
75 (0..dim)
76 .map(|i| {
77 let bit = (packed[i / 8] >> (7 - (i % 8))) & 1;
78 if bit != 0 { scale } else { -scale }
79 })
80 .collect()
81}
82
83// ── BbqRerank ─────────────────────────────────────────────────────────────────
84

Callers 1

distance_preparedMethod · 0.85

Calls 1

collectMethod · 0.80

Tested by

no test coverage detected