-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8e0296
commit f01e0cb
Showing
2 changed files
with
34 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
Package: N2R | ||
Type: Package | ||
Title: Implements kNN methods using n2 library | ||
Version: 0.0.1 | ||
Date: 2020-06-26 | ||
Version: 1.0.0 | ||
Authors@R: c(person("Peter", "Kharchenko", email = "[email protected]", role = c("aut")), person("Evan", "Biederstedt", email = "[email protected]", role=c("cre", "aut"))) | ||
Description: One paragraph description of what the package does as one | ||
or more full sentences. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,48 @@ | ||
[![<kharchenkolab>](https://circleci.com/gh/kharchenkolab/N2R.svg?style=svg)](https://app.circleci.com/pipelines/github/kharchenkolab/N2R) | ||
[![CRAN status](https://www.r-pkg.org/badges/version/N2R)](https://cran.r-project.org/package=N2R) | ||
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/N2R)](https://cran.r-project.org/package=N2R) | ||
|
||
# N2R | ||
R extensions to n2 implementing kNN functions, from conos | ||
R extensions to N2 implementing kNN functions. | ||
|
||
Newer version with Python and Go bindings here: https://github.com/kakao/n2 | ||
(Note: both Python and Go extensions are quite different in design than this library.) | ||
Implements methods to perform fast approximate K-nearest neighbor search on an input matrix. The algorithm implemented is based on the N2 implementation of an approximate nearest neighbor search using Hierarchical NSW graphs. The original algorithm is described in "Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs", Y. Malkov and D. Yashunin, doi: 10.1109/TPAMI.2018.2889473, arXiv: 1603.09320. | ||
|
||
Related libraries: | ||
* The original C++ library with Python and Go bindings here: https://github.com/kakao/n2 | ||
* Rust library here: https://github.com/rust-cv/hnsw | ||
|
||
## Functions | ||
|
||
* `n2Knn()`: k-NN using n2 approximate nearest neighbors algorithm | ||
(similar to ) | ||
## Installation | ||
|
||
* `n2CrossKnn()`: matrixA cross matrixB k-NN using n2 | ||
To install the stable version from [CRAN](https://CRAN.R-project.org/package=N2R), use: | ||
|
||
## Installation | ||
```r | ||
install.packages('N2R') | ||
``` | ||
|
||
For Mac OS X 10.15.5, | ||
To install the latest version, use: | ||
|
||
`brew install gcc gfortran` | ||
```r | ||
install.packages('devtools') | ||
devtools::install_github('kharchenkolab/N2R') | ||
``` | ||
|
||
I've included `llvm` as well for my configuration below, though it's not required. | ||
For installing from source on Mac OS, please see instructions in the wiki [here](https://github.com/kharchenkolab/N2R/wiki/Installing-N2R-for-Mac-OS) | ||
|
||
including the following in my `~/.zshrc`: | ||
## Functions | ||
|
||
``` | ||
export PATH="/usr/local/opt/llvm/bin:$PATH" | ||
export LDFLAGS="-L/usr/local/opt/llvm/lib" | ||
export CPPFLAGS="-I/usr/local/opt/llvm/include" | ||
``` | ||
* `Knn()`: k-NN using N2 approximate nearest neighbors algorithm | ||
|
||
and my `.R/Makevars` contains: | ||
* `crossKnn()`: matrixA cross matrixB k-NN using N2 | ||
|
||
|
||
## Citation | ||
|
||
If you find `N2R` useful for your publication, please cite: | ||
|
||
``` | ||
XCBASE:=$(shell xcrun --show-sdk-path) | ||
LLVMBASE:=$(shell brew --prefix llvm) | ||
GCCBASE:=$(shell brew --prefix gcc) | ||
GETTEXT:=$(shell brew --prefix gettext) | ||
CC=$(LLVMBASE)/bin/clang -fopenmp | ||
CXX=$(LLVMBASE)/bin/clang++ -fopenmp | ||
CXX11=$(LLVMBASE)/bin/clang++ -fopenmp | ||
CXX14=$(LLVMBASE)/bin/clang++ -fopenmp | ||
CXX17=$(LLVMBASE)/bin/clang++ -fopenmp | ||
CXX1X=$(LLVMBASE)/bin/clang++ -fopenmp | ||
CPPFLAGS=-isystem "$(LLVMBASE)/include" -isysroot "$(XCBASE)" | ||
LDFLAGS=-L"$(LLVMBASE)/lib" -L"$(GETTEXT)/lib" --sysroot="$(XCBASE)" | ||
FC=$(GCCBASE)/bin/gfortran -fopenmp | ||
F77=$(GCCBASE)/bin/gfortran -fopenmp | ||
FLIBS=-L$(GCCBASE)/lib/gcc/9/ -lm | ||
``` | ||
Peter Kharchenko, Viktor Petukhov and Evan Biederstedt (2020). N2R: | ||
Fast and Scalable Approximate k-Nearest Neighbor Search Methods using | ||
N2 Library. R package version 1.0.0 | ||
https://github.com/kharchenkolab/N2R | ||
``` |