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

Function scientific_data

nodedb-codec/src/alp_rd.rs:279–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277
278 #[test]
279 fn scientific_data() {
280 let values: Vec<f64> = (0..1000).map(|i| (i as f64 * 0.001).exp()).collect();
281 let encoded = encode(&values).unwrap();
282 let decoded = decode(&encoded).unwrap();
283 for (i, (a, b)) in values.iter().zip(decoded.iter()).enumerate() {
284 assert_eq!(a.to_bits(), b.to_bits(), "mismatch at {i}");
285 }
286 }
287
288 #[test]
289 fn compression_ratio() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
encodeFunction · 0.70
decodeFunction · 0.70
iterMethod · 0.45

Tested by

no test coverage detected