mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
* [c_api] Update impl and interface for v1.5
- move IndexShards to dedicated module IndexShards_c.{h|cpp}
- remove getter/setters to unreachable fields
- reimplement faiss_IndexIVF_imbalance_factor (to use invlists)
- minor IndexIVF documentation tweaks
- Remove QueryResult, provide RangeQueryResult
* [c_api] Document FaissErrorCode
* [c_api] Update GPU impl and interface for v1.5
- Remove unavailable method setTempMemoryFraction
* [c_api] Relicense to MIT
In accordance to the rest of the project
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
/**
|
|
* 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 2004-present Facebook. All Rights Reserved.
|
|
// -*- c++ -*-
|
|
|
|
#include "MetaIndexes_c.h"
|
|
#include "MetaIndexes.h"
|
|
#include "macros_impl.h"
|
|
|
|
using faiss::Index;
|
|
using faiss::IndexIDMap;
|
|
using faiss::IndexIDMap2;
|
|
|
|
DEFINE_GETTER(IndexIDMap, int, own_fields)
|
|
DEFINE_SETTER(IndexIDMap, int, own_fields)
|
|
|
|
int faiss_IndexIDMap_new(FaissIndexIDMap** p_index, FaissIndex* index) {
|
|
try {
|
|
auto out = new IndexIDMap(reinterpret_cast<Index*>(index));
|
|
*p_index = reinterpret_cast<FaissIndexIDMap*>(out);
|
|
} CATCH_AND_HANDLE
|
|
}
|
|
|
|
void faiss_IndexIDMap_id_map(FaissIndexIDMap* index, long** p_id_map, size_t* p_size) {
|
|
auto idx = reinterpret_cast<IndexIDMap*>(index);
|
|
if (p_id_map)
|
|
*p_id_map = idx->id_map.data();
|
|
if (p_size)
|
|
*p_size = idx->id_map.size();
|
|
}
|
|
|
|
int faiss_IndexIDMap2_new(FaissIndexIDMap2** p_index, FaissIndex* index) {
|
|
try {
|
|
auto out = new IndexIDMap2(reinterpret_cast<Index*>(index));
|
|
*p_index = reinterpret_cast<FaissIndexIDMap2*>(out);
|
|
} CATCH_AND_HANDLE
|
|
}
|
|
|
|
int faiss_IndexIDMap2_construct_rev_map(FaissIndexIDMap2* index) {
|
|
try {
|
|
reinterpret_cast<IndexIDMap2*>(index)->construct_rev_map();
|
|
} CATCH_AND_HANDLE
|
|
}
|
|
|