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

Function encode_positive_negative

nodedb-vector/src/quantize/binary.rs:94–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92
93 #[test]
94 fn encode_positive_negative() {
95 let v = [1.0, -1.0, 1.0, -1.0, 0.0, 1.0, -0.5, 0.5];
96 let bits = encode(&v);
97 assert_eq!(bits.len(), 1);
98 // bits[0]: dim0=1, dim1=0, dim2=1, dim3=0, dim4=0, dim5=1, dim6=0, dim7=1
99 // = 0b10100101 = 0xA5
100 assert_eq!(bits[0], 0b10100101);
101 }
102
103 #[test]
104 fn hamming_identical_is_zero() {

Callers

nothing calls this directly

Calls 1

encodeFunction · 0.70

Tested by

no test coverage detected