
Generate a GPU-accelerated kNN graph
rs_gpu_knn.Rd
Builds a kNN graph from an embedding matrix on the GPU. Four searches are
available: an exact brute-force scan, an IVF index that probes a subset of
Voronoi cells, the NN-descent kNN graph itself (no index, no search), and a
CAGRA graph pruned from the NN-descent build and beam searched. Rows the
descent left short are topped up with an exact search of only those rows.
Euclidean distances come back as true L2, not squared.
Arguments
- embd
Numeric matrix of embeddings, cells x features.
- k
Integer. Number of neighbours to return, self excluded.
- knn_method
String. One of
c("nndescent", "cagra", "exhaustive", "ivf").- nn_params
A named list with the parameters, see
params_nn_gpu()- seed
Integer. Random seed for reproducibility.
- backend
String.
"wgpu"or"mlx"(Apple Silicon, needs a build with the MLX backend, seemlx_available()).- verbose
Integer.
0L- quiet;1L- normal verbosity;2L- detailed verbosity.