MyNixOS website logo
Description

Wraps 'libnabo', a Fast K Nearest Neighbour Library for Low Dimensions.

An R wrapper for 'libnabo', an exact or approximate k nearest neighbour library which is optimised for low dimensional spaces (e.g. 3D). 'libnabo' has speed and space advantages over the 'ANN' library wrapped by package 'RANN'. 'nabor' includes a knn function that is designed as a drop-in replacement for 'RANN' function nn2. In addition, objects which include the k-d tree search structure can be returned to speed up repeated queries of the same set of target points.

nabor

DOI Release Version CRAN_Status_Badge Build Status

R package nabor wraps libnabo, a fast K Nearest Neighbour library for low-dimensional spaces implemented in templated C++. In comparison with the widely used ANN library (wrapped by the RANN R package), libnabo is reported to be 5% to 20% faster with more compact data structures.

Quick start

# install (see below for details)
install.packages("nabor")

# use
library(nabor)

# help
?nabor
?knn

# run examples
example(knn)
example(WKNN)

# run tests
library(testthat)
test_package("nabor")

# cite
citation("nabor")

nabor vs RANN

For R users nabor provides a function, knn, that is a drop in replacement for the nn2 function in the RANN R package. I have seen speedups of 2-3x fold for queries of interest (a few thousand points in 3d, k=1) when comparing nabor::knn and RANN::nn2. See ?knn for details.

Furthermore nabor provides a mechanism for reusing the k-d search tree structure for multiple queries. This is achieved by wrapping a libnabo k-d tree and associated points into a C++ class. This in turn is wrapped as an R reference class (by RcppModules) that can be used in R. See ?WKNN for details. The WKNNF class has the additional feature of using floats (4 bytes per coordinate) for the underlying storage, rather than the doubles used by R; this may be useful for large pointsets.

Installation

Released version from CRAN

The current stable version of the package is available from CRAN. The package requires compilation, but installing from CRAN allows mac and windows users without the full C++ compiler toolchain to install binary packages.

install.packages("nabor")

Development version from github

The nabor package is known to compile from source with the standard C(++) compiler toolchains for R under MacOS X, Windows and Linux. See https://www.rstudio.com/products/rpackages/devtools/ for details of the developer toolchains needed for your platform.

Once you have installed the appropriate developer toolchain mentioned above, you can use the devtools package to install the development version of the package:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("jefferis/nabor")

Dependencies

The nabor package includes libnabo and all of its dependencies (boost, via package BH) and Eigen (via package RcppEigen) and does not depend on any non-standard system libraries. It should therefore run out of the box on any mac/linux/windows system.

Acknowlegements

libnabo and therefore the nabor R package are released under the BSD 3 clause license. If you make use of nabor please cite the original authors:

> citation('nabor')

Elseberg J, Magnenat S, Siegwart R and Nüchter A (2012). “Comparison of nearest-neighbor-search
strategies and implementations for efficient shape registration.” _Journal of Software Engineering for
Robotics (JOSER)_, *3*(1), pp. 2-12. ISSN 2035-3928.

A BibTeX entry for LaTeX users is

  @Article{elsebergcomparison,
    title = {Comparison of nearest-neighbor-search strategies and implementations for efficient shape registration},
    author = {J. Elseberg and S. Magnenat and R. Siegwart and A. N{\"u}chter},
    journal = {Journal of Software Engineering for Robotics (JOSER)},
    pages = {2--12},
    volume = {3},
    number = {1},
    year = {2012},
    issn = {2035-3928},
  }

nabor also makes use of the tremendous Rcpp and RcppEigen packages – kudos to their authors!

Metadata

Version

0.5.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows