Commit Graph

7 Commits (e7d153dbf543a862b9119572eef501822ccfbba9)

Author SHA1 Message Date
Michael Norris 56a383f253 Resolve "duplicate-license-header": Find and replace duplicate license headers (#3967)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3967

This diff just finds and replaces duplicate license headers.

See the errors for "duplicate-license-header" in D64429711 under "linter-coverage-verification" signal.

Reviewed By: asadoughi

Differential Revision: D64484123

fbshipit-source-id: 906e8baa3a11a3bbee174a03dcc27681f9fd78c2
2024-10-21 08:26:22 -07:00
Kaelen Haag aae6ff5129 Id selector c api (#2755)
Summary:
Implements c_api interfaces for IDSelectorNot, IDSelectorAnd, IDSelectorOr, IDSelectorXOr

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

Reviewed By: alexanderguzhva

Differential Revision: D44366433

Pulled By: mdouze

fbshipit-source-id: b28eb32852188888f51b7ba08b37f76e174dcf3c
2023-03-24 09:25:48 -07:00
Matthijs Douze dd814b5f14 IVF filtering based on IDSelector (no init split) (#2483)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2483

This diff changes the following:
1. all search functions now take a `SearchParameters` argument that overrides the internal search parameters
2. the default implementation for most classes throws when the params argument is non-nullptr / non-None
3. the IndexIVF and IndexHNSW classes have functioning SearchPArameters
4. the SearchParameters includes an IDSelector that can search only in a subset of the index based on a defined subset of ids

There is also some refactoring: the IDSelector was moved to its own .h/.cpp and python/__init__.py is spit in parts.

The diff is quite bulky because the search function prototypes need to be changed in all index classes.

Things to fix in subsequent diffs:

- support SearchParameters for more index types (Flat variants)

- better sub-object ownership for SearchParams (with std::unique_ptr?)

- special handling of IDSelectorRange to make it faster

Reviewed By: alexanderguzhva

Differential Revision: D39852589

fbshipit-source-id: 4988bdb5b9bee1207cd327d3f80bf5e0e2467fe1
2022-09-30 06:40:03 -07:00
Matthijs Douze 291353c5a9 Generalize DistanceComputer for flat indexes (#2255)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2255

The `DistanceComputer` object is derived from an Index (obtained with `get_distance_computer()`). It maintains a current query and quickly computes distances from that query to any item in the database. This is useful, eg. for the IndexHNSW and IndexNSG that rely on query-to-point comparisons in the datasets.

This diff introduces the `FlatCodesDistanceComputer`, that inherits from `DistanceComputer` for Flat indexes. In addition to the distance-to-item function, it adds a `distance_to_code` that computes the distance from any code to the current query, even if it is not stored in the index.

This is implemented for all FlatCode indexes (IndexFlat, IndexPQ, IndexScalarQuantizer and IndexAdditiveQuantizer).

In the process, the two classes were extracted to their own header file `impl/DistanceComputer.h`

Reviewed By: beauby

Differential Revision: D34863609

fbshipit-source-id: 39d8c66475e55c3223c4a6a210827aa48bca292d
2022-03-20 23:43:33 -07:00
Lucas Hosseini e86bf8cae1 Enable clang-format + autofix.
Summary: Format whole codebase with clang-format.

Reviewed By: mdouze

Differential Revision: D22891341

fbshipit-source-id: 673032b2444d61026d1e2c3fa2c5659f178cf58b
2021-02-25 04:46:10 -08:00
Prabhat Roy 7a289d5418 Added C API to CMake and CircleCI (#1678)
Summary:
This supersedes https://github.com/facebookresearch/faiss/issues/1390 and https://github.com/facebookresearch/faiss/issues/1141.

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

Reviewed By: mdouze

Differential Revision: D26428986

Pulled By: beauby

fbshipit-source-id: 1e2718f457c1aca18c19edc2436d6baf9b627a60
2021-02-15 12:41:31 -08:00
Jose Truyol c47da8a948 [C_API] Pass compilation in current state (#989)
* Pass compilation in current state

* Fix formatting and add missing parts

* Define DistanceComputer

* Add documentation to name changed on DistanceComputer::operator()()

* Apply suggestions from code review

Changes in docs

Co-Authored-By: Eduardo Pinho <enet4mikeenet@gmail.com>

* Updated MetricType
2019-11-19 11:36:44 +01:00