Description
Extremely Fast Nearest Neighbor Search.
Description
Finds the k nearest neighbours for every point in a given dataset using Jose Luis' 'nanoflann' library. There is support for exact searches, fixed radius searches with 'kd' trees and two distances, the 'Euclidean' and 'Manhattan'. For more information see <https://github.com/jlblancoc/nanoflann>. Also, the 'nanoflann' library is exported and ready to be used via the linking to mechanism.
README.md
Rnanoflann
1. About
Rnanoflann is a wrapper for C++'s library nanoflan which performs nearest neighbors search using kd-trees.
2. Usage
You can use the exported Rnanoflann::nn
function or directly nanoflan via LinkignTo mechanism.
2.1. Rnanoflann
Rnanoflann export the function nn
that performs nearest neighbors search with options:
- data - An
M x d
matrix
where each of the M rows is a point. - points - An
N x d
matrix
that will be queried against data. d, the number of columns, must be the same as data. If missing, defaults to data. - parallel - uses omp library to perform parallel search for each point. Default is
FALSE
- cores - the cores that omp will use. Default is zero and it means to automatically compute the numbers of threads.
- search - the supported types are
standard
andradius
. - eps - Error bound. Default is
0.0
. - k - The maximum number of nearest neighbors to compute. The default value is set to the number of rows in data
2.2. LinkingTo
Add in Description in LinkingTo section the Rnanoflann and then:
- use nanoflann directly. Just
#include "nanoflann.hpp"
. Refer to nanoflan for more details. - use the
Rnanoflann::nn
viaC++
. Just#include "Rnanoflann.h"
. The available implemented function are useRcpp
andRcppArmadillo
. For custom matrices you need to implement you own adaptor (see above).