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

Function sign_unpack

nodedb-codec/src/vector_quant/rabitq.rs:102–112  ·  view source on GitHub ↗

Dequantize sign-packed bits back to ±1 values (for dot_quantized calc).

(packed: &[u8], dim: usize)

Source from the content-addressed store, hash-verified

100
101/// Dequantize sign-packed bits back to ±1 values (for dot_quantized calc).
102fn sign_unpack(packed: &[u8], dim: usize) -> Vec<f32> {
103 (0..dim)
104 .map(|i| {
105 if packed[i / 8] & (1 << (i % 8)) != 0 {
106 -1.0f32
107 } else {
108 1.0f32
109 }
110 })
111 .collect()
112}
113
114// ── RaBitQCodec ──────────────────────────────────────────────────────────────
115

Callers 1

encode_innerMethod · 0.85

Calls 1

collectMethod · 0.80

Tested by

no test coverage detected