Extremely Fast Nearest Neighbor Search

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.


Rnanoflann Rnanoflann

CRAN_Status_Badge metacran downloads metacran downloads CRAN_latest_release_date R (linux) R (MacOS) R (windows)

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 and radius.
  • 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 via C++. Just #include "Rnanoflann.h". The available implemented function are use Rcpp and RcppArmadillo. For custom matrices you need to implement you own adaptor (see above).

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("Rnanoflann")

0.0.3 by Manos Papadakis, 2 years ago


https://github.com/ManosPapadakis95/Rnanoflann


Report a bug at https://github.com/ManosPapadakis95/Rnanoflann/issues


Browse source code at https://github.com/cran/Rnanoflann


Authors: Manos Papadakis [aut, cre, cph] , Jose Luis Blanco [aut, cph] , Michail Tsagris [ctb]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports Rcpp

Linking to Rcpp, RcppArmadillo


Imported by Compositional, CompositionalNAimp, Directional, KODAMA, Rfast2, adjoin, outliersHD.


See at CRAN