forked from facebookresearch/faiss
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathIndexIVF_c_ex.cpp
More file actions
34 lines (30 loc) · 996 Bytes
/
IndexIVF_c_ex.cpp
File metadata and controls
34 lines (30 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Copyright 2023-present Facebook. All Rights Reserved.
// -*- c++ -*-
#include "IndexIVF_c_ex.h"
#include <faiss/IndexIVF.h>
#include "macros_impl.h"
using faiss::IndexIVF;
using faiss::SearchParametersIVF;
int faiss_IndexIVF_set_direct_map(FaissIndexIVF* index, int direct_map_type) {
try {
reinterpret_cast<IndexIVF*>(index)->set_direct_map_type(
static_cast<faiss::DirectMap::Type>(direct_map_type));
}
CATCH_AND_HANDLE
}
int faiss_SearchParametersIVF_new_with_sel(
FaissSearchParametersIVF** p_sp,
FaissIDSelector* sel) {
try {
SearchParametersIVF* sp = new SearchParametersIVF;
sp->sel = reinterpret_cast<faiss::IDSelector*>(sel);
*p_sp = reinterpret_cast<FaissSearchParametersIVF*>(sp);
}
CATCH_AND_HANDLE
}