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

Function make_codec

nodedb-vector/src/quantize/sq8_codec.rs:116–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114 use super::*;
115
116 fn make_codec() -> Sq8Codec {
117 let vecs: Vec<Vec<f32>> = (0..50)
118 .map(|i| vec![i as f32 * 0.1, -(i as f32) * 0.05, 1.0 + i as f32 * 0.02])
119 .collect();
120 let refs: Vec<&[f32]> = vecs.iter().map(|v| v.as_slice()).collect();
121 Sq8Codec::calibrate(&refs, 3)
122 }
123
124 /// `encode` round-trip: packed_bits in the UQV must match the raw
125 /// `quantize` output from the underlying codec.

Calls 3

collectMethod · 0.80
iterMethod · 0.45
as_sliceMethod · 0.45