Find K nearest neighbours for multiple query points
knn_parallel(data, query = data, k, ..., ncores = bigparallelr::nb_cores())
Mxd matrix of M target points with dimension d
Nxd matrix of N query points with dimension d (nb data
and query
must have same dimension). If missing defaults to
data
i.e. a self-query.
an integer number of nearest neighbours to find
Arguments passed on to nabor::knn
eps
An approximate error bound. The default of 0 implies exact matching.
searchtype
A character vector or integer indicating the search type.
The default value of 1L
is equivalent to "auto". See details.
radius
Maximum radius search bound. The default of 0 implies no radius bound.
Number of cores to use. Default uses bigparallelr::nb_cores()
.
A list with elements nn.idx
(1-indexed indices) and
nn.dists
(distances), both of which are N x k matrices. See details
for the results obtained with1 invalid inputs.
if (FALSE) knn_parallel(matrix(1:4, 2), k = 2, ncores = 2)