File: find_hnsw.cpp

package info (click to toggle)
r-bioc-biocneighbors 1.8.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 852 kB
  • sloc: cpp: 2,573; ansic: 248; sh: 13; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "hnsw.h"
#include "find_knn.h"

// [[Rcpp::export(rng=false)]]
Rcpp::RObject find_hnsw (Rcpp::IntegerVector to_check, Rcpp::NumericMatrix vals, std::string fname, int ef_search,
    std::string dtype, int nn, bool get_index, bool get_distance, int last) 
{
    if (dtype=="Manhattan") {
        Hnsw<L1Space> searcher(vals, fname, ef_search);
        return find_knn(searcher, to_check, nn, get_index, get_distance, last);
     } else {
        Hnsw<hnswlib::L2Space> searcher(vals, fname, ef_search);
        return find_knn(searcher, to_check, nn, get_index, get_distance, last);
    }
}