Files
faiss/c_api/invlists/DirectMap_c.cpp
T
Aalekh Patel cda4f6e713 Expose IndexBinaryIVF.set_direct_map_type via the C API (#5451)
Summary:
Expose the `set_direct_map_type` method of binary IVF indexes via the C API. This enables support for the `index.set_direct_map_type` API in languages other than Python.

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5451

Reviewed By: alibeklfc

Differential Revision: D114681970

Pulled By: mnorris11

fbshipit-source-id: 1342eeb225d6fd9fdea76c6b9417cedde55c1d3a
2026-09-04 09:39:33 -07:00

25 lines
986 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// -*- c -*-
#include "DirectMap_c.h"
#include <faiss/invlists/DirectMap.h>
// Keep the C enum in lock-step with faiss::DirectMap::Type. If the C++ enum is
// ever reordered or extended, these will fail to compile instead of silently
// mapping to the wrong type in the static_cast performed by callers.
static_assert(
DIRECT_MAP_NO_MAP == static_cast<int>(faiss::DirectMap::NoMap),
"FaissDirectMapType is out of sync with faiss::DirectMap::Type");
static_assert(
DIRECT_MAP_ARRAY == static_cast<int>(faiss::DirectMap::Array),
"FaissDirectMapType is out of sync with faiss::DirectMap::Type");
static_assert(
DIRECT_MAP_HASHTABLE == static_cast<int>(faiss::DirectMap::Hashtable),
"FaissDirectMapType is out of sync with faiss::DirectMap::Type");