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

Function raw_roundtrip

nodedb-codec/src/spherical.rs:299–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

297
298 #[test]
299 fn raw_roundtrip() {
300 let data: Vec<f32> = (0..320).map(|i| i as f32 * 0.01).collect();
301 let encoded = encode_raw(&data, 32, 10).unwrap();
302 let (decoded, dims, vectors) = decode(&encoded).unwrap();
303 assert_eq!(dims, 32);
304 assert_eq!(vectors, 10);
305 for (a, b) in data.iter().zip(decoded.iter()) {
306 assert_eq!(a.to_bits(), b.to_bits());
307 }
308 }
309
310 #[test]
311 fn compression_ratio() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
encode_rawFunction · 0.70
decodeFunction · 0.70
iterMethod · 0.45

Tested by

no test coverage detected