knncolle_annoy
Annoy nearest neighbors in knncolle
Loading...
Searching...
No Matches
load_annoy_prebuilt.hpp
Go to the documentation of this file.
1#ifndef KNNCOLLE_ANNOY_LOAD_PREBUILT_HPP
2#define KNNCOLLE_ANNOY_LOAD_PREBUILT_HPP
3
4#include "utils.hpp"
5#include "knncolle_annoy.hpp"
6
7#include <cstddef>
8#include <stdexcept>
9#include <string>
10
11#include "knncolle/knncolle.hpp"
12
18namespace knncolle_annoy {
19
52template<
53 typename Index_,
54 typename Data_,
55 typename Distance_,
56 class AnnoyDistance_,
57 typename AnnoyIndex_ = Index_,
58 typename AnnoyData_ = float,
59 class AnnoyRng_ = Annoy::Kiss64Random,
60 class AnnoyThreadPolicy_ = Annoy::AnnoyIndexSingleThreadedBuildPolicy
61>
62auto load_annoy_prebuilt(const std::string& prefix) {
63 std::size_t ndim;
64 knncolle::quick_load(prefix + "num_dim", &ndim, 1);
65 return new AnnoyPrebuilt<Index_, Data_, Distance_, AnnoyDistance_, AnnoyIndex_, AnnoyData_, AnnoyRng_, AnnoyThreadPolicy_>(prefix, ndim);
66}
67
68}
69
70#endif
Approximate nearest neighbor search with Annoy.
Approximate nearest neighbor search with Annoy.
Definition Annoy.hpp:23
auto load_annoy_prebuilt(const std::string &prefix)
Definition load_annoy_prebuilt.hpp:62
void quick_load(const std::string &path, Input_ *const contents, const Length_ length)
Utilities for the Annoy wrappers.