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 dmatrixwhere each of the M rows is a point. - points - An
N x dmatrixthat 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
standardandradius. - 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::nnviaC++. Just#include "Rnanoflann.h". The available implemented function are useRcppandRcppArmadillo. For custom matrices you need to implement you own adaptor (see above).