using Cloud.Unum.USearch;
DenseOptions options = DenseOptions.Default with // Angular metric, BF16 quantization
{
Metric = DenseMetric.Angular, // Or Inner, Euclidean, Hamming, Jaccard
Quantization = Scalar.BF16, // Or F16, E5M2, E4M3, E3M2, E2M3, I8, U8, U1x8
Dimensions = 3, // Frozen at init; zero is refused
Connectivity = 16, // Connections per node in the graph, optional
ValuesPerKey = 1, // Upper bound on entries sharing one key, optional
};
using DenseIndex index = DenseIndex.InitRam(options);
index.Reserve(1_000); // Optional capacity hint; inserts grow on demand
Key[] keys = [42UL];
float[] vector = [0.2f, 0.6f, 0.4f];
index.Insert(keys, RowsView.RowsOf<float>(vector, dimensions: 3)); // On the caller's thread
using Executor pool = Executor.ForRam(); // The threads a receiver names
using Arena arena = new(pool); // Where outputs land, reused
Matches found = index.On(pool).Search(RowsView.RowsOf<float>(vector, 3), wanted: 10, arena); // The same verb, on the pool
Key nearest = found[0].Keys[0]; // 00000000-0000-0000-0000-00000000002a
double distance = found[0].Distances[0];