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

Function make_clustered_data

nodedb-vector/src/quantize/pq.rs:375–390  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

373 use super::*;
374
375 fn make_clustered_data() -> Vec<Vec<f32>> {
376 // 4 clusters in 4D space, 50 points each.
377 let mut vecs = Vec::new();
378 for cluster in 0..4 {
379 let center = cluster as f32 * 10.0;
380 for i in 0..50 {
381 vecs.push(vec![
382 center + (i as f32) * 0.1,
383 center + (i as f32) * 0.05,
384 center - (i as f32) * 0.1,
385 center + (i as f32) * 0.02,
386 ]);
387 }
388 }
389 vecs
390 }
391
392 #[test]
393 fn encode_decode_roundtrip() {

Callers 4

encode_decode_roundtripFunction · 0.85
batch_encodeFunction · 0.85
pq_codec_golden_formatFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by 4

encode_decode_roundtripFunction · 0.68
batch_encodeFunction · 0.68
pq_codec_golden_formatFunction · 0.68