Skip to content

Commit

Permalink
Merge branch 'main' into fix_perf_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
junjieqi authored Feb 3, 2025
2 parents 93fb0c7 + 6718dae commit 07d0d27
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
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

0 comments on commit 07d0d27

Please sign in to comment.