Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions c_api/impl/AuxIndexStructures_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using faiss::DistanceComputer;
using faiss::IDSelector;
using faiss::IDSelectorAnd;
using faiss::IDSelectorBatch;
using faiss::IDSelectorBitmap;
using faiss::IDSelectorNot;
using faiss::IDSelectorOr;
using faiss::IDSelectorRange;
Expand Down Expand Up @@ -119,6 +120,23 @@ int faiss_IDSelectorBatch_new(
CATCH_AND_HANDLE
}

DEFINE_DESTRUCTOR(IDSelectorBitmap)

DEFINE_GETTER(IDSelectorBitmap, size_t, n)
DEFINE_GETTER(IDSelectorBitmap, const uint8_t*, bitmap)

int faiss_IDSelectorBitmap_new(
FaissIDSelectorBitmap** p_sel,
size_t n,
const uint8_t* bitmap) {
try {
*p_sel = reinterpret_cast<FaissIDSelectorBitmap*>(
new IDSelectorBitmap(n, bitmap));
return 0;
}
CATCH_AND_HANDLE
}

int faiss_IDSelectorNot_new(
FaissIDSelectorNot** p_sel,
const FaissIDSelector* sel) {
Expand Down
11 changes: 11 additions & 0 deletions c_api/impl/AuxIndexStructures_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ int faiss_IDSelectorBatch_new(
size_t n,
const idx_t* indices);

FAISS_DECLARE_CLASS(IDSelectorBitmap)
FAISS_DECLARE_DESTRUCTOR(IDSelectorBitmap)

FAISS_DECLARE_GETTER(IDSelectorBitmap, size_t, n)
FAISS_DECLARE_GETTER(IDSelectorBitmap, const uint8_t*, bitmap)

int faiss_IDSelectorBitmap_new(
FaissIDSelectorBitmap** p_sel,
size_t n,
const uint8_t* bitmap);

FAISS_DECLARE_CLASS(IDSelectorNot)
int faiss_IDSelectorNot_new(
FaissIDSelectorNot** p_sel,
Expand Down
Loading