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

Function one_outlier_roundtrip

nodedb-codec/src/vector_quant/layout.rs:409–423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407
408 #[test]
409 fn one_outlier_roundtrip() {
410 // Bit 5 set → dim_index 5 is an outlier.
411 let bitmask: u64 = 1 << 5;
412 let header = make_header(QuantMode::Sq8, 64, bitmask);
413 let packed = vec![0u8; 64]; // 64 dims × 8bpw = 64 bytes
414 let outliers = [(5u32, 42.0f32)];
415 let vec = UnifiedQuantizedVector::new(header, &packed, &outliers).unwrap();
416
417 assert_eq!(vec.outlier_count(), 1);
418 let (dim, val) = vec.outlier_at(5).expect("bit 5 should be set");
419 assert_eq!(dim, 5);
420 assert!((val - 42.0).abs() < f32::EPSILON);
421 assert!(vec.outlier_at(0).is_none());
422 assert!(vec.outlier_at(6).is_none());
423 }
424
425 #[test]
426 fn eight_outliers_roundtrip() {

Callers

nothing calls this directly

Calls 3

outlier_atMethod · 0.80
make_headerFunction · 0.70
expectMethod · 0.45

Tested by

no test coverage detected