+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..09b81856f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+# Twitter Recommendation Algorithm
+
+The Twitter Recommendation Algorithm is a set of services and jobs that are responsible for constructing and serving the
+Home Timeline. For an introduction to how the algorithm works, please refer to our [engineering blog](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm). The
+diagram below illustrates how major services and jobs interconnect.
+
+![](docs/system-diagram.png)
+
+These are the main components of the Recommendation Algorithm included in this repository:
+
+| Type | Component | Description |
+|------------|------------|------------|
+| Feature | [simclusters-ann](simclusters-ann/README.md) | Community detection and sparse embeddings into those communities. |
+| | [TwHIN](https://github.com/twitter/the-algorithm-ml/blob/main/projects/twhin/README.md) | Dense knowledge graph embeddings for Users and Tweets. |
+| | [trust-and-safety-models](trust_and_safety_models/README.md) | Models for detecting NSFW or abusive content. |
+| | [real-graph](src/scala/com/twitter/interaction_graph/README.md) | Model to predict likelihood of a Twitter User interacting with another User. |
+| | [tweepcred](src/scala/com/twitter/graph/batch/job/tweepcred/README) | Page-Rank algorithm for calculating Twitter User reputation. |
+| | [recos-injector](recos-injector/README.md) | Streaming event processor for building input streams for [GraphJet](https://github.com/twitter/GraphJet) based services. |
+| | [graph-feature-service](graph-feature-service/README.md) | Serves graph features for a directed pair of Users (e.g. how many of User A's following liked Tweets from User B). |
+| Candidate Source | [search-index](src/java/com/twitter/search/README.md) | Find and rank In-Network Tweets. ~50% of Tweets come from this candidate source. |
+| | [cr-mixer](cr-mixer/README.md) | Coordination layer for fetching Out-of-Network tweet candidates from underlying compute services. |
+| | [user-tweet-entity-graph](src/scala/com/twitter/recos/user_tweet_entity_graph/README.md) (UTEG)| Maintains an in memory User to Tweet interaction graph, and finds candidates based on traversals of this graph. This is built on the [GraphJet](https://github.com/twitter/GraphJet) framework. Several other GraphJet based features and candidate sources are located [here](src/scala/com/twitter/recos) |
+| | [follow-recommendation-service](follow-recommendations-service/README.md) (FRS)| Provides Users with recommendations for accounts to follow, and Tweets from those accounts. |
+| Ranking | [light-ranker](src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/README.md) | Light ranker model used by search index (Earlybird) to rank Tweets. |
+| | [heavy-ranker](https://github.com/twitter/the-algorithm-ml/blob/main/projects/home/recap/README.md) | Neural network for ranking candidate tweets. One of the main signals used to select timeline Tweets post candidate sourcing. |
+| Tweet mixing & filtering | [home-mixer](home-mixer/README.md) | Main service used to construct and serve the Home Timeline. Built on [product-mixer](product-mixer/README.md) |
+| | [visibility-filters](visibilitylib/README.md) | Responsible for filtering Twitter content to support legal compliance, improve product quality, increase user trust, protect revenue through the use of hard-filtering, visible product treatments, and coarse-grained downranking. |
+| | [timelineranker](timelineranker/README.md) | Legacy service which provides relevance-scored tweets from the Earlybird Search Index and UTEG service. |
+| Software framework | [navi](navi/navi/README.md) | High performance, machine learning model serving written in Rust. |
+| | [product-mixer](product-mixer/README.md) | Software framework for building feeds of content. |
+| | [twml](twml/README.md) | Legacy machine learning framework built on TensorFlow v1. |
+
+We include Bazel BUILD files for most components, but not a top level BUILD or WORKSPACE file.
+
+## Contributing
+
+We invite the community to submit GitHub issues and pull requests for suggestions on improving the recommendation algorithm. We are working on tools to manage these suggestions and sync changes to our internal repository. Any security concerns or issues should be routed to our official [bug bounty program](https://hackerone.com/twitter) through HackerOne. We hope to benefit from the collective intelligence and expertise of the global community in helping us identify issues and suggest improvements, ultimately leading to a better Twitter.
+
+Read our blog on the open source initiative [here](https://blog.twitter.com/en_us/topics/company/2023/a-new-era-of-transparency-for-twitter).
diff --git a/ann/src/main/java/com/twitter/ann/faiss/BUILD b/ann/src/main/java/com/twitter/ann/faiss/BUILD
new file mode 100644
index 000000000..2320a1dae
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/BUILD
@@ -0,0 +1,15 @@
+target(
+ name = "faiss",
+ dependencies = [
+ "ann/src/main/java/com/twitter/ann/faiss/swig:swig-artifactory",
+ ],
+)
+
+java_library(
+ name = "swig-native-utils",
+ sources = ["*.java"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [],
+)
diff --git a/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java b/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java
new file mode 100644
index 000000000..424d28890
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java
@@ -0,0 +1,151 @@
+package com.twitter.ann.faiss;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import java.util.Locale;
+
+public final class NativeUtils {
+
+ private static final int MIN_PREFIX_LENGTH = 3;
+ public static final String NATIVE_FOLDER_PATH_PREFIX = "nativeutils";
+
+ public static File temporaryDir;
+
+ private NativeUtils() {
+ }
+
+ private static File unpackLibraryFromJarInternal(String path) throws IOException {
+ if (null == path || !path.startsWith("/")) {
+ throw new IllegalArgumentException("The path has to be absolute (start with '/').");
+ }
+
+ String[] parts = path.split("/");
+ String filename = (parts.length > 1) ? parts[parts.length - 1] : null;
+
+ if (filename == null || filename.length() < MIN_PREFIX_LENGTH) {
+ throw new IllegalArgumentException("The filename has to be at least 3 characters long.");
+ }
+
+ if (temporaryDir == null) {
+ temporaryDir = createTempDirectory(NATIVE_FOLDER_PATH_PREFIX);
+ temporaryDir.deleteOnExit();
+ }
+
+ File temp = new File(temporaryDir, filename);
+
+ try (InputStream is = NativeUtils.class.getResourceAsStream(path)) {
+ Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ temp.delete();
+ throw e;
+ } catch (NullPointerException e) {
+ temp.delete();
+ throw new FileNotFoundException("File " + path + " was not found inside JAR.");
+ }
+
+ return temp;
+ }
+
+ /**
+ * Unpack library from JAR into temporary path
+ *
+ * @param path The path of file inside JAR as absolute path (beginning with
+ * '/'), e.g. /package/File.ext
+ * @throws IOException If temporary file creation or read/write
+ * operation fails
+ * @throws IllegalArgumentException If source file (param path) does not exist
+ * @throws IllegalArgumentException If the path is not absolute or if the
+ * filename is shorter than three characters
+ * (restriction of
+ * {@link File#createTempFile(java.lang.String, java.lang.String)}).
+ * @throws FileNotFoundException If the file could not be found inside the
+ * JAR.
+ */
+ public static void unpackLibraryFromJar(String path) throws IOException {
+ unpackLibraryFromJarInternal(path);
+ }
+
+ /**
+ * Loads library from current JAR archive
+ *
+ * The file from JAR is copied into system temporary directory and then loaded.
+ * The temporary file is deleted after
+ * exiting.
+ * Method uses String as filename because the pathname is "abstract", not
+ * system-dependent.
+ *
+ * @param path The path of file inside JAR as absolute path (beginning with
+ * '/'), e.g. /package/File.ext
+ * @throws IOException If temporary file creation or read/write
+ * operation fails
+ * @throws IllegalArgumentException If source file (param path) does not exist
+ * @throws IllegalArgumentException If the path is not absolute or if the
+ * filename is shorter than three characters
+ * (restriction of
+ * {@link File#createTempFile(java.lang.String, java.lang.String)}).
+ * @throws FileNotFoundException If the file could not be found inside the
+ * JAR.
+ */
+ public static void loadLibraryFromJar(String path) throws IOException {
+ File temp = unpackLibraryFromJarInternal(path);
+
+ try (InputStream is = NativeUtils.class.getResourceAsStream(path)) {
+ Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ temp.delete();
+ throw e;
+ } catch (NullPointerException e) {
+ temp.delete();
+ throw new FileNotFoundException("File " + path + " was not found inside JAR.");
+ }
+
+ try {
+ System.load(temp.getAbsolutePath());
+ } finally {
+ temp.deleteOnExit();
+ }
+ }
+
+ private static File createTempDirectory(String prefix) throws IOException {
+ String tempDir = System.getProperty("java.io.tmpdir");
+ File generatedDir = new File(tempDir, prefix + System.nanoTime());
+
+ if (!generatedDir.mkdir()) {
+ throw new IOException("Failed to create temp directory " + generatedDir.getName());
+ }
+
+ return generatedDir;
+ }
+
+ public enum OSType {
+ Windows, MacOS, Linux, Other
+ }
+
+ protected static OSType detectedOS;
+
+ /**
+ * detect the operating system from the os.name System property and cache
+ * the result
+ *
+ * @returns - the operating system detected
+ */
+ public static OSType getOperatingSystemType() {
+ if (detectedOS == null) {
+ String osname = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
+ if ((osname.contains("mac")) || (osname.contains("darwin"))) {
+ detectedOS = OSType.MacOS;
+ } else if (osname.contains("win")) {
+ detectedOS = OSType.Windows;
+ } else if (osname.contains("nux")) {
+ detectedOS = OSType.Linux;
+ } else {
+ detectedOS = OSType.Other;
+ }
+ }
+ return detectedOS;
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableFloat32.java b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableFloat32.java
new file mode 100644
index 000000000..9758bd20d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableFloat32.java
@@ -0,0 +1,98 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class AlignedTableFloat32 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected AlignedTableFloat32(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(AlignedTableFloat32 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_AlignedTableFloat32(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t value) {
+ swigfaissJNI.AlignedTableFloat32_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t getTab() {
+ long cPtr = swigfaissJNI.AlignedTableFloat32_tab_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t(cPtr, false);
+ }
+
+ public void setNumel(long value) {
+ swigfaissJNI.AlignedTableFloat32_numel_set(swigCPtr, this, value);
+ }
+
+ public long getNumel() {
+ return swigfaissJNI.AlignedTableFloat32_numel_get(swigCPtr, this);
+ }
+
+ public static long round_capacity(long n) {
+ return swigfaissJNI.AlignedTableFloat32_round_capacity(n);
+ }
+
+ public AlignedTableFloat32() {
+ this(swigfaissJNI.new_AlignedTableFloat32__SWIG_0(), true);
+ }
+
+ public AlignedTableFloat32(long n) {
+ this(swigfaissJNI.new_AlignedTableFloat32__SWIG_1(n), true);
+ }
+
+ public long itemsize() {
+ return swigfaissJNI.AlignedTableFloat32_itemsize(swigCPtr, this);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.AlignedTableFloat32_resize(swigCPtr, this, n);
+ }
+
+ public void clear() {
+ swigfaissJNI.AlignedTableFloat32_clear(swigCPtr, this);
+ }
+
+ public long size() {
+ return swigfaissJNI.AlignedTableFloat32_size(swigCPtr, this);
+ }
+
+ public long nbytes() {
+ return swigfaissJNI.AlignedTableFloat32_nbytes(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_float get() {
+ long cPtr = swigfaissJNI.AlignedTableFloat32_get__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public SWIGTYPE_p_float data() {
+ long cPtr = swigfaissJNI.AlignedTableFloat32_data__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint16.java b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint16.java
new file mode 100644
index 000000000..1ce3c67f7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint16.java
@@ -0,0 +1,98 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class AlignedTableUint16 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected AlignedTableUint16(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(AlignedTableUint16 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_AlignedTableUint16(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t value) {
+ swigfaissJNI.AlignedTableUint16_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t getTab() {
+ long cPtr = swigfaissJNI.AlignedTableUint16_tab_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t(cPtr, false);
+ }
+
+ public void setNumel(long value) {
+ swigfaissJNI.AlignedTableUint16_numel_set(swigCPtr, this, value);
+ }
+
+ public long getNumel() {
+ return swigfaissJNI.AlignedTableUint16_numel_get(swigCPtr, this);
+ }
+
+ public static long round_capacity(long n) {
+ return swigfaissJNI.AlignedTableUint16_round_capacity(n);
+ }
+
+ public AlignedTableUint16() {
+ this(swigfaissJNI.new_AlignedTableUint16__SWIG_0(), true);
+ }
+
+ public AlignedTableUint16(long n) {
+ this(swigfaissJNI.new_AlignedTableUint16__SWIG_1(n), true);
+ }
+
+ public long itemsize() {
+ return swigfaissJNI.AlignedTableUint16_itemsize(swigCPtr, this);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.AlignedTableUint16_resize(swigCPtr, this, n);
+ }
+
+ public void clear() {
+ swigfaissJNI.AlignedTableUint16_clear(swigCPtr, this);
+ }
+
+ public long size() {
+ return swigfaissJNI.AlignedTableUint16_size(swigCPtr, this);
+ }
+
+ public long nbytes() {
+ return swigfaissJNI.AlignedTableUint16_nbytes(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_uint16_t get() {
+ long cPtr = swigfaissJNI.AlignedTableUint16_get__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
+ }
+
+ public SWIGTYPE_p_uint16_t data() {
+ long cPtr = swigfaissJNI.AlignedTableUint16_data__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint8.java
new file mode 100644
index 000000000..f1640baa8
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/AlignedTableUint8.java
@@ -0,0 +1,98 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class AlignedTableUint8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected AlignedTableUint8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(AlignedTableUint8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_AlignedTableUint8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t value) {
+ swigfaissJNI.AlignedTableUint8_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t getTab() {
+ long cPtr = swigfaissJNI.AlignedTableUint8_tab_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t(cPtr, false);
+ }
+
+ public void setNumel(long value) {
+ swigfaissJNI.AlignedTableUint8_numel_set(swigCPtr, this, value);
+ }
+
+ public long getNumel() {
+ return swigfaissJNI.AlignedTableUint8_numel_get(swigCPtr, this);
+ }
+
+ public static long round_capacity(long n) {
+ return swigfaissJNI.AlignedTableUint8_round_capacity(n);
+ }
+
+ public AlignedTableUint8() {
+ this(swigfaissJNI.new_AlignedTableUint8__SWIG_0(), true);
+ }
+
+ public AlignedTableUint8(long n) {
+ this(swigfaissJNI.new_AlignedTableUint8__SWIG_1(n), true);
+ }
+
+ public long itemsize() {
+ return swigfaissJNI.AlignedTableUint8_itemsize(swigCPtr, this);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.AlignedTableUint8_resize(swigCPtr, this, n);
+ }
+
+ public void clear() {
+ swigfaissJNI.AlignedTableUint8_clear(swigCPtr, this);
+ }
+
+ public long size() {
+ return swigfaissJNI.AlignedTableUint8_size(swigCPtr, this);
+ }
+
+ public long nbytes() {
+ return swigfaissJNI.AlignedTableUint8_nbytes(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_unsigned_char get() {
+ long cPtr = swigfaissJNI.AlignedTableUint8_get__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public SWIGTYPE_p_unsigned_char data() {
+ long cPtr = swigfaissJNI.AlignedTableUint8_data__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ArrayInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ArrayInvertedLists.java
new file mode 100644
index 000000000..8536e6549
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ArrayInvertedLists.java
@@ -0,0 +1,86 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ArrayInvertedLists extends InvertedLists {
+ private transient long swigCPtr;
+
+ protected ArrayInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ArrayInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ArrayInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ArrayInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setCodes(ByteVectorVector value) {
+ swigfaissJNI.ArrayInvertedLists_codes_set(swigCPtr, this, ByteVectorVector.getCPtr(value), value);
+ }
+
+ public ByteVectorVector getCodes() {
+ long cPtr = swigfaissJNI.ArrayInvertedLists_codes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVectorVector(cPtr, false);
+ }
+
+ public void setIds(SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t value) {
+ swigfaissJNI.ArrayInvertedLists_ids_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t getIds() {
+ long cPtr = swigfaissJNI.ArrayInvertedLists_ids_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t(cPtr, false);
+ }
+
+ public ArrayInvertedLists(long nlist, long code_size) {
+ this(swigfaissJNI.new_ArrayInvertedLists(nlist, code_size), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.ArrayInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.ArrayInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.ArrayInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.ArrayInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.ArrayInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void resize(long list_no, long new_size) {
+ swigfaissJNI.ArrayInvertedLists_resize(swigCPtr, this, list_no, new_size);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/AutoTuneCriterion.java b/ann/src/main/java/com/twitter/ann/faiss/swig/AutoTuneCriterion.java
new file mode 100644
index 000000000..c9df33f9f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/AutoTuneCriterion.java
@@ -0,0 +1,89 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class AutoTuneCriterion {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected AutoTuneCriterion(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(AutoTuneCriterion obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_AutoTuneCriterion(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNq(long value) {
+ swigfaissJNI.AutoTuneCriterion_nq_set(swigCPtr, this, value);
+ }
+
+ public long getNq() {
+ return swigfaissJNI.AutoTuneCriterion_nq_get(swigCPtr, this);
+}
+
+ public void setNnn(long value) {
+ swigfaissJNI.AutoTuneCriterion_nnn_set(swigCPtr, this, value);
+ }
+
+ public long getNnn() {
+ return swigfaissJNI.AutoTuneCriterion_nnn_get(swigCPtr, this);
+}
+
+ public void setGt_nnn(long value) {
+ swigfaissJNI.AutoTuneCriterion_gt_nnn_set(swigCPtr, this, value);
+ }
+
+ public long getGt_nnn() {
+ return swigfaissJNI.AutoTuneCriterion_gt_nnn_get(swigCPtr, this);
+}
+
+ public void setGt_D(FloatVector value) {
+ swigfaissJNI.AutoTuneCriterion_gt_D_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getGt_D() {
+ long cPtr = swigfaissJNI.AutoTuneCriterion_gt_D_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setGt_I(SWIGTYPE_p_std__vectorT_int64_t_t value) {
+ swigfaissJNI.AutoTuneCriterion_gt_I_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_int64_t_t getGt_I() {
+ long cPtr = swigfaissJNI.AutoTuneCriterion_gt_I_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
+ }
+
+ public void set_groundtruth(int gt_nnn, SWIGTYPE_p_float gt_D_in, LongVector gt_I_in) {
+ swigfaissJNI.AutoTuneCriterion_set_groundtruth(swigCPtr, this, gt_nnn, SWIGTYPE_p_float.getCPtr(gt_D_in), SWIGTYPE_p_long_long.getCPtr(gt_I_in.data()), gt_I_in);
+ }
+
+ public double evaluate(SWIGTYPE_p_float D, LongVector I) {
+ return swigfaissJNI.AutoTuneCriterion_evaluate(swigCPtr, this, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/BUILD b/ann/src/main/java/com/twitter/ann/faiss/swig/BUILD
new file mode 100644
index 000000000..b8b12773a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/BUILD
@@ -0,0 +1,26 @@
+java_library(
+ name = "swig-local",
+ sources = ["*.java"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = [
+ "bazel-compatible",
+ "bazel-only",
+ ],
+ dependencies = [
+ "ann/src/main/java/com/twitter/ann/faiss:swig-native-utils",
+ "ann/src/main/java/com/twitter/ann/faiss/swig/resources",
+ ],
+)
+
+java_library(
+ name = "swig-artifactory",
+ sources = ["*.java"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [
+ "3rdparty/jvm/com/twitter/ann/faiss/swig:resources",
+ "ann/src/main/java/com/twitter/ann/faiss:swig-native-utils",
+ ],
+)
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringReader.java b/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringReader.java
new file mode 100644
index 000000000..042789dca
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringReader.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class BitstringReader {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected BitstringReader(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(BitstringReader obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_BitstringReader(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.BitstringReader_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.BitstringReader_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.BitstringReader_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.BitstringReader_code_size_get(swigCPtr, this);
+ }
+
+ public void setI(long value) {
+ swigfaissJNI.BitstringReader_i_set(swigCPtr, this, value);
+ }
+
+ public long getI() {
+ return swigfaissJNI.BitstringReader_i_get(swigCPtr, this);
+ }
+
+ public BitstringReader(SWIGTYPE_p_unsigned_char code, long code_size) {
+ this(swigfaissJNI.new_BitstringReader(SWIGTYPE_p_unsigned_char.getCPtr(code), code_size), true);
+ }
+
+ public long read(int nbit) {
+ return swigfaissJNI.BitstringReader_read(swigCPtr, this, nbit);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringWriter.java b/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringWriter.java
new file mode 100644
index 000000000..8fc18d9c2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/BitstringWriter.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class BitstringWriter {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected BitstringWriter(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(BitstringWriter obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_BitstringWriter(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.BitstringWriter_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.BitstringWriter_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.BitstringWriter_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.BitstringWriter_code_size_get(swigCPtr, this);
+ }
+
+ public void setI(long value) {
+ swigfaissJNI.BitstringWriter_i_set(swigCPtr, this, value);
+ }
+
+ public long getI() {
+ return swigfaissJNI.BitstringWriter_i_get(swigCPtr, this);
+ }
+
+ public BitstringWriter(SWIGTYPE_p_unsigned_char code, long code_size) {
+ this(swigfaissJNI.new_BitstringWriter(SWIGTYPE_p_unsigned_char.getCPtr(code), code_size), true);
+ }
+
+ public void write(long x, int nbit) {
+ swigfaissJNI.BitstringWriter_write(swigCPtr, this, x, nbit);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/BufferList.java b/ann/src/main/java/com/twitter/ann/faiss/swig/BufferList.java
new file mode 100644
index 000000000..256fc1edd
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/BufferList.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class BufferList {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected BufferList(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(BufferList obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_BufferList(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setBuffer_size(long value) {
+ swigfaissJNI.BufferList_buffer_size_set(swigCPtr, this, value);
+ }
+
+ public long getBuffer_size() {
+ return swigfaissJNI.BufferList_buffer_size_get(swigCPtr, this);
+ }
+
+ public void setBuffers(SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t value) {
+ swigfaissJNI.BufferList_buffers_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t getBuffers() {
+ long cPtr = swigfaissJNI.BufferList_buffers_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t(cPtr, false);
+ }
+
+ public void setWp(long value) {
+ swigfaissJNI.BufferList_wp_set(swigCPtr, this, value);
+ }
+
+ public long getWp() {
+ return swigfaissJNI.BufferList_wp_get(swigCPtr, this);
+ }
+
+ public BufferList(long buffer_size) {
+ this(swigfaissJNI.new_BufferList(buffer_size), true);
+ }
+
+ public void append_buffer() {
+ swigfaissJNI.BufferList_append_buffer(swigCPtr, this);
+ }
+
+ public void add(long id, float dis) {
+ swigfaissJNI.BufferList_add(swigCPtr, this, id, dis);
+ }
+
+ public void copy_range(long ofs, long n, LongVector dest_ids, SWIGTYPE_p_float dest_dis) {
+ swigfaissJNI.BufferList_copy_range(swigCPtr, this, ofs, n, SWIGTYPE_p_long_long.getCPtr(dest_ids.data()), dest_ids, SWIGTYPE_p_float.getCPtr(dest_dis));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVector.java
new file mode 100644
index 000000000..f439dfa72
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ByteVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ByteVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ByteVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ByteVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public ByteVector() {
+ this(swigfaissJNI.new_ByteVector(), true);
+ }
+
+ public void push_back(short arg0) {
+ swigfaissJNI.ByteVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.ByteVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_unsigned_char data() {
+ long cPtr = swigfaissJNI.ByteVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.ByteVector_size(swigCPtr, this);
+ }
+
+ public short at(long n) {
+ return swigfaissJNI.ByteVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.ByteVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.ByteVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(ByteVector other) {
+ swigfaissJNI.ByteVector_swap(swigCPtr, this, ByteVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVectorVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVectorVector.java
new file mode 100644
index 000000000..fa0b3a7cc
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ByteVectorVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ByteVectorVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ByteVectorVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ByteVectorVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ByteVectorVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public ByteVectorVector() {
+ this(swigfaissJNI.new_ByteVectorVector(), true);
+ }
+
+ public void push_back(ByteVector arg0) {
+ swigfaissJNI.ByteVectorVector_push_back(swigCPtr, this, ByteVector.getCPtr(arg0), arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.ByteVectorVector_clear(swigCPtr, this);
+ }
+
+ public ByteVector data() {
+ long cPtr = swigfaissJNI.ByteVectorVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVector(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.ByteVectorVector_size(swigCPtr, this);
+ }
+
+ public ByteVector at(long n) {
+ return new ByteVector(swigfaissJNI.ByteVectorVector_at(swigCPtr, this, n), true);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.ByteVectorVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.ByteVectorVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(ByteVectorVector other) {
+ swigfaissJNI.ByteVectorVector_swap(swigCPtr, this, ByteVectorVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/CenteringTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/CenteringTransform.java
new file mode 100644
index 000000000..e9abaf61a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/CenteringTransform.java
@@ -0,0 +1,68 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class CenteringTransform extends VectorTransform {
+ private transient long swigCPtr;
+
+ protected CenteringTransform(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.CenteringTransform_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(CenteringTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_CenteringTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setMean(FloatVector value) {
+ swigfaissJNI.CenteringTransform_mean_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getMean() {
+ long cPtr = swigfaissJNI.CenteringTransform_mean_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public CenteringTransform(int d) {
+ this(swigfaissJNI.new_CenteringTransform__SWIG_0(d), true);
+ }
+
+ public CenteringTransform() {
+ this(swigfaissJNI.new_CenteringTransform__SWIG_1(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.CenteringTransform_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.CenteringTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+ public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
+ swigfaissJNI.CenteringTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/CharVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/CharVector.java
new file mode 100644
index 000000000..e1b91127c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/CharVector.java
@@ -0,0 +1,75 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class CharVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected CharVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(CharVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_CharVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public CharVector() {
+ this(swigfaissJNI.new_CharVector(), true);
+ }
+
+ public void push_back(char arg0) {
+ swigfaissJNI.CharVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.CharVector_clear(swigCPtr, this);
+ }
+
+ public String data() {
+ return swigfaissJNI.CharVector_data(swigCPtr, this);
+ }
+
+ public long size() {
+ return swigfaissJNI.CharVector_size(swigCPtr, this);
+ }
+
+ public char at(long n) {
+ return swigfaissJNI.CharVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.CharVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.CharVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(CharVector other) {
+ swigfaissJNI.CharVector_swap(swigCPtr, this, CharVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering.java
new file mode 100644
index 000000000..d8fe51728
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering.java
@@ -0,0 +1,101 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Clustering extends ClusteringParameters {
+ private transient long swigCPtr;
+
+ protected Clustering(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.Clustering_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Clustering obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Clustering(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setD(long value) {
+ swigfaissJNI.Clustering_d_set(swigCPtr, this, value);
+ }
+
+ public long getD() {
+ return swigfaissJNI.Clustering_d_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.Clustering_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.Clustering_k_get(swigCPtr, this);
+ }
+
+ public void setCentroids(FloatVector value) {
+ swigfaissJNI.Clustering_centroids_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getCentroids() {
+ long cPtr = swigfaissJNI.Clustering_centroids_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setIteration_stats(SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t value) {
+ swigfaissJNI.Clustering_iteration_stats_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t getIteration_stats() {
+ long cPtr = swigfaissJNI.Clustering_iteration_stats_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t(cPtr, false);
+ }
+
+ public Clustering(int d, int k) {
+ this(swigfaissJNI.new_Clustering__SWIG_0(d, k), true);
+ }
+
+ public Clustering(int d, int k, ClusteringParameters cp) {
+ this(swigfaissJNI.new_Clustering__SWIG_1(d, k, ClusteringParameters.getCPtr(cp), cp), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x, Index index, SWIGTYPE_p_float x_weights) {
+ swigfaissJNI.Clustering_train__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), Index.getCPtr(index), index, SWIGTYPE_p_float.getCPtr(x_weights));
+ }
+
+ public void train(long n, SWIGTYPE_p_float x, Index index) {
+ swigfaissJNI.Clustering_train__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), Index.getCPtr(index), index);
+ }
+
+ public void train_encoded(long nx, SWIGTYPE_p_unsigned_char x_in, Index codec, Index index, SWIGTYPE_p_float weights) {
+ swigfaissJNI.Clustering_train_encoded__SWIG_0(swigCPtr, this, nx, SWIGTYPE_p_unsigned_char.getCPtr(x_in), Index.getCPtr(codec), codec, Index.getCPtr(index), index, SWIGTYPE_p_float.getCPtr(weights));
+ }
+
+ public void train_encoded(long nx, SWIGTYPE_p_unsigned_char x_in, Index codec, Index index) {
+ swigfaissJNI.Clustering_train_encoded__SWIG_1(swigCPtr, this, nx, SWIGTYPE_p_unsigned_char.getCPtr(x_in), Index.getCPtr(codec), codec, Index.getCPtr(index), index);
+ }
+
+ public void post_process_centroids() {
+ swigfaissJNI.Clustering_post_process_centroids(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering1D.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering1D.java
new file mode 100644
index 000000000..8d4bc658c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Clustering1D.java
@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Clustering1D extends Clustering {
+ private transient long swigCPtr;
+
+ protected Clustering1D(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.Clustering1D_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Clustering1D obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Clustering1D(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public Clustering1D(int k) {
+ this(swigfaissJNI.new_Clustering1D__SWIG_0(k), true);
+ }
+
+ public Clustering1D(int k, ClusteringParameters cp) {
+ this(swigfaissJNI.new_Clustering1D__SWIG_1(k, ClusteringParameters.getCPtr(cp), cp), true);
+ }
+
+ public void train_exact(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.Clustering1D_train_exact(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringIterationStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringIterationStats.java
new file mode 100644
index 000000000..b0fcb5d09
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringIterationStats.java
@@ -0,0 +1,83 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ClusteringIterationStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ClusteringIterationStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ClusteringIterationStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ClusteringIterationStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setObj(float value) {
+ swigfaissJNI.ClusteringIterationStats_obj_set(swigCPtr, this, value);
+ }
+
+ public float getObj() {
+ return swigfaissJNI.ClusteringIterationStats_obj_get(swigCPtr, this);
+ }
+
+ public void setTime(double value) {
+ swigfaissJNI.ClusteringIterationStats_time_set(swigCPtr, this, value);
+ }
+
+ public double getTime() {
+ return swigfaissJNI.ClusteringIterationStats_time_get(swigCPtr, this);
+ }
+
+ public void setTime_search(double value) {
+ swigfaissJNI.ClusteringIterationStats_time_search_set(swigCPtr, this, value);
+ }
+
+ public double getTime_search() {
+ return swigfaissJNI.ClusteringIterationStats_time_search_get(swigCPtr, this);
+ }
+
+ public void setImbalance_factor(double value) {
+ swigfaissJNI.ClusteringIterationStats_imbalance_factor_set(swigCPtr, this, value);
+ }
+
+ public double getImbalance_factor() {
+ return swigfaissJNI.ClusteringIterationStats_imbalance_factor_get(swigCPtr, this);
+ }
+
+ public void setNsplit(int value) {
+ swigfaissJNI.ClusteringIterationStats_nsplit_set(swigCPtr, this, value);
+ }
+
+ public int getNsplit() {
+ return swigfaissJNI.ClusteringIterationStats_nsplit_get(swigCPtr, this);
+ }
+
+ public ClusteringIterationStats() {
+ this(swigfaissJNI.new_ClusteringIterationStats(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringParameters.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringParameters.java
new file mode 100644
index 000000000..3c52d810f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ClusteringParameters.java
@@ -0,0 +1,131 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ClusteringParameters {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ClusteringParameters(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ClusteringParameters obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ClusteringParameters(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNiter(int value) {
+ swigfaissJNI.ClusteringParameters_niter_set(swigCPtr, this, value);
+ }
+
+ public int getNiter() {
+ return swigfaissJNI.ClusteringParameters_niter_get(swigCPtr, this);
+ }
+
+ public void setNredo(int value) {
+ swigfaissJNI.ClusteringParameters_nredo_set(swigCPtr, this, value);
+ }
+
+ public int getNredo() {
+ return swigfaissJNI.ClusteringParameters_nredo_get(swigCPtr, this);
+ }
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.ClusteringParameters_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.ClusteringParameters_verbose_get(swigCPtr, this);
+ }
+
+ public void setSpherical(boolean value) {
+ swigfaissJNI.ClusteringParameters_spherical_set(swigCPtr, this, value);
+ }
+
+ public boolean getSpherical() {
+ return swigfaissJNI.ClusteringParameters_spherical_get(swigCPtr, this);
+ }
+
+ public void setInt_centroids(boolean value) {
+ swigfaissJNI.ClusteringParameters_int_centroids_set(swigCPtr, this, value);
+ }
+
+ public boolean getInt_centroids() {
+ return swigfaissJNI.ClusteringParameters_int_centroids_get(swigCPtr, this);
+ }
+
+ public void setUpdate_index(boolean value) {
+ swigfaissJNI.ClusteringParameters_update_index_set(swigCPtr, this, value);
+ }
+
+ public boolean getUpdate_index() {
+ return swigfaissJNI.ClusteringParameters_update_index_get(swigCPtr, this);
+ }
+
+ public void setFrozen_centroids(boolean value) {
+ swigfaissJNI.ClusteringParameters_frozen_centroids_set(swigCPtr, this, value);
+ }
+
+ public boolean getFrozen_centroids() {
+ return swigfaissJNI.ClusteringParameters_frozen_centroids_get(swigCPtr, this);
+ }
+
+ public void setMin_points_per_centroid(int value) {
+ swigfaissJNI.ClusteringParameters_min_points_per_centroid_set(swigCPtr, this, value);
+ }
+
+ public int getMin_points_per_centroid() {
+ return swigfaissJNI.ClusteringParameters_min_points_per_centroid_get(swigCPtr, this);
+ }
+
+ public void setMax_points_per_centroid(int value) {
+ swigfaissJNI.ClusteringParameters_max_points_per_centroid_set(swigCPtr, this, value);
+ }
+
+ public int getMax_points_per_centroid() {
+ return swigfaissJNI.ClusteringParameters_max_points_per_centroid_get(swigCPtr, this);
+ }
+
+ public void setSeed(int value) {
+ swigfaissJNI.ClusteringParameters_seed_set(swigCPtr, this, value);
+ }
+
+ public int getSeed() {
+ return swigfaissJNI.ClusteringParameters_seed_get(swigCPtr, this);
+ }
+
+ public void setDecode_block_size(long value) {
+ swigfaissJNI.ClusteringParameters_decode_block_size_set(swigCPtr, this, value);
+ }
+
+ public long getDecode_block_size() {
+ return swigfaissJNI.ClusteringParameters_decode_block_size_get(swigCPtr, this);
+ }
+
+ public ClusteringParameters() {
+ this(swigfaissJNI.new_ClusteringParameters(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/DistanceComputer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/DistanceComputer.java
new file mode 100644
index 000000000..251ede16f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/DistanceComputer.java
@@ -0,0 +1,47 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class DistanceComputer {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected DistanceComputer(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(DistanceComputer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_DistanceComputer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void set_query(SWIGTYPE_p_float x) {
+ swigfaissJNI.DistanceComputer_set_query(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public float symmetric_dis(long i, long j) {
+ return swigfaissJNI.DistanceComputer_symmetric_dis(swigCPtr, this, i, j);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/DoubleVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/DoubleVector.java
new file mode 100644
index 000000000..c58001498
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/DoubleVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class DoubleVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected DoubleVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(DoubleVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_DoubleVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public DoubleVector() {
+ this(swigfaissJNI.new_DoubleVector(), true);
+ }
+
+ public void push_back(double arg0) {
+ swigfaissJNI.DoubleVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.DoubleVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_double data() {
+ long cPtr = swigfaissJNI.DoubleVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.DoubleVector_size(swigCPtr, this);
+ }
+
+ public double at(long n) {
+ return swigfaissJNI.DoubleVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.DoubleVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.DoubleVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(DoubleVector other) {
+ swigfaissJNI.DoubleVector_swap(swigCPtr, this, DoubleVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVector.java
new file mode 100644
index 000000000..7374ce3a2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class FloatVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected FloatVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(FloatVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_FloatVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public FloatVector() {
+ this(swigfaissJNI.new_FloatVector(), true);
+ }
+
+ public void push_back(float arg0) {
+ swigfaissJNI.FloatVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.FloatVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_float data() {
+ long cPtr = swigfaissJNI.FloatVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.FloatVector_size(swigCPtr, this);
+ }
+
+ public float at(long n) {
+ return swigfaissJNI.FloatVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.FloatVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.FloatVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(FloatVector other) {
+ swigfaissJNI.FloatVector_swap(swigCPtr, this, FloatVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVectorVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVectorVector.java
new file mode 100644
index 000000000..2aa7afbd2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/FloatVectorVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class FloatVectorVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected FloatVectorVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(FloatVectorVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_FloatVectorVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public FloatVectorVector() {
+ this(swigfaissJNI.new_FloatVectorVector(), true);
+ }
+
+ public void push_back(FloatVector arg0) {
+ swigfaissJNI.FloatVectorVector_push_back(swigCPtr, this, FloatVector.getCPtr(arg0), arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.FloatVectorVector_clear(swigCPtr, this);
+ }
+
+ public FloatVector data() {
+ long cPtr = swigfaissJNI.FloatVectorVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.FloatVectorVector_size(swigCPtr, this);
+ }
+
+ public FloatVector at(long n) {
+ return new FloatVector(swigfaissJNI.FloatVectorVector_at(swigCPtr, this, n), true);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.FloatVectorVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.FloatVectorVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(FloatVectorVector other) {
+ swigfaissJNI.FloatVectorVector_swap(swigCPtr, this, FloatVectorVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer16.java b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer16.java
new file mode 100644
index 000000000..2986d07de
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer16.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class GenHammingComputer16 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected GenHammingComputer16(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(GenHammingComputer16 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_GenHammingComputer16(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.GenHammingComputer16_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.GenHammingComputer16_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.GenHammingComputer16_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.GenHammingComputer16_a1_get(swigCPtr, this);
+ }
+
+ public GenHammingComputer16(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_GenHammingComputer16(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.GenHammingComputer16_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer32.java b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer32.java
new file mode 100644
index 000000000..284a6ac8c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer32.java
@@ -0,0 +1,79 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class GenHammingComputer32 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected GenHammingComputer32(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(GenHammingComputer32 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_GenHammingComputer32(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.GenHammingComputer32_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.GenHammingComputer32_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.GenHammingComputer32_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.GenHammingComputer32_a1_get(swigCPtr, this);
+ }
+
+ public void setA2(long value) {
+ swigfaissJNI.GenHammingComputer32_a2_set(swigCPtr, this, value);
+ }
+
+ public long getA2() {
+ return swigfaissJNI.GenHammingComputer32_a2_get(swigCPtr, this);
+ }
+
+ public void setA3(long value) {
+ swigfaissJNI.GenHammingComputer32_a3_set(swigCPtr, this, value);
+ }
+
+ public long getA3() {
+ return swigfaissJNI.GenHammingComputer32_a3_get(swigCPtr, this);
+ }
+
+ public GenHammingComputer32(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_GenHammingComputer32(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.GenHammingComputer32_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer8.java
new file mode 100644
index 000000000..063b873df
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputer8.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class GenHammingComputer8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected GenHammingComputer8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(GenHammingComputer8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_GenHammingComputer8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.GenHammingComputer8_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.GenHammingComputer8_a0_get(swigCPtr, this);
+ }
+
+ public GenHammingComputer8(SWIGTYPE_p_unsigned_char a, int code_size) {
+ this(swigfaissJNI.new_GenHammingComputer8(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b) {
+ return swigfaissJNI.GenHammingComputer8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputerM8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputerM8.java
new file mode 100644
index 000000000..89ba44588
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/GenHammingComputerM8.java
@@ -0,0 +1,64 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class GenHammingComputerM8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected GenHammingComputerM8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(GenHammingComputerM8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_GenHammingComputerM8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA(SWIGTYPE_p_unsigned_long value) {
+ swigfaissJNI.GenHammingComputerM8_a_set(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_long getA() {
+ long cPtr = swigfaissJNI.GenHammingComputerM8_a_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.GenHammingComputerM8_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.GenHammingComputerM8_n_get(swigCPtr, this);
+ }
+
+ public GenHammingComputerM8(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_GenHammingComputerM8(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.GenHammingComputerM8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HNSW.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HNSW.java
new file mode 100644
index 000000000..5be46f042
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HNSW.java
@@ -0,0 +1,437 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HNSW {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HNSW(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HNSW obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HNSW(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ static public class MinimaxHeap {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected MinimaxHeap(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(MinimaxHeap obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HNSW_MinimaxHeap(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.HNSW_MinimaxHeap_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.HNSW_MinimaxHeap_n_get(swigCPtr, this);
+ }
+
+ public void setK(int value) {
+ swigfaissJNI.HNSW_MinimaxHeap_k_set(swigCPtr, this, value);
+ }
+
+ public int getK() {
+ return swigfaissJNI.HNSW_MinimaxHeap_k_get(swigCPtr, this);
+ }
+
+ public void setNvalid(int value) {
+ swigfaissJNI.HNSW_MinimaxHeap_nvalid_set(swigCPtr, this, value);
+ }
+
+ public int getNvalid() {
+ return swigfaissJNI.HNSW_MinimaxHeap_nvalid_get(swigCPtr, this);
+ }
+
+ public void setIds(IntVector value) {
+ swigfaissJNI.HNSW_MinimaxHeap_ids_set(swigCPtr, this, IntVector.getCPtr(value), value);
+ }
+
+ public IntVector getIds() {
+ long cPtr = swigfaissJNI.HNSW_MinimaxHeap_ids_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IntVector(cPtr, false);
+ }
+
+ public void setDis(FloatVector value) {
+ swigfaissJNI.HNSW_MinimaxHeap_dis_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getDis() {
+ long cPtr = swigfaissJNI.HNSW_MinimaxHeap_dis_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public MinimaxHeap(int n) {
+ this(swigfaissJNI.new_HNSW_MinimaxHeap(n), true);
+ }
+
+ public void push(int i, float v) {
+ swigfaissJNI.HNSW_MinimaxHeap_push(swigCPtr, this, i, v);
+ }
+
+ public float max() {
+ return swigfaissJNI.HNSW_MinimaxHeap_max(swigCPtr, this);
+ }
+
+ public int size() {
+ return swigfaissJNI.HNSW_MinimaxHeap_size(swigCPtr, this);
+ }
+
+ public void clear() {
+ swigfaissJNI.HNSW_MinimaxHeap_clear(swigCPtr, this);
+ }
+
+ public int pop_min(SWIGTYPE_p_float vmin_out) {
+ return swigfaissJNI.HNSW_MinimaxHeap_pop_min__SWIG_0(swigCPtr, this, SWIGTYPE_p_float.getCPtr(vmin_out));
+ }
+
+ public int pop_min() {
+ return swigfaissJNI.HNSW_MinimaxHeap_pop_min__SWIG_1(swigCPtr, this);
+ }
+
+ public int count_below(float thresh) {
+ return swigfaissJNI.HNSW_MinimaxHeap_count_below(swigCPtr, this, thresh);
+ }
+
+ }
+
+ static public class NodeDistCloser {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected NodeDistCloser(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(NodeDistCloser obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HNSW_NodeDistCloser(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD(float value) {
+ swigfaissJNI.HNSW_NodeDistCloser_d_set(swigCPtr, this, value);
+ }
+
+ public float getD() {
+ return swigfaissJNI.HNSW_NodeDistCloser_d_get(swigCPtr, this);
+ }
+
+ public void setId(int value) {
+ swigfaissJNI.HNSW_NodeDistCloser_id_set(swigCPtr, this, value);
+ }
+
+ public int getId() {
+ return swigfaissJNI.HNSW_NodeDistCloser_id_get(swigCPtr, this);
+ }
+
+ public NodeDistCloser(float d, int id) {
+ this(swigfaissJNI.new_HNSW_NodeDistCloser(d, id), true);
+ }
+
+ }
+
+ static public class NodeDistFarther {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected NodeDistFarther(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(NodeDistFarther obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HNSW_NodeDistFarther(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD(float value) {
+ swigfaissJNI.HNSW_NodeDistFarther_d_set(swigCPtr, this, value);
+ }
+
+ public float getD() {
+ return swigfaissJNI.HNSW_NodeDistFarther_d_get(swigCPtr, this);
+ }
+
+ public void setId(int value) {
+ swigfaissJNI.HNSW_NodeDistFarther_id_set(swigCPtr, this, value);
+ }
+
+ public int getId() {
+ return swigfaissJNI.HNSW_NodeDistFarther_id_get(swigCPtr, this);
+ }
+
+ public NodeDistFarther(float d, int id) {
+ this(swigfaissJNI.new_HNSW_NodeDistFarther(d, id), true);
+ }
+
+ }
+
+ public void setAssign_probas(DoubleVector value) {
+ swigfaissJNI.HNSW_assign_probas_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
+ }
+
+ public DoubleVector getAssign_probas() {
+ long cPtr = swigfaissJNI.HNSW_assign_probas_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
+ }
+
+ public void setCum_nneighbor_per_level(IntVector value) {
+ swigfaissJNI.HNSW_cum_nneighbor_per_level_set(swigCPtr, this, IntVector.getCPtr(value), value);
+ }
+
+ public IntVector getCum_nneighbor_per_level() {
+ long cPtr = swigfaissJNI.HNSW_cum_nneighbor_per_level_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IntVector(cPtr, false);
+ }
+
+ public void setLevels(IntVector value) {
+ swigfaissJNI.HNSW_levels_set(swigCPtr, this, IntVector.getCPtr(value), value);
+ }
+
+ public IntVector getLevels() {
+ long cPtr = swigfaissJNI.HNSW_levels_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IntVector(cPtr, false);
+ }
+
+ public void setOffsets(Uint64Vector value) {
+ swigfaissJNI.HNSW_offsets_set(swigCPtr, this, Uint64Vector.getCPtr(value), value);
+ }
+
+ public Uint64Vector getOffsets() {
+ long cPtr = swigfaissJNI.HNSW_offsets_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Uint64Vector(cPtr, false);
+ }
+
+ public void setNeighbors(IntVector value) {
+ swigfaissJNI.HNSW_neighbors_set(swigCPtr, this, IntVector.getCPtr(value), value);
+ }
+
+ public IntVector getNeighbors() {
+ long cPtr = swigfaissJNI.HNSW_neighbors_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IntVector(cPtr, false);
+ }
+
+ public void setEntry_point(int value) {
+ swigfaissJNI.HNSW_entry_point_set(swigCPtr, this, value);
+ }
+
+ public int getEntry_point() {
+ return swigfaissJNI.HNSW_entry_point_get(swigCPtr, this);
+ }
+
+ public void setRng(SWIGTYPE_p_faiss__RandomGenerator value) {
+ swigfaissJNI.HNSW_rng_set(swigCPtr, this, SWIGTYPE_p_faiss__RandomGenerator.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__RandomGenerator getRng() {
+ long cPtr = swigfaissJNI.HNSW_rng_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__RandomGenerator(cPtr, false);
+ }
+
+ public void setMax_level(int value) {
+ swigfaissJNI.HNSW_max_level_set(swigCPtr, this, value);
+ }
+
+ public int getMax_level() {
+ return swigfaissJNI.HNSW_max_level_get(swigCPtr, this);
+ }
+
+ public void setEfConstruction(int value) {
+ swigfaissJNI.HNSW_efConstruction_set(swigCPtr, this, value);
+ }
+
+ public int getEfConstruction() {
+ return swigfaissJNI.HNSW_efConstruction_get(swigCPtr, this);
+ }
+
+ public void setEfSearch(int value) {
+ swigfaissJNI.HNSW_efSearch_set(swigCPtr, this, value);
+ }
+
+ public int getEfSearch() {
+ return swigfaissJNI.HNSW_efSearch_get(swigCPtr, this);
+ }
+
+ public void setCheck_relative_distance(boolean value) {
+ swigfaissJNI.HNSW_check_relative_distance_set(swigCPtr, this, value);
+ }
+
+ public boolean getCheck_relative_distance() {
+ return swigfaissJNI.HNSW_check_relative_distance_get(swigCPtr, this);
+ }
+
+ public void setUpper_beam(int value) {
+ swigfaissJNI.HNSW_upper_beam_set(swigCPtr, this, value);
+ }
+
+ public int getUpper_beam() {
+ return swigfaissJNI.HNSW_upper_beam_get(swigCPtr, this);
+ }
+
+ public void setSearch_bounded_queue(boolean value) {
+ swigfaissJNI.HNSW_search_bounded_queue_set(swigCPtr, this, value);
+ }
+
+ public boolean getSearch_bounded_queue() {
+ return swigfaissJNI.HNSW_search_bounded_queue_get(swigCPtr, this);
+ }
+
+ public void set_default_probas(int M, float levelMult) {
+ swigfaissJNI.HNSW_set_default_probas(swigCPtr, this, M, levelMult);
+ }
+
+ public void set_nb_neighbors(int level_no, int n) {
+ swigfaissJNI.HNSW_set_nb_neighbors(swigCPtr, this, level_no, n);
+ }
+
+ public int nb_neighbors(int layer_no) {
+ return swigfaissJNI.HNSW_nb_neighbors(swigCPtr, this, layer_no);
+ }
+
+ public int cum_nb_neighbors(int layer_no) {
+ return swigfaissJNI.HNSW_cum_nb_neighbors(swigCPtr, this, layer_no);
+ }
+
+ public void neighbor_range(long no, int layer_no, SWIGTYPE_p_unsigned_long begin, SWIGTYPE_p_unsigned_long end) {
+ swigfaissJNI.HNSW_neighbor_range(swigCPtr, this, no, layer_no, SWIGTYPE_p_unsigned_long.getCPtr(begin), SWIGTYPE_p_unsigned_long.getCPtr(end));
+ }
+
+ public HNSW(int M) {
+ this(swigfaissJNI.new_HNSW__SWIG_0(M), true);
+ }
+
+ public HNSW() {
+ this(swigfaissJNI.new_HNSW__SWIG_1(), true);
+ }
+
+ public int random_level() {
+ return swigfaissJNI.HNSW_random_level(swigCPtr, this);
+ }
+
+ public void fill_with_random_links(long n) {
+ swigfaissJNI.HNSW_fill_with_random_links(swigCPtr, this, n);
+ }
+
+ public void add_links_starting_from(DistanceComputer ptdis, int pt_id, int nearest, float d_nearest, int level, SWIGTYPE_p_omp_lock_t locks, VisitedTable vt) {
+ swigfaissJNI.HNSW_add_links_starting_from(swigCPtr, this, DistanceComputer.getCPtr(ptdis), ptdis, pt_id, nearest, d_nearest, level, SWIGTYPE_p_omp_lock_t.getCPtr(locks), VisitedTable.getCPtr(vt), vt);
+ }
+
+ public void add_with_locks(DistanceComputer ptdis, int pt_level, int pt_id, SWIGTYPE_p_std__vectorT_omp_lock_t_t locks, VisitedTable vt) {
+ swigfaissJNI.HNSW_add_with_locks(swigCPtr, this, DistanceComputer.getCPtr(ptdis), ptdis, pt_level, pt_id, SWIGTYPE_p_std__vectorT_omp_lock_t_t.getCPtr(locks), VisitedTable.getCPtr(vt), vt);
+ }
+
+ public int search_from_candidates(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, HNSW.MinimaxHeap candidates, VisitedTable vt, HNSWStats stats, int level, int nres_in) {
+ return swigfaissJNI.HNSW_search_from_candidates__SWIG_0(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), HNSW.MinimaxHeap.getCPtr(candidates), candidates, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats, level, nres_in);
+ }
+
+ public int search_from_candidates(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, HNSW.MinimaxHeap candidates, VisitedTable vt, HNSWStats stats, int level) {
+ return swigfaissJNI.HNSW_search_from_candidates__SWIG_1(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), HNSW.MinimaxHeap.getCPtr(candidates), candidates, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats, level);
+ }
+
+ public SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t search_from_candidate_unbounded(SWIGTYPE_p_std__pairT_float_int_t node, DistanceComputer qdis, int ef, VisitedTable vt, HNSWStats stats) {
+ return new SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t(swigfaissJNI.HNSW_search_from_candidate_unbounded(swigCPtr, this, SWIGTYPE_p_std__pairT_float_int_t.getCPtr(node), DistanceComputer.getCPtr(qdis), qdis, ef, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats), true);
+ }
+
+ public HNSWStats search(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, VisitedTable vt) {
+ return new HNSWStats(swigfaissJNI.HNSW_search(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), VisitedTable.getCPtr(vt), vt), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.HNSW_reset(swigCPtr, this);
+ }
+
+ public void clear_neighbor_tables(int level) {
+ swigfaissJNI.HNSW_clear_neighbor_tables(swigCPtr, this, level);
+ }
+
+ public void print_neighbor_stats(int level) {
+ swigfaissJNI.HNSW_print_neighbor_stats(swigCPtr, this, level);
+ }
+
+ public int prepare_level_tab(long n, boolean preset_levels) {
+ return swigfaissJNI.HNSW_prepare_level_tab__SWIG_0(swigCPtr, this, n, preset_levels);
+ }
+
+ public int prepare_level_tab(long n) {
+ return swigfaissJNI.HNSW_prepare_level_tab__SWIG_1(swigCPtr, this, n);
+ }
+
+ public static void shrink_neighbor_list(DistanceComputer qdis, SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t input, SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t output, int max_size) {
+ swigfaissJNI.HNSW_shrink_neighbor_list(DistanceComputer.getCPtr(qdis), qdis, SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t.getCPtr(input), SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t.getCPtr(output), max_size);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HNSWStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HNSWStats.java
new file mode 100644
index 000000000..baf388f5a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HNSWStats.java
@@ -0,0 +1,111 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HNSWStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HNSWStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HNSWStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HNSWStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setN1(long value) {
+ swigfaissJNI.HNSWStats_n1_set(swigCPtr, this, value);
+ }
+
+ public long getN1() {
+ return swigfaissJNI.HNSWStats_n1_get(swigCPtr, this);
+ }
+
+ public void setN2(long value) {
+ swigfaissJNI.HNSWStats_n2_set(swigCPtr, this, value);
+ }
+
+ public long getN2() {
+ return swigfaissJNI.HNSWStats_n2_get(swigCPtr, this);
+ }
+
+ public void setN3(long value) {
+ swigfaissJNI.HNSWStats_n3_set(swigCPtr, this, value);
+ }
+
+ public long getN3() {
+ return swigfaissJNI.HNSWStats_n3_get(swigCPtr, this);
+ }
+
+ public void setNdis(long value) {
+ swigfaissJNI.HNSWStats_ndis_set(swigCPtr, this, value);
+ }
+
+ public long getNdis() {
+ return swigfaissJNI.HNSWStats_ndis_get(swigCPtr, this);
+ }
+
+ public void setNreorder(long value) {
+ swigfaissJNI.HNSWStats_nreorder_set(swigCPtr, this, value);
+ }
+
+ public long getNreorder() {
+ return swigfaissJNI.HNSWStats_nreorder_get(swigCPtr, this);
+ }
+
+ public HNSWStats(long n1, long n2, long n3, long ndis, long nreorder) {
+ this(swigfaissJNI.new_HNSWStats__SWIG_0(n1, n2, n3, ndis, nreorder), true);
+ }
+
+ public HNSWStats(long n1, long n2, long n3, long ndis) {
+ this(swigfaissJNI.new_HNSWStats__SWIG_1(n1, n2, n3, ndis), true);
+ }
+
+ public HNSWStats(long n1, long n2, long n3) {
+ this(swigfaissJNI.new_HNSWStats__SWIG_2(n1, n2, n3), true);
+ }
+
+ public HNSWStats(long n1, long n2) {
+ this(swigfaissJNI.new_HNSWStats__SWIG_3(n1, n2), true);
+ }
+
+ public HNSWStats(long n1) {
+ this(swigfaissJNI.new_HNSWStats__SWIG_4(n1), true);
+ }
+
+ public HNSWStats() {
+ this(swigfaissJNI.new_HNSWStats__SWIG_5(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.HNSWStats_reset(swigCPtr, this);
+ }
+
+ public void combine(HNSWStats other) {
+ swigfaissJNI.HNSWStats_combine(swigCPtr, this, HNSWStats.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HStackInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HStackInvertedLists.java
new file mode 100644
index 000000000..52e5c3b8c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HStackInvertedLists.java
@@ -0,0 +1,86 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HStackInvertedLists extends ReadOnlyInvertedLists {
+ private transient long swigCPtr;
+
+ protected HStackInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.HStackInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HStackInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HStackInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIls(SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t value) {
+ swigfaissJNI.HStackInvertedLists_ils_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t getIls() {
+ long cPtr = swigfaissJNI.HStackInvertedLists_ils_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t(cPtr, false);
+ }
+
+ public HStackInvertedLists(int nil, SWIGTYPE_p_p_faiss__InvertedLists ils) {
+ this(swigfaissJNI.new_HStackInvertedLists(nil, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils)), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.HStackInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.HStackInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.HStackInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.HStackInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.HStackInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.HStackInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.HStackInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.HStackInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer16.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer16.java
new file mode 100644
index 000000000..14727d083
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer16.java
@@ -0,0 +1,71 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer16 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer16(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer16 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer16(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.HammingComputer16_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.HammingComputer16_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.HammingComputer16_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.HammingComputer16_a1_get(swigCPtr, this);
+ }
+
+ public HammingComputer16() {
+ this(swigfaissJNI.new_HammingComputer16__SWIG_0(), true);
+ }
+
+ public HammingComputer16(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputer16__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputer16_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputer16_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer20.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer20.java
new file mode 100644
index 000000000..68857db2b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer20.java
@@ -0,0 +1,79 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer20 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer20(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer20 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer20(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.HammingComputer20_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.HammingComputer20_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.HammingComputer20_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.HammingComputer20_a1_get(swigCPtr, this);
+ }
+
+ public void setA2(SWIGTYPE_p_uint32_t value) {
+ swigfaissJNI.HammingComputer20_a2_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_uint32_t getA2() {
+ return new SWIGTYPE_p_uint32_t(swigfaissJNI.HammingComputer20_a2_get(swigCPtr, this), true);
+ }
+
+ public HammingComputer20() {
+ this(swigfaissJNI.new_HammingComputer20__SWIG_0(), true);
+ }
+
+ public HammingComputer20(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputer20__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputer20_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputer20_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer32.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer32.java
new file mode 100644
index 000000000..78207d8eb
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer32.java
@@ -0,0 +1,87 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer32 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer32(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer32 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer32(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.HammingComputer32_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.HammingComputer32_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.HammingComputer32_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.HammingComputer32_a1_get(swigCPtr, this);
+ }
+
+ public void setA2(long value) {
+ swigfaissJNI.HammingComputer32_a2_set(swigCPtr, this, value);
+ }
+
+ public long getA2() {
+ return swigfaissJNI.HammingComputer32_a2_get(swigCPtr, this);
+ }
+
+ public void setA3(long value) {
+ swigfaissJNI.HammingComputer32_a3_set(swigCPtr, this, value);
+ }
+
+ public long getA3() {
+ return swigfaissJNI.HammingComputer32_a3_get(swigCPtr, this);
+ }
+
+ public HammingComputer32() {
+ this(swigfaissJNI.new_HammingComputer32__SWIG_0(), true);
+ }
+
+ public HammingComputer32(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputer32__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputer32_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputer32_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer4.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer4.java
new file mode 100644
index 000000000..3f8b67605
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer4.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer4 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer4(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer4 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer4(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(SWIGTYPE_p_uint32_t value) {
+ swigfaissJNI.HammingComputer4_a0_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_uint32_t getA0() {
+ return new SWIGTYPE_p_uint32_t(swigfaissJNI.HammingComputer4_a0_get(swigCPtr, this), true);
+ }
+
+ public HammingComputer4() {
+ this(swigfaissJNI.new_HammingComputer4__SWIG_0(), true);
+ }
+
+ public HammingComputer4(SWIGTYPE_p_unsigned_char a, int code_size) {
+ this(swigfaissJNI.new_HammingComputer4__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a, int code_size) {
+ swigfaissJNI.HammingComputer4_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b) {
+ return swigfaissJNI.HammingComputer4_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer64.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer64.java
new file mode 100644
index 000000000..d1962d367
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer64.java
@@ -0,0 +1,119 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer64 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer64(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer64 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer64(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.HammingComputer64_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.HammingComputer64_a0_get(swigCPtr, this);
+ }
+
+ public void setA1(long value) {
+ swigfaissJNI.HammingComputer64_a1_set(swigCPtr, this, value);
+ }
+
+ public long getA1() {
+ return swigfaissJNI.HammingComputer64_a1_get(swigCPtr, this);
+ }
+
+ public void setA2(long value) {
+ swigfaissJNI.HammingComputer64_a2_set(swigCPtr, this, value);
+ }
+
+ public long getA2() {
+ return swigfaissJNI.HammingComputer64_a2_get(swigCPtr, this);
+ }
+
+ public void setA3(long value) {
+ swigfaissJNI.HammingComputer64_a3_set(swigCPtr, this, value);
+ }
+
+ public long getA3() {
+ return swigfaissJNI.HammingComputer64_a3_get(swigCPtr, this);
+ }
+
+ public void setA4(long value) {
+ swigfaissJNI.HammingComputer64_a4_set(swigCPtr, this, value);
+ }
+
+ public long getA4() {
+ return swigfaissJNI.HammingComputer64_a4_get(swigCPtr, this);
+ }
+
+ public void setA5(long value) {
+ swigfaissJNI.HammingComputer64_a5_set(swigCPtr, this, value);
+ }
+
+ public long getA5() {
+ return swigfaissJNI.HammingComputer64_a5_get(swigCPtr, this);
+ }
+
+ public void setA6(long value) {
+ swigfaissJNI.HammingComputer64_a6_set(swigCPtr, this, value);
+ }
+
+ public long getA6() {
+ return swigfaissJNI.HammingComputer64_a6_get(swigCPtr, this);
+ }
+
+ public void setA7(long value) {
+ swigfaissJNI.HammingComputer64_a7_set(swigCPtr, this, value);
+ }
+
+ public long getA7() {
+ return swigfaissJNI.HammingComputer64_a7_get(swigCPtr, this);
+ }
+
+ public HammingComputer64() {
+ this(swigfaissJNI.new_HammingComputer64__SWIG_0(), true);
+ }
+
+ public HammingComputer64(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputer64__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputer64_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputer64_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer8.java
new file mode 100644
index 000000000..16c7eb8a9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputer8.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputer8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputer8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputer8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputer8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA0(long value) {
+ swigfaissJNI.HammingComputer8_a0_set(swigCPtr, this, value);
+ }
+
+ public long getA0() {
+ return swigfaissJNI.HammingComputer8_a0_get(swigCPtr, this);
+ }
+
+ public HammingComputer8() {
+ this(swigfaissJNI.new_HammingComputer8__SWIG_0(), true);
+ }
+
+ public HammingComputer8(SWIGTYPE_p_unsigned_char a, int code_size) {
+ this(swigfaissJNI.new_HammingComputer8__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a, int code_size) {
+ swigfaissJNI.HammingComputer8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b) {
+ return swigfaissJNI.HammingComputer8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerDefault.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerDefault.java
new file mode 100644
index 000000000..b569f8ed0
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerDefault.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputerDefault {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputerDefault(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputerDefault obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputerDefault(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA8(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.HammingComputerDefault_a8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getA8() {
+ long cPtr = swigfaissJNI.HammingComputerDefault_a8_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setQuotient8(int value) {
+ swigfaissJNI.HammingComputerDefault_quotient8_set(swigCPtr, this, value);
+ }
+
+ public int getQuotient8() {
+ return swigfaissJNI.HammingComputerDefault_quotient8_get(swigCPtr, this);
+ }
+
+ public void setRemainder8(int value) {
+ swigfaissJNI.HammingComputerDefault_remainder8_set(swigCPtr, this, value);
+ }
+
+ public int getRemainder8() {
+ return swigfaissJNI.HammingComputerDefault_remainder8_get(swigCPtr, this);
+ }
+
+ public HammingComputerDefault() {
+ this(swigfaissJNI.new_HammingComputerDefault__SWIG_0(), true);
+ }
+
+ public HammingComputerDefault(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputerDefault__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputerDefault_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputerDefault_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM4.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM4.java
new file mode 100644
index 000000000..386fbda61
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM4.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputerM4 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputerM4(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputerM4 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputerM4(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA(SWIGTYPE_p_uint32_t value) {
+ swigfaissJNI.HammingComputerM4_a_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_uint32_t getA() {
+ long cPtr = swigfaissJNI.HammingComputerM4_a_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_uint32_t(cPtr, false);
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.HammingComputerM4_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.HammingComputerM4_n_get(swigCPtr, this);
+ }
+
+ public HammingComputerM4() {
+ this(swigfaissJNI.new_HammingComputerM4__SWIG_0(), true);
+ }
+
+ public HammingComputerM4(SWIGTYPE_p_unsigned_char a4, int code_size) {
+ this(swigfaissJNI.new_HammingComputerM4__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a4), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a4, int code_size) {
+ swigfaissJNI.HammingComputerM4_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a4), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputerM4_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM8.java
new file mode 100644
index 000000000..24a520476
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/HammingComputerM8.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class HammingComputerM8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected HammingComputerM8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(HammingComputerM8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_HammingComputerM8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setA(SWIGTYPE_p_unsigned_long value) {
+ swigfaissJNI.HammingComputerM8_a_set(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_long getA() {
+ long cPtr = swigfaissJNI.HammingComputerM8_a_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.HammingComputerM8_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.HammingComputerM8_n_get(swigCPtr, this);
+ }
+
+ public HammingComputerM8() {
+ this(swigfaissJNI.new_HammingComputerM8__SWIG_0(), true);
+ }
+
+ public HammingComputerM8(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ this(swigfaissJNI.new_HammingComputerM8__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
+ }
+
+ public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
+ swigfaissJNI.HammingComputerM8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
+ }
+
+ public int hamming(SWIGTYPE_p_unsigned_char b8) {
+ return swigfaissJNI.HammingComputerM8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelector.java
new file mode 100644
index 000000000..893f28bb2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelector.java
@@ -0,0 +1,43 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IDSelector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IDSelector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IDSelector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IDSelector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public boolean is_member(long id) {
+ return swigfaissJNI.IDSelector_is_member(swigCPtr, this, id);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorArray.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorArray.java
new file mode 100644
index 000000000..42c4860f2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorArray.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IDSelectorArray extends IDSelector {
+ private transient long swigCPtr;
+
+ protected IDSelectorArray(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IDSelectorArray_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IDSelectorArray obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IDSelectorArray(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setN(long value) {
+ swigfaissJNI.IDSelectorArray_n_set(swigCPtr, this, value);
+ }
+
+ public long getN() {
+ return swigfaissJNI.IDSelectorArray_n_get(swigCPtr, this);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.IDSelectorArray_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.IDSelectorArray_ids_get(swigCPtr, this), false);
+}
+
+ public IDSelectorArray(long n, LongVector ids) {
+ this(swigfaissJNI.new_IDSelectorArray(n, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids), true);
+ }
+
+ public boolean is_member(long id) {
+ return swigfaissJNI.IDSelectorArray_is_member(swigCPtr, this, id);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorBatch.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorBatch.java
new file mode 100644
index 000000000..69988c1be
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorBatch.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IDSelectorBatch extends IDSelector {
+ private transient long swigCPtr;
+
+ protected IDSelectorBatch(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IDSelectorBatch_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IDSelectorBatch obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IDSelectorBatch(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setNbits(int value) {
+ swigfaissJNI.IDSelectorBatch_nbits_set(swigCPtr, this, value);
+ }
+
+ public int getNbits() {
+ return swigfaissJNI.IDSelectorBatch_nbits_get(swigCPtr, this);
+ }
+
+ public void setMask(long value) {
+ swigfaissJNI.IDSelectorBatch_mask_set(swigCPtr, this, value);
+ }
+
+ public long getMask() {
+ return swigfaissJNI.IDSelectorBatch_mask_get(swigCPtr, this);
+}
+
+ public IDSelectorBatch(long n, LongVector indices) {
+ this(swigfaissJNI.new_IDSelectorBatch(n, SWIGTYPE_p_long_long.getCPtr(indices.data()), indices), true);
+ }
+
+ public boolean is_member(long id) {
+ return swigfaissJNI.IDSelectorBatch_is_member(swigCPtr, this, id);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorRange.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorRange.java
new file mode 100644
index 000000000..c8f49eb88
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IDSelectorRange.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IDSelectorRange extends IDSelector {
+ private transient long swigCPtr;
+
+ protected IDSelectorRange(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IDSelectorRange_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IDSelectorRange obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IDSelectorRange(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setImin(long value) {
+ swigfaissJNI.IDSelectorRange_imin_set(swigCPtr, this, value);
+ }
+
+ public long getImin() {
+ return swigfaissJNI.IDSelectorRange_imin_get(swigCPtr, this);
+}
+
+ public void setImax(long value) {
+ swigfaissJNI.IDSelectorRange_imax_set(swigCPtr, this, value);
+ }
+
+ public long getImax() {
+ return swigfaissJNI.IDSelectorRange_imax_get(swigCPtr, this);
+}
+
+ public IDSelectorRange(long imin, long imax) {
+ this(swigfaissJNI.new_IDSelectorRange(imin, imax), true);
+ }
+
+ public boolean is_member(long id) {
+ return swigfaissJNI.IDSelectorRange_is_member(swigCPtr, this, id);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ITQMatrix.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ITQMatrix.java
new file mode 100644
index 000000000..333577c44
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ITQMatrix.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ITQMatrix extends LinearTransform {
+ private transient long swigCPtr;
+
+ protected ITQMatrix(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ITQMatrix_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ITQMatrix obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ITQMatrix(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setMax_iter(int value) {
+ swigfaissJNI.ITQMatrix_max_iter_set(swigCPtr, this, value);
+ }
+
+ public int getMax_iter() {
+ return swigfaissJNI.ITQMatrix_max_iter_get(swigCPtr, this);
+ }
+
+ public void setSeed(int value) {
+ swigfaissJNI.ITQMatrix_seed_set(swigCPtr, this, value);
+ }
+
+ public int getSeed() {
+ return swigfaissJNI.ITQMatrix_seed_get(swigCPtr, this);
+ }
+
+ public void setInit_rotation(DoubleVector value) {
+ swigfaissJNI.ITQMatrix_init_rotation_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
+ }
+
+ public DoubleVector getInit_rotation() {
+ long cPtr = swigfaissJNI.ITQMatrix_init_rotation_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
+ }
+
+ public ITQMatrix(int d) {
+ this(swigfaissJNI.new_ITQMatrix__SWIG_0(d), true);
+ }
+
+ public ITQMatrix() {
+ this(swigfaissJNI.new_ITQMatrix__SWIG_1(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.ITQMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ITQTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ITQTransform.java
new file mode 100644
index 000000000..42196648d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ITQTransform.java
@@ -0,0 +1,106 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ITQTransform extends VectorTransform {
+ private transient long swigCPtr;
+
+ protected ITQTransform(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ITQTransform_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ITQTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ITQTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setMean(FloatVector value) {
+ swigfaissJNI.ITQTransform_mean_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getMean() {
+ long cPtr = swigfaissJNI.ITQTransform_mean_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setDo_pca(boolean value) {
+ swigfaissJNI.ITQTransform_do_pca_set(swigCPtr, this, value);
+ }
+
+ public boolean getDo_pca() {
+ return swigfaissJNI.ITQTransform_do_pca_get(swigCPtr, this);
+ }
+
+ public void setItq(ITQMatrix value) {
+ swigfaissJNI.ITQTransform_itq_set(swigCPtr, this, ITQMatrix.getCPtr(value), value);
+ }
+
+ public ITQMatrix getItq() {
+ long cPtr = swigfaissJNI.ITQTransform_itq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ITQMatrix(cPtr, false);
+ }
+
+ public void setMax_train_per_dim(int value) {
+ swigfaissJNI.ITQTransform_max_train_per_dim_set(swigCPtr, this, value);
+ }
+
+ public int getMax_train_per_dim() {
+ return swigfaissJNI.ITQTransform_max_train_per_dim_get(swigCPtr, this);
+ }
+
+ public void setPca_then_itq(LinearTransform value) {
+ swigfaissJNI.ITQTransform_pca_then_itq_set(swigCPtr, this, LinearTransform.getCPtr(value), value);
+ }
+
+ public LinearTransform getPca_then_itq() {
+ long cPtr = swigfaissJNI.ITQTransform_pca_then_itq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new LinearTransform(cPtr, false);
+ }
+
+ public ITQTransform(int d_in, int d_out, boolean do_pca) {
+ this(swigfaissJNI.new_ITQTransform__SWIG_0(d_in, d_out, do_pca), true);
+ }
+
+ public ITQTransform(int d_in, int d_out) {
+ this(swigfaissJNI.new_ITQTransform__SWIG_1(d_in, d_out), true);
+ }
+
+ public ITQTransform(int d_in) {
+ this(swigfaissJNI.new_ITQTransform__SWIG_2(d_in), true);
+ }
+
+ public ITQTransform() {
+ this(swigfaissJNI.new_ITQTransform__SWIG_3(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.ITQTransform_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.ITQTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IVFPQSearchParameters.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IVFPQSearchParameters.java
new file mode 100644
index 000000000..2146f2f56
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IVFPQSearchParameters.java
@@ -0,0 +1,59 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IVFPQSearchParameters extends IVFSearchParameters {
+ private transient long swigCPtr;
+
+ protected IVFPQSearchParameters(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IVFPQSearchParameters_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IVFPQSearchParameters obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IVFPQSearchParameters(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setScan_table_threshold(long value) {
+ swigfaissJNI.IVFPQSearchParameters_scan_table_threshold_set(swigCPtr, this, value);
+ }
+
+ public long getScan_table_threshold() {
+ return swigfaissJNI.IVFPQSearchParameters_scan_table_threshold_get(swigCPtr, this);
+ }
+
+ public void setPolysemous_ht(int value) {
+ swigfaissJNI.IVFPQSearchParameters_polysemous_ht_set(swigCPtr, this, value);
+ }
+
+ public int getPolysemous_ht() {
+ return swigfaissJNI.IVFPQSearchParameters_polysemous_ht_get(swigCPtr, this);
+ }
+
+ public IVFPQSearchParameters() {
+ this(swigfaissJNI.new_IVFPQSearchParameters(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IVFSearchParameters.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IVFSearchParameters.java
new file mode 100644
index 000000000..c5c21dfd7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IVFSearchParameters.java
@@ -0,0 +1,59 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IVFSearchParameters {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IVFSearchParameters(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IVFSearchParameters obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IVFSearchParameters(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNprobe(long value) {
+ swigfaissJNI.IVFSearchParameters_nprobe_set(swigCPtr, this, value);
+ }
+
+ public long getNprobe() {
+ return swigfaissJNI.IVFSearchParameters_nprobe_get(swigCPtr, this);
+ }
+
+ public void setMax_codes(long value) {
+ swigfaissJNI.IVFSearchParameters_max_codes_set(swigCPtr, this, value);
+ }
+
+ public long getMax_codes() {
+ return swigfaissJNI.IVFSearchParameters_max_codes_get(swigCPtr, this);
+ }
+
+ public IVFSearchParameters() {
+ this(swigfaissJNI.new_IVFSearchParameters(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Index.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Index.java
new file mode 100644
index 000000000..a2f04c194
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Index.java
@@ -0,0 +1,165 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Index {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected Index(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Index obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Index(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD(int value) {
+ swigfaissJNI.Index_d_set(swigCPtr, this, value);
+ }
+
+ public int getD() {
+ return swigfaissJNI.Index_d_get(swigCPtr, this);
+ }
+
+ public void setNtotal(long value) {
+ swigfaissJNI.Index_ntotal_set(swigCPtr, this, value);
+ }
+
+ public long getNtotal() {
+ return swigfaissJNI.Index_ntotal_get(swigCPtr, this);
+}
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.Index_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.Index_verbose_get(swigCPtr, this);
+ }
+
+ public void setIs_trained(boolean value) {
+ swigfaissJNI.Index_is_trained_set(swigCPtr, this, value);
+ }
+
+ public boolean getIs_trained() {
+ return swigfaissJNI.Index_is_trained_get(swigCPtr, this);
+ }
+
+ public void setMetric_type(MetricType value) {
+ swigfaissJNI.Index_metric_type_set(swigCPtr, this, value.swigValue());
+ }
+
+ public MetricType getMetric_type() {
+ return MetricType.swigToEnum(swigfaissJNI.Index_metric_type_get(swigCPtr, this));
+ }
+
+ public void setMetric_arg(float value) {
+ swigfaissJNI.Index_metric_arg_set(swigCPtr, this, value);
+ }
+
+ public float getMetric_arg() {
+ return swigfaissJNI.Index_metric_arg_get(swigCPtr, this);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.Index_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.Index_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
+ swigfaissJNI.Index_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.Index_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
+ swigfaissJNI.Index_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void assign(long n, SWIGTYPE_p_float x, LongVector labels, long k) {
+ swigfaissJNI.Index_assign__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, k);
+ }
+
+ public void assign(long n, SWIGTYPE_p_float x, LongVector labels) {
+ swigfaissJNI.Index_assign__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void reset() {
+ swigfaissJNI.Index_reset(swigCPtr, this);
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.Index_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.Index_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
+ swigfaissJNI.Index_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void search_and_reconstruct(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, SWIGTYPE_p_float recons) {
+ swigfaissJNI.Index_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void compute_residual(SWIGTYPE_p_float x, SWIGTYPE_p_float residual, long key) {
+ swigfaissJNI.Index_compute_residual(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(residual), key);
+ }
+
+ public void compute_residual_n(long n, SWIGTYPE_p_float xs, SWIGTYPE_p_float residuals, LongVector keys) {
+ swigfaissJNI.Index_compute_residual_n(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xs), SWIGTYPE_p_float.getCPtr(residuals), SWIGTYPE_p_long_long.getCPtr(keys.data()), keys);
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.Index_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public long sa_code_size() {
+ return swigfaissJNI.Index_sa_code_size(swigCPtr, this);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.Index_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.Index_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public IndexIVF toIVF() {
+ long cPtr = swigfaissJNI.Index_toIVF(swigCPtr, this);
+ return (cPtr == 0) ? null : new IndexIVF(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Index2Layer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Index2Layer.java
new file mode 100644
index 000000000..6045797ad
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Index2Layer.java
@@ -0,0 +1,114 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Index2Layer extends IndexFlatCodes {
+ private transient long swigCPtr;
+
+ protected Index2Layer(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.Index2Layer_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Index2Layer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Index2Layer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setQ1(Level1Quantizer value) {
+ swigfaissJNI.Index2Layer_q1_set(swigCPtr, this, Level1Quantizer.getCPtr(value), value);
+ }
+
+ public Level1Quantizer getQ1() {
+ long cPtr = swigfaissJNI.Index2Layer_q1_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Level1Quantizer(cPtr, false);
+ }
+
+ public void setPq(ProductQuantizer value) {
+ swigfaissJNI.Index2Layer_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
+ }
+
+ public ProductQuantizer getPq() {
+ long cPtr = swigfaissJNI.Index2Layer_pq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
+ }
+
+ public void setCode_size_1(long value) {
+ swigfaissJNI.Index2Layer_code_size_1_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size_1() {
+ return swigfaissJNI.Index2Layer_code_size_1_get(swigCPtr, this);
+ }
+
+ public void setCode_size_2(long value) {
+ swigfaissJNI.Index2Layer_code_size_2_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size_2() {
+ return swigfaissJNI.Index2Layer_code_size_2_get(swigCPtr, this);
+ }
+
+ public Index2Layer(Index quantizer, long nlist, int M, int nbit, MetricType metric) {
+ this(swigfaissJNI.new_Index2Layer__SWIG_0(Index.getCPtr(quantizer), quantizer, nlist, M, nbit, metric.swigValue()), true);
+ }
+
+ public Index2Layer(Index quantizer, long nlist, int M, int nbit) {
+ this(swigfaissJNI.new_Index2Layer__SWIG_1(Index.getCPtr(quantizer), quantizer, nlist, M, nbit), true);
+ }
+
+ public Index2Layer(Index quantizer, long nlist, int M) {
+ this(swigfaissJNI.new_Index2Layer__SWIG_2(Index.getCPtr(quantizer), quantizer, nlist, M), true);
+ }
+
+ public Index2Layer() {
+ this(swigfaissJNI.new_Index2Layer__SWIG_3(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.Index2Layer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.Index2Layer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.Index2Layer_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public void transfer_to_IVFPQ(IndexIVFPQ other) {
+ swigfaissJNI.Index2Layer_transfer_to_IVFPQ(swigCPtr, this, IndexIVFPQ.getCPtr(other), other);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.Index2Layer_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.Index2Layer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinary.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinary.java
new file mode 100644
index 000000000..c60ea69ab
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinary.java
@@ -0,0 +1,139 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexBinary {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IndexBinary(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexBinary obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexBinary(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD(int value) {
+ swigfaissJNI.IndexBinary_d_set(swigCPtr, this, value);
+ }
+
+ public int getD() {
+ return swigfaissJNI.IndexBinary_d_get(swigCPtr, this);
+ }
+
+ public void setCode_size(int value) {
+ swigfaissJNI.IndexBinary_code_size_set(swigCPtr, this, value);
+ }
+
+ public int getCode_size() {
+ return swigfaissJNI.IndexBinary_code_size_get(swigCPtr, this);
+ }
+
+ public void setNtotal(long value) {
+ swigfaissJNI.IndexBinary_ntotal_set(swigCPtr, this, value);
+ }
+
+ public long getNtotal() {
+ return swigfaissJNI.IndexBinary_ntotal_get(swigCPtr, this);
+}
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.IndexBinary_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.IndexBinary_verbose_get(swigCPtr, this);
+ }
+
+ public void setIs_trained(boolean value) {
+ swigfaissJNI.IndexBinary_is_trained_set(swigCPtr, this, value);
+ }
+
+ public boolean getIs_trained() {
+ return swigfaissJNI.IndexBinary_is_trained_get(swigCPtr, this);
+ }
+
+ public void setMetric_type(MetricType value) {
+ swigfaissJNI.IndexBinary_metric_type_set(swigCPtr, this, value.swigValue());
+ }
+
+ public MetricType getMetric_type() {
+ return MetricType.swigToEnum(swigfaissJNI.IndexBinary_metric_type_get(swigCPtr, this));
+ }
+
+ public void train(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinary_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void add(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinary_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_unsigned_char x, LongVector xids) {
+ swigfaissJNI.IndexBinary_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.IndexBinary_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
+ swigfaissJNI.IndexBinary_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void assign(long n, SWIGTYPE_p_unsigned_char x, LongVector labels, long k) {
+ swigfaissJNI.IndexBinary_assign__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, k);
+ }
+
+ public void assign(long n, SWIGTYPE_p_unsigned_char x, LongVector labels) {
+ swigfaissJNI.IndexBinary_assign__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexBinary_reset(swigCPtr, this);
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexBinary_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinary_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void reconstruct_n(long i0, long ni, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinary_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void search_and_reconstruct(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinary_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void display() {
+ swigfaissJNI.IndexBinary_display(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFlat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFlat.java
new file mode 100644
index 000000000..84be3becd
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFlat.java
@@ -0,0 +1,96 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexBinaryFlat extends IndexBinary {
+ private transient long swigCPtr;
+
+ protected IndexBinaryFlat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexBinaryFlat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexBinaryFlat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexBinaryFlat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setXb(ByteVector value) {
+ swigfaissJNI.IndexBinaryFlat_xb_set(swigCPtr, this, ByteVector.getCPtr(value), value);
+ }
+
+ public ByteVector getXb() {
+ long cPtr = swigfaissJNI.IndexBinaryFlat_xb_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVector(cPtr, false);
+ }
+
+ public void setUse_heap(boolean value) {
+ swigfaissJNI.IndexBinaryFlat_use_heap_set(swigCPtr, this, value);
+ }
+
+ public boolean getUse_heap() {
+ return swigfaissJNI.IndexBinaryFlat_use_heap_get(swigCPtr, this);
+ }
+
+ public void setQuery_batch_size(long value) {
+ swigfaissJNI.IndexBinaryFlat_query_batch_size_set(swigCPtr, this, value);
+ }
+
+ public long getQuery_batch_size() {
+ return swigfaissJNI.IndexBinaryFlat_query_batch_size_get(swigCPtr, this);
+ }
+
+ public IndexBinaryFlat(long d) {
+ this(swigfaissJNI.new_IndexBinaryFlat__SWIG_0(d), true);
+ }
+
+ public void add(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryFlat_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexBinaryFlat_reset(swigCPtr, this);
+ }
+
+ public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.IndexBinaryFlat_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
+ swigfaissJNI.IndexBinaryFlat_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryFlat_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexBinaryFlat_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public IndexBinaryFlat() {
+ this(swigfaissJNI.new_IndexBinaryFlat__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFromFloat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFromFloat.java
new file mode 100644
index 000000000..c55ac683b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryFromFloat.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexBinaryFromFloat extends IndexBinary {
+ private transient long swigCPtr;
+
+ protected IndexBinaryFromFloat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexBinaryFromFloat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexBinaryFromFloat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexBinaryFromFloat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIndex(Index value) {
+ swigfaissJNI.IndexBinaryFromFloat_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getIndex() {
+ long cPtr = swigfaissJNI.IndexBinaryFromFloat_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexBinaryFromFloat_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexBinaryFromFloat_own_fields_get(swigCPtr, this);
+ }
+
+ public IndexBinaryFromFloat() {
+ this(swigfaissJNI.new_IndexBinaryFromFloat__SWIG_0(), true);
+ }
+
+ public IndexBinaryFromFloat(Index index) {
+ this(swigfaissJNI.new_IndexBinaryFromFloat__SWIG_1(Index.getCPtr(index), index), true);
+ }
+
+ public void add(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryFromFloat_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexBinaryFromFloat_reset(swigCPtr, this);
+ }
+
+ public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.IndexBinaryFromFloat_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void train(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryFromFloat_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryHNSW.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryHNSW.java
new file mode 100644
index 000000000..f10306136
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryHNSW.java
@@ -0,0 +1,110 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexBinaryHNSW extends IndexBinary {
+ private transient long swigCPtr;
+
+ protected IndexBinaryHNSW(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexBinaryHNSW_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexBinaryHNSW obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexBinaryHNSW(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setHnsw(HNSW value) {
+ swigfaissJNI.IndexBinaryHNSW_hnsw_set(swigCPtr, this, HNSW.getCPtr(value), value);
+ }
+
+ public HNSW getHnsw() {
+ long cPtr = swigfaissJNI.IndexBinaryHNSW_hnsw_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new HNSW(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexBinaryHNSW_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexBinaryHNSW_own_fields_get(swigCPtr, this);
+ }
+
+ public void setStorage(IndexBinary value) {
+ swigfaissJNI.IndexBinaryHNSW_storage_set(swigCPtr, this, IndexBinary.getCPtr(value), value);
+ }
+
+ public IndexBinary getStorage() {
+ long cPtr = swigfaissJNI.IndexBinaryHNSW_storage_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, false);
+ }
+
+ public IndexBinaryHNSW() {
+ this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_0(), true);
+ }
+
+ public IndexBinaryHNSW(int d, int M) {
+ this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_1(d, M), true);
+ }
+
+ public IndexBinaryHNSW(int d) {
+ this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_2(d), true);
+ }
+
+ public IndexBinaryHNSW(IndexBinary storage, int M) {
+ this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_3(IndexBinary.getCPtr(storage), storage, M), true);
+ }
+
+ public IndexBinaryHNSW(IndexBinary storage) {
+ this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_4(IndexBinary.getCPtr(storage), storage), true);
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.IndexBinaryHNSW_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public void add(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryHNSW_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void train(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryHNSW_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.IndexBinaryHNSW_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryHNSW_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexBinaryHNSW_reset(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryIVF.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryIVF.java
new file mode 100644
index 000000000..0da7053a4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryIVF.java
@@ -0,0 +1,237 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexBinaryIVF extends IndexBinary {
+ private transient long swigCPtr;
+
+ protected IndexBinaryIVF(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexBinaryIVF_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexBinaryIVF obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexBinaryIVF(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setInvlists(InvertedLists value) {
+ swigfaissJNI.IndexBinaryIVF_invlists_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getInvlists() {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_invlists_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setOwn_invlists(boolean value) {
+ swigfaissJNI.IndexBinaryIVF_own_invlists_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_invlists() {
+ return swigfaissJNI.IndexBinaryIVF_own_invlists_get(swigCPtr, this);
+ }
+
+ public void setNprobe(long value) {
+ swigfaissJNI.IndexBinaryIVF_nprobe_set(swigCPtr, this, value);
+ }
+
+ public long getNprobe() {
+ return swigfaissJNI.IndexBinaryIVF_nprobe_get(swigCPtr, this);
+ }
+
+ public void setMax_codes(long value) {
+ swigfaissJNI.IndexBinaryIVF_max_codes_set(swigCPtr, this, value);
+ }
+
+ public long getMax_codes() {
+ return swigfaissJNI.IndexBinaryIVF_max_codes_get(swigCPtr, this);
+ }
+
+ public void setUse_heap(boolean value) {
+ swigfaissJNI.IndexBinaryIVF_use_heap_set(swigCPtr, this, value);
+ }
+
+ public boolean getUse_heap() {
+ return swigfaissJNI.IndexBinaryIVF_use_heap_get(swigCPtr, this);
+ }
+
+ public void setDirect_map(SWIGTYPE_p_DirectMap value) {
+ swigfaissJNI.IndexBinaryIVF_direct_map_set(swigCPtr, this, SWIGTYPE_p_DirectMap.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_DirectMap getDirect_map() {
+ return new SWIGTYPE_p_DirectMap(swigfaissJNI.IndexBinaryIVF_direct_map_get(swigCPtr, this), true);
+ }
+
+ public void setQuantizer(IndexBinary value) {
+ swigfaissJNI.IndexBinaryIVF_quantizer_set(swigCPtr, this, IndexBinary.getCPtr(value), value);
+ }
+
+ public IndexBinary getQuantizer() {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_quantizer_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, false);
+ }
+
+ public void setNlist(long value) {
+ swigfaissJNI.IndexBinaryIVF_nlist_set(swigCPtr, this, value);
+ }
+
+ public long getNlist() {
+ return swigfaissJNI.IndexBinaryIVF_nlist_get(swigCPtr, this);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexBinaryIVF_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexBinaryIVF_own_fields_get(swigCPtr, this);
+ }
+
+ public void setCp(ClusteringParameters value) {
+ swigfaissJNI.IndexBinaryIVF_cp_set(swigCPtr, this, ClusteringParameters.getCPtr(value), value);
+ }
+
+ public ClusteringParameters getCp() {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_cp_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ClusteringParameters(cPtr, false);
+ }
+
+ public void setClustering_index(Index value) {
+ swigfaissJNI.IndexBinaryIVF_clustering_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getClustering_index() {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_clustering_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public IndexBinaryIVF(IndexBinary quantizer, long d, long nlist) {
+ this(swigfaissJNI.new_IndexBinaryIVF__SWIG_0(IndexBinary.getCPtr(quantizer), quantizer, d, nlist), true);
+ }
+
+ public IndexBinaryIVF() {
+ this(swigfaissJNI.new_IndexBinaryIVF__SWIG_1(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexBinaryIVF_reset(swigCPtr, this);
+ }
+
+ public void train(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryIVF_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void add(long n, SWIGTYPE_p_unsigned_char x) {
+ swigfaissJNI.IndexBinaryIVF_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_unsigned_char x, LongVector xids) {
+ swigfaissJNI.IndexBinaryIVF_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void add_core(long n, SWIGTYPE_p_unsigned_char x, LongVector xids, LongVector precomputed_idx) {
+ swigfaissJNI.IndexBinaryIVF_add_core(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_unsigned_char x, long k, LongVector assign, SWIGTYPE_p_int centroid_dis, SWIGTYPE_p_int distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
+ swigfaissJNI.IndexBinaryIVF_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_unsigned_char x, long k, LongVector assign, SWIGTYPE_p_int centroid_dis, SWIGTYPE_p_int distances, LongVector labels, boolean store_pairs) {
+ swigfaissJNI.IndexBinaryIVF_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
+ }
+
+ public SWIGTYPE_p_faiss__BinaryInvertedListScanner get_InvertedListScanner(boolean store_pairs) {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_get_InvertedListScanner__SWIG_0(swigCPtr, this, store_pairs);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__BinaryInvertedListScanner(cPtr, false);
+ }
+
+ public SWIGTYPE_p_faiss__BinaryInvertedListScanner get_InvertedListScanner() {
+ long cPtr = swigfaissJNI.IndexBinaryIVF_get_InvertedListScanner__SWIG_1(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__BinaryInvertedListScanner(cPtr, false);
+ }
+
+ public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.IndexBinaryIVF_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
+ swigfaissJNI.IndexBinaryIVF_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void range_search_preassigned(long n, SWIGTYPE_p_unsigned_char x, int radius, LongVector assign, SWIGTYPE_p_int centroid_dis, RangeSearchResult result) {
+ swigfaissJNI.IndexBinaryIVF_range_search_preassigned(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryIVF_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void reconstruct_n(long i0, long ni, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryIVF_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void search_and_reconstruct(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryIVF_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_unsigned_char recons) {
+ swigfaissJNI.IndexBinaryIVF_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_unsigned_char.getCPtr(recons));
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexBinaryIVF_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void merge_from(IndexBinaryIVF other, long add_id) {
+ swigfaissJNI.IndexBinaryIVF_merge_from(swigCPtr, this, IndexBinaryIVF.getCPtr(other), other, add_id);
+ }
+
+ public long get_list_size(long list_no) {
+ return swigfaissJNI.IndexBinaryIVF_get_list_size(swigCPtr, this, list_no);
+ }
+
+ public void make_direct_map(boolean new_maintain_direct_map) {
+ swigfaissJNI.IndexBinaryIVF_make_direct_map__SWIG_0(swigCPtr, this, new_maintain_direct_map);
+ }
+
+ public void make_direct_map() {
+ swigfaissJNI.IndexBinaryIVF_make_direct_map__SWIG_1(swigCPtr, this);
+ }
+
+ public void set_direct_map_type(SWIGTYPE_p_DirectMap__Type type) {
+ swigfaissJNI.IndexBinaryIVF_set_direct_map_type(swigCPtr, this, SWIGTYPE_p_DirectMap__Type.getCPtr(type));
+ }
+
+ public void replace_invlists(InvertedLists il, boolean own) {
+ swigfaissJNI.IndexBinaryIVF_replace_invlists__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, own);
+ }
+
+ public void replace_invlists(InvertedLists il) {
+ swigfaissJNI.IndexBinaryIVF_replace_invlists__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat.java
new file mode 100644
index 000000000..2408455f2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat.java
@@ -0,0 +1,85 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexFlat extends IndexFlatCodes {
+ private transient long swigCPtr;
+
+ protected IndexFlat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexFlat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexFlat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexFlat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexFlat(long d, MetricType metric) {
+ this(swigfaissJNI.new_IndexFlat__SWIG_0(d, metric.swigValue()), true);
+ }
+
+ public IndexFlat(long d) {
+ this(swigfaissJNI.new_IndexFlat__SWIG_1(d), true);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexFlat_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
+ swigfaissJNI.IndexFlat_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexFlat_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void compute_distance_subset(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexFlat_compute_distance_subset(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public SWIGTYPE_p_float get_xb() {
+ long cPtr = swigfaissJNI.IndexFlat_get_xb__SWIG_0(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public IndexFlat() {
+ this(swigfaissJNI.new_IndexFlat__SWIG_2(), true);
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.IndexFlat_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexFlat_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexFlat_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat1D.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat1D.java
new file mode 100644
index 000000000..8104181b4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat1D.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexFlat1D extends IndexFlatL2 {
+ private transient long swigCPtr;
+
+ protected IndexFlat1D(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexFlat1D_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexFlat1D obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexFlat1D(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setContinuous_update(boolean value) {
+ swigfaissJNI.IndexFlat1D_continuous_update_set(swigCPtr, this, value);
+ }
+
+ public boolean getContinuous_update() {
+ return swigfaissJNI.IndexFlat1D_continuous_update_get(swigCPtr, this);
+ }
+
+ public void setPerm(SWIGTYPE_p_std__vectorT_int64_t_t value) {
+ swigfaissJNI.IndexFlat1D_perm_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_int64_t_t getPerm() {
+ long cPtr = swigfaissJNI.IndexFlat1D_perm_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
+ }
+
+ public IndexFlat1D(boolean continuous_update) {
+ this(swigfaissJNI.new_IndexFlat1D__SWIG_0(continuous_update), true);
+ }
+
+ public IndexFlat1D() {
+ this(swigfaissJNI.new_IndexFlat1D__SWIG_1(), true);
+ }
+
+ public void update_permutation() {
+ swigfaissJNI.IndexFlat1D_update_permutation(swigCPtr, this);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexFlat1D_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexFlat1D_reset(swigCPtr, this);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexFlat1D_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatCodes.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatCodes.java
new file mode 100644
index 000000000..62448b542
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatCodes.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexFlatCodes extends Index {
+ private transient long swigCPtr;
+
+ protected IndexFlatCodes(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexFlatCodes_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexFlatCodes obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexFlatCodes(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.IndexFlatCodes_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.IndexFlatCodes_code_size_get(swigCPtr, this);
+ }
+
+ public void setCodes(ByteVector value) {
+ swigfaissJNI.IndexFlatCodes_codes_set(swigCPtr, this, ByteVector.getCPtr(value), value);
+ }
+
+ public ByteVector getCodes() {
+ long cPtr = swigfaissJNI.IndexFlatCodes_codes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVector(cPtr, false);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexFlatCodes_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexFlatCodes_reset(swigCPtr, this);
+ }
+
+ public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexFlatCodes_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexFlatCodes_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public long sa_code_size() {
+ return swigfaissJNI.IndexFlatCodes_sa_code_size(swigCPtr, this);
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexFlatCodes_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatIP.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatIP.java
new file mode 100644
index 000000000..d1cb9c9ff
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatIP.java
@@ -0,0 +1,47 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexFlatIP extends IndexFlat {
+ private transient long swigCPtr;
+
+ protected IndexFlatIP(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexFlatIP_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexFlatIP obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexFlatIP(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexFlatIP(long d) {
+ this(swigfaissJNI.new_IndexFlatIP__SWIG_0(d), true);
+ }
+
+ public IndexFlatIP() {
+ this(swigfaissJNI.new_IndexFlatIP__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatL2.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatL2.java
new file mode 100644
index 000000000..9bd6ae092
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlatL2.java
@@ -0,0 +1,47 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexFlatL2 extends IndexFlat {
+ private transient long swigCPtr;
+
+ protected IndexFlatL2(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexFlatL2_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexFlatL2 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexFlatL2(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexFlatL2(long d) {
+ this(swigfaissJNI.new_IndexFlatL2__SWIG_0(d), true);
+ }
+
+ public IndexFlatL2() {
+ this(swigfaissJNI.new_IndexFlatL2__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW.java
new file mode 100644
index 000000000..b5be7d13c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW.java
@@ -0,0 +1,150 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexHNSW extends Index {
+ private transient long swigCPtr;
+
+ protected IndexHNSW(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexHNSW_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexHNSW obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexHNSW(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setHnsw(HNSW value) {
+ swigfaissJNI.IndexHNSW_hnsw_set(swigCPtr, this, HNSW.getCPtr(value), value);
+ }
+
+ public HNSW getHnsw() {
+ long cPtr = swigfaissJNI.IndexHNSW_hnsw_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new HNSW(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexHNSW_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexHNSW_own_fields_get(swigCPtr, this);
+ }
+
+ public void setStorage(Index value) {
+ swigfaissJNI.IndexHNSW_storage_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getStorage() {
+ long cPtr = swigfaissJNI.IndexHNSW_storage_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setReconstruct_from_neighbors(ReconstructFromNeighbors value) {
+ swigfaissJNI.IndexHNSW_reconstruct_from_neighbors_set(swigCPtr, this, ReconstructFromNeighbors.getCPtr(value), value);
+ }
+
+ public ReconstructFromNeighbors getReconstruct_from_neighbors() {
+ long cPtr = swigfaissJNI.IndexHNSW_reconstruct_from_neighbors_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ReconstructFromNeighbors(cPtr, false);
+ }
+
+ public IndexHNSW(int d, int M, MetricType metric) {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_0(d, M, metric.swigValue()), true);
+ }
+
+ public IndexHNSW(int d, int M) {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_1(d, M), true);
+ }
+
+ public IndexHNSW(int d) {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_2(d), true);
+ }
+
+ public IndexHNSW() {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_3(), true);
+ }
+
+ public IndexHNSW(Index storage, int M) {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_4(Index.getCPtr(storage), storage, M), true);
+ }
+
+ public IndexHNSW(Index storage) {
+ this(swigfaissJNI.new_IndexHNSW__SWIG_5(Index.getCPtr(storage), storage), true);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexHNSW_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexHNSW_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexHNSW_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexHNSW_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexHNSW_reset(swigCPtr, this);
+ }
+
+ public void shrink_level_0_neighbors(int size) {
+ swigfaissJNI.IndexHNSW_shrink_level_0_neighbors(swigCPtr, this, size);
+ }
+
+ public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels, int nprobe, int search_type) {
+ swigfaissJNI.IndexHNSW_search_level_0__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, nprobe, search_type);
+ }
+
+ public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels, int nprobe) {
+ swigfaissJNI.IndexHNSW_search_level_0__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, nprobe);
+ }
+
+ public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexHNSW_search_level_0__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void init_level_0_from_knngraph(int k, SWIGTYPE_p_float D, LongVector I) {
+ swigfaissJNI.IndexHNSW_init_level_0_from_knngraph(swigCPtr, this, k, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
+ }
+
+ public void init_level_0_from_entry_points(int npt, SWIGTYPE_p_int points, SWIGTYPE_p_int nearests) {
+ swigfaissJNI.IndexHNSW_init_level_0_from_entry_points(swigCPtr, this, npt, SWIGTYPE_p_int.getCPtr(points), SWIGTYPE_p_int.getCPtr(nearests));
+ }
+
+ public void reorder_links() {
+ swigfaissJNI.IndexHNSW_reorder_links(swigCPtr, this);
+ }
+
+ public void link_singletons() {
+ swigfaissJNI.IndexHNSW_link_singletons(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW2Level.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW2Level.java
new file mode 100644
index 000000000..9f1544ca1
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW2Level.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexHNSW2Level extends IndexHNSW {
+ private transient long swigCPtr;
+
+ protected IndexHNSW2Level(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexHNSW2Level_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexHNSW2Level obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexHNSW2Level(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexHNSW2Level() {
+ this(swigfaissJNI.new_IndexHNSW2Level__SWIG_0(), true);
+ }
+
+ public IndexHNSW2Level(Index quantizer, long nlist, int m_pq, int M) {
+ this(swigfaissJNI.new_IndexHNSW2Level__SWIG_1(Index.getCPtr(quantizer), quantizer, nlist, m_pq, M), true);
+ }
+
+ public void flip_to_ivf() {
+ swigfaissJNI.IndexHNSW2Level_flip_to_ivf(swigCPtr, this);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexHNSW2Level_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWFlat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWFlat.java
new file mode 100644
index 000000000..c632b4fb6
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWFlat.java
@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexHNSWFlat extends IndexHNSW {
+ private transient long swigCPtr;
+
+ protected IndexHNSWFlat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexHNSWFlat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexHNSWFlat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexHNSWFlat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexHNSWFlat() {
+ this(swigfaissJNI.new_IndexHNSWFlat__SWIG_0(), true);
+ }
+
+ public IndexHNSWFlat(int d, int M, MetricType metric) {
+ this(swigfaissJNI.new_IndexHNSWFlat__SWIG_1(d, M, metric.swigValue()), true);
+ }
+
+ public IndexHNSWFlat(int d, int M) {
+ this(swigfaissJNI.new_IndexHNSWFlat__SWIG_2(d, M), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWPQ.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWPQ.java
new file mode 100644
index 000000000..cc761d9c8
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWPQ.java
@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexHNSWPQ extends IndexHNSW {
+ private transient long swigCPtr;
+
+ protected IndexHNSWPQ(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexHNSWPQ_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexHNSWPQ obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexHNSWPQ(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexHNSWPQ() {
+ this(swigfaissJNI.new_IndexHNSWPQ__SWIG_0(), true);
+ }
+
+ public IndexHNSWPQ(int d, int pq_m, int M) {
+ this(swigfaissJNI.new_IndexHNSWPQ__SWIG_1(d, pq_m, M), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexHNSWPQ_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWSQ.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWSQ.java
new file mode 100644
index 000000000..ee08aa9bb
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSWSQ.java
@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexHNSWSQ extends IndexHNSW {
+ private transient long swigCPtr;
+
+ protected IndexHNSWSQ(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexHNSWSQ_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexHNSWSQ obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexHNSWSQ(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexHNSWSQ() {
+ this(swigfaissJNI.new_IndexHNSWSQ__SWIG_0(), true);
+ }
+
+ public IndexHNSWSQ(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, int M, MetricType metric) {
+ this(swigfaissJNI.new_IndexHNSWSQ__SWIG_1(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), M, metric.swigValue()), true);
+ }
+
+ public IndexHNSWSQ(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, int M) {
+ this(swigfaissJNI.new_IndexHNSWSQ__SWIG_2(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), M), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIDMap.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIDMap.java
new file mode 100644
index 000000000..72c5574f9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIDMap.java
@@ -0,0 +1,101 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIDMap extends Index {
+ private transient long swigCPtr;
+
+ protected IndexIDMap(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIDMap_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIDMap obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIDMap(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIndex(Index value) {
+ swigfaissJNI.IndexIDMap_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getIndex() {
+ long cPtr = swigfaissJNI.IndexIDMap_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexIDMap_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexIDMap_own_fields_get(swigCPtr, this);
+ }
+
+ public void setId_map(SWIGTYPE_p_std__vectorT_int64_t_t value) {
+ swigfaissJNI.IndexIDMap_id_map_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_int64_t_t getId_map() {
+ long cPtr = swigfaissJNI.IndexIDMap_id_map_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
+ }
+
+ public IndexIDMap(Index index) {
+ this(swigfaissJNI.new_IndexIDMap__SWIG_0(Index.getCPtr(index), index), true);
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
+ swigfaissJNI.IndexIDMap_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIDMap_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexIDMap_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIDMap_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexIDMap_reset(swigCPtr, this);
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexIDMap_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
+ swigfaissJNI.IndexIDMap_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public IndexIDMap() {
+ this(swigfaissJNI.new_IndexIDMap__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVF.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVF.java
new file mode 100644
index 000000000..04c22067a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVF.java
@@ -0,0 +1,250 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVF extends Index {
+ private transient long swigCPtr;
+
+ protected IndexIVF(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIVF_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVF obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVF(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setInvlists(InvertedLists value) {
+ swigfaissJNI.IndexIVF_invlists_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getInvlists() {
+ long cPtr = swigfaissJNI.IndexIVF_invlists_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setOwn_invlists(boolean value) {
+ swigfaissJNI.IndexIVF_own_invlists_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_invlists() {
+ return swigfaissJNI.IndexIVF_own_invlists_get(swigCPtr, this);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.IndexIVF_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.IndexIVF_code_size_get(swigCPtr, this);
+ }
+
+ public void setNprobe(long value) {
+ swigfaissJNI.IndexIVF_nprobe_set(swigCPtr, this, value);
+ }
+
+ public long getNprobe() {
+ return swigfaissJNI.IndexIVF_nprobe_get(swigCPtr, this);
+ }
+
+ public void setMax_codes(long value) {
+ swigfaissJNI.IndexIVF_max_codes_set(swigCPtr, this, value);
+ }
+
+ public long getMax_codes() {
+ return swigfaissJNI.IndexIVF_max_codes_get(swigCPtr, this);
+ }
+
+ public void setParallel_mode(int value) {
+ swigfaissJNI.IndexIVF_parallel_mode_set(swigCPtr, this, value);
+ }
+
+ public int getParallel_mode() {
+ return swigfaissJNI.IndexIVF_parallel_mode_get(swigCPtr, this);
+ }
+
+ public int getPARALLEL_MODE_NO_HEAP_INIT() {
+ return swigfaissJNI.IndexIVF_PARALLEL_MODE_NO_HEAP_INIT_get(swigCPtr, this);
+ }
+
+ public void setDirect_map(SWIGTYPE_p_DirectMap value) {
+ swigfaissJNI.IndexIVF_direct_map_set(swigCPtr, this, SWIGTYPE_p_DirectMap.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_DirectMap getDirect_map() {
+ return new SWIGTYPE_p_DirectMap(swigfaissJNI.IndexIVF_direct_map_get(swigCPtr, this), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexIVF_reset(swigCPtr, this);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVF_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVF_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
+ swigfaissJNI.IndexIVF_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
+ swigfaissJNI.IndexIVF_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listno) {
+ swigfaissJNI.IndexIVF_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listno);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.IndexIVF_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void add_sa_codes(long n, SWIGTYPE_p_unsigned_char codes, LongVector xids) {
+ swigfaissJNI.IndexIVF_add_sa_codes(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(codes), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void train_residual(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVF_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
+ swigfaissJNI.IndexIVF_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
+ swigfaissJNI.IndexIVF_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs) {
+ swigfaissJNI.IndexIVF_search_preassigned__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexIVF_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
+ swigfaissJNI.IndexIVF_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
+ swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_0(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
+ }
+
+ public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs, IVFSearchParameters params) {
+ swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_1(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs) {
+ swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_2(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs);
+ }
+
+ public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result) {
+ swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_3(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result);
+ }
+
+ public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
+ long cPtr = swigfaissJNI.IndexIVF_get_InvertedListScanner__SWIG_0(swigCPtr, this, store_pairs);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
+ }
+
+ public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner() {
+ long cPtr = swigfaissJNI.IndexIVF_get_InvertedListScanner__SWIG_1(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVF_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void update_vectors(int nv, LongVector idx, SWIGTYPE_p_float v) {
+ swigfaissJNI.IndexIVF_update_vectors(swigCPtr, this, nv, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_float.getCPtr(v));
+ }
+
+ public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVF_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void search_and_reconstruct(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVF_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVF_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexIVF_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void check_compatible_for_merge(IndexIVF other) {
+ swigfaissJNI.IndexIVF_check_compatible_for_merge(swigCPtr, this, IndexIVF.getCPtr(other), other);
+ }
+
+ public void merge_from(IndexIVF other, long add_id) {
+ swigfaissJNI.IndexIVF_merge_from(swigCPtr, this, IndexIVF.getCPtr(other), other, add_id);
+ }
+
+ public void copy_subset_to(IndexIVF other, int subset_type, long a1, long a2) {
+ swigfaissJNI.IndexIVF_copy_subset_to(swigCPtr, this, IndexIVF.getCPtr(other), other, subset_type, a1, a2);
+ }
+
+ public long get_list_size(long list_no) {
+ return swigfaissJNI.IndexIVF_get_list_size(swigCPtr, this, list_no);
+ }
+
+ public void make_direct_map(boolean new_maintain_direct_map) {
+ swigfaissJNI.IndexIVF_make_direct_map__SWIG_0(swigCPtr, this, new_maintain_direct_map);
+ }
+
+ public void make_direct_map() {
+ swigfaissJNI.IndexIVF_make_direct_map__SWIG_1(swigCPtr, this);
+ }
+
+ public void set_direct_map_type(SWIGTYPE_p_DirectMap__Type type) {
+ swigfaissJNI.IndexIVF_set_direct_map_type(swigCPtr, this, SWIGTYPE_p_DirectMap__Type.getCPtr(type));
+ }
+
+ public void replace_invlists(InvertedLists il, boolean own) {
+ swigfaissJNI.IndexIVF_replace_invlists__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, own);
+ }
+
+ public void replace_invlists(InvertedLists il) {
+ swigfaissJNI.IndexIVF_replace_invlists__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
+ }
+
+ public long sa_code_size() {
+ return swigfaissJNI.IndexIVF_sa_code_size(swigCPtr, this);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexIVF_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlat.java
new file mode 100644
index 000000000..f2e412026
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlat.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFFlat extends IndexIVF {
+ private transient long swigCPtr;
+
+ protected IndexIVFFlat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIVFFlat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFFlat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFFlat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexIVFFlat(Index quantizer, long d, long nlist_, MetricType arg3) {
+ this(swigfaissJNI.new_IndexIVFFlat__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist_, arg3.swigValue()), true);
+ }
+
+ public IndexIVFFlat(Index quantizer, long d, long nlist_) {
+ this(swigfaissJNI.new_IndexIVFFlat__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist_), true);
+ }
+
+ public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
+ swigfaissJNI.IndexIVFFlat_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
+ swigfaissJNI.IndexIVFFlat_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.IndexIVFFlat_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
+ long cPtr = swigfaissJNI.IndexIVFFlat_get_InvertedListScanner(swigCPtr, this, store_pairs);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVFFlat_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFFlat_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public IndexIVFFlat() {
+ this(swigfaissJNI.new_IndexIVFFlat__SWIG_2(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlatDedup.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlatDedup.java
new file mode 100644
index 000000000..7efd00537
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFFlatDedup.java
@@ -0,0 +1,95 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFFlatDedup extends IndexIVFFlat {
+ private transient long swigCPtr;
+
+ protected IndexIVFFlatDedup(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIVFFlatDedup_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFFlatDedup obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFFlatDedup(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setInstances(SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t value) {
+ swigfaissJNI.IndexIVFFlatDedup_instances_set(swigCPtr, this, SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t getInstances() {
+ return new SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t(swigfaissJNI.IndexIVFFlatDedup_instances_get(swigCPtr, this), true);
+ }
+
+ public IndexIVFFlatDedup(Index quantizer, long d, long nlist_, MetricType arg3) {
+ this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist_, arg3.swigValue()), true);
+ }
+
+ public IndexIVFFlatDedup(Index quantizer, long d, long nlist_) {
+ this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist_), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFFlatDedup_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
+ swigfaissJNI.IndexIVFFlatDedup_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
+ swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
+ swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs) {
+ swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
+ }
+
+ public long remove_ids(IDSelector sel) {
+ return swigfaissJNI.IndexIVFFlatDedup_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
+ }
+
+ public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
+ swigfaissJNI.IndexIVFFlatDedup_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public void update_vectors(int nv, LongVector idx, SWIGTYPE_p_float v) {
+ swigfaissJNI.IndexIVFFlatDedup_update_vectors(swigCPtr, this, nv, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_float.getCPtr(v));
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVFFlatDedup_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public IndexIVFFlatDedup() {
+ this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_2(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQ.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQ.java
new file mode 100644
index 000000000..ba5514a0f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQ.java
@@ -0,0 +1,182 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFPQ extends IndexIVF {
+ private transient long swigCPtr;
+
+ protected IndexIVFPQ(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIVFPQ_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFPQ obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFPQ(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setBy_residual(boolean value) {
+ swigfaissJNI.IndexIVFPQ_by_residual_set(swigCPtr, this, value);
+ }
+
+ public boolean getBy_residual() {
+ return swigfaissJNI.IndexIVFPQ_by_residual_get(swigCPtr, this);
+ }
+
+ public void setPq(ProductQuantizer value) {
+ swigfaissJNI.IndexIVFPQ_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
+ }
+
+ public ProductQuantizer getPq() {
+ long cPtr = swigfaissJNI.IndexIVFPQ_pq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
+ }
+
+ public void setDo_polysemous_training(boolean value) {
+ swigfaissJNI.IndexIVFPQ_do_polysemous_training_set(swigCPtr, this, value);
+ }
+
+ public boolean getDo_polysemous_training() {
+ return swigfaissJNI.IndexIVFPQ_do_polysemous_training_get(swigCPtr, this);
+ }
+
+ public void setPolysemous_training(PolysemousTraining value) {
+ swigfaissJNI.IndexIVFPQ_polysemous_training_set(swigCPtr, this, PolysemousTraining.getCPtr(value), value);
+ }
+
+ public PolysemousTraining getPolysemous_training() {
+ long cPtr = swigfaissJNI.IndexIVFPQ_polysemous_training_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new PolysemousTraining(cPtr, false);
+ }
+
+ public void setScan_table_threshold(long value) {
+ swigfaissJNI.IndexIVFPQ_scan_table_threshold_set(swigCPtr, this, value);
+ }
+
+ public long getScan_table_threshold() {
+ return swigfaissJNI.IndexIVFPQ_scan_table_threshold_get(swigCPtr, this);
+ }
+
+ public void setPolysemous_ht(int value) {
+ swigfaissJNI.IndexIVFPQ_polysemous_ht_set(swigCPtr, this, value);
+ }
+
+ public int getPolysemous_ht() {
+ return swigfaissJNI.IndexIVFPQ_polysemous_ht_get(swigCPtr, this);
+ }
+
+ public void setUse_precomputed_table(int value) {
+ swigfaissJNI.IndexIVFPQ_use_precomputed_table_set(swigCPtr, this, value);
+ }
+
+ public int getUse_precomputed_table() {
+ return swigfaissJNI.IndexIVFPQ_use_precomputed_table_get(swigCPtr, this);
+ }
+
+ public void setPrecomputed_table(SWIGTYPE_p_AlignedTableT_float_t value) {
+ swigfaissJNI.IndexIVFPQ_precomputed_table_set(swigCPtr, this, SWIGTYPE_p_AlignedTableT_float_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_AlignedTableT_float_t getPrecomputed_table() {
+ return new SWIGTYPE_p_AlignedTableT_float_t(swigfaissJNI.IndexIVFPQ_precomputed_table_get(swigCPtr, this), true);
+ }
+
+ public IndexIVFPQ(Index quantizer, long d, long nlist, long M, long nbits_per_idx, MetricType metric) {
+ this(swigfaissJNI.new_IndexIVFPQ__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist, M, nbits_per_idx, metric.swigValue()), true);
+ }
+
+ public IndexIVFPQ(Index quantizer, long d, long nlist, long M, long nbits_per_idx) {
+ this(swigfaissJNI.new_IndexIVFPQ__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist, M, nbits_per_idx), true);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
+ swigfaissJNI.IndexIVFPQ_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.IndexIVFPQ_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFPQ_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
+ swigfaissJNI.IndexIVFPQ_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public void add_core_o(long n, SWIGTYPE_p_float x, LongVector xids, SWIGTYPE_p_float residuals_2, LongVector precomputed_idx) {
+ swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_float.getCPtr(residuals_2), SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public void add_core_o(long n, SWIGTYPE_p_float x, LongVector xids, SWIGTYPE_p_float residuals_2) {
+ swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_float.getCPtr(residuals_2));
+ }
+
+ public void train_residual(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFPQ_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void train_residual_o(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float residuals_2) {
+ swigfaissJNI.IndexIVFPQ_train_residual_o(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(residuals_2));
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVFPQ_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public long find_duplicates(LongVector ids, SWIGTYPE_p_unsigned_long lims) {
+ return swigfaissJNI.IndexIVFPQ_find_duplicates(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_long.getCPtr(lims));
+ }
+
+ public void encode(long key, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.IndexIVFPQ_encode(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void encode_multiple(long n, LongVector keys, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes, boolean compute_keys) {
+ swigfaissJNI.IndexIVFPQ_encode_multiple__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes), compute_keys);
+ }
+
+ public void encode_multiple(long n, LongVector keys, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.IndexIVFPQ_encode_multiple__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void decode_multiple(long n, LongVector keys, SWIGTYPE_p_unsigned_char xcodes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFPQ_decode_multiple(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_unsigned_char.getCPtr(xcodes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
+ long cPtr = swigfaissJNI.IndexIVFPQ_get_InvertedListScanner(swigCPtr, this, store_pairs);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
+ }
+
+ public void precompute_table() {
+ swigfaissJNI.IndexIVFPQ_precompute_table(swigCPtr, this);
+ }
+
+ public IndexIVFPQ() {
+ this(swigfaissJNI.new_IndexIVFPQ__SWIG_2(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQStats.java
new file mode 100644
index 000000000..81c829363
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQStats.java
@@ -0,0 +1,79 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFPQStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IndexIVFPQStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFPQStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFPQStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNrefine(long value) {
+ swigfaissJNI.IndexIVFPQStats_nrefine_set(swigCPtr, this, value);
+ }
+
+ public long getNrefine() {
+ return swigfaissJNI.IndexIVFPQStats_nrefine_get(swigCPtr, this);
+ }
+
+ public void setN_hamming_pass(long value) {
+ swigfaissJNI.IndexIVFPQStats_n_hamming_pass_set(swigCPtr, this, value);
+ }
+
+ public long getN_hamming_pass() {
+ return swigfaissJNI.IndexIVFPQStats_n_hamming_pass_get(swigCPtr, this);
+ }
+
+ public void setSearch_cycles(long value) {
+ swigfaissJNI.IndexIVFPQStats_search_cycles_set(swigCPtr, this, value);
+ }
+
+ public long getSearch_cycles() {
+ return swigfaissJNI.IndexIVFPQStats_search_cycles_get(swigCPtr, this);
+ }
+
+ public void setRefine_cycles(long value) {
+ swigfaissJNI.IndexIVFPQStats_refine_cycles_set(swigCPtr, this, value);
+ }
+
+ public long getRefine_cycles() {
+ return swigfaissJNI.IndexIVFPQStats_refine_cycles_get(swigCPtr, this);
+ }
+
+ public IndexIVFPQStats() {
+ this(swigfaissJNI.new_IndexIVFPQStats(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexIVFPQStats_reset(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFScalarQuantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFScalarQuantizer.java
new file mode 100644
index 000000000..8e72059de
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFScalarQuantizer.java
@@ -0,0 +1,100 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFScalarQuantizer extends IndexIVF {
+ private transient long swigCPtr;
+
+ protected IndexIVFScalarQuantizer(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexIVFScalarQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFScalarQuantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFScalarQuantizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setSq(SWIGTYPE_p_ScalarQuantizer value) {
+ swigfaissJNI.IndexIVFScalarQuantizer_sq_set(swigCPtr, this, SWIGTYPE_p_ScalarQuantizer.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_ScalarQuantizer getSq() {
+ return new SWIGTYPE_p_ScalarQuantizer(swigfaissJNI.IndexIVFScalarQuantizer_sq_get(swigCPtr, this), true);
+ }
+
+ public void setBy_residual(boolean value) {
+ swigfaissJNI.IndexIVFScalarQuantizer_by_residual_set(swigCPtr, this, value);
+ }
+
+ public boolean getBy_residual() {
+ return swigfaissJNI.IndexIVFScalarQuantizer_by_residual_get(swigCPtr, this);
+ }
+
+ public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric, boolean encode_residual) {
+ this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue(), encode_residual), true);
+ }
+
+ public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric) {
+ this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue()), true);
+ }
+
+ public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype) {
+ this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_2(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype)), true);
+ }
+
+ public IndexIVFScalarQuantizer() {
+ this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_3(), true);
+ }
+
+ public void train_residual(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFScalarQuantizer_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
+ swigfaissJNI.IndexIVFScalarQuantizer_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
+ }
+
+ public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.IndexIVFScalarQuantizer_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
+ swigfaissJNI.IndexIVFScalarQuantizer_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
+ }
+
+ public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
+ long cPtr = swigfaissJNI.IndexIVFScalarQuantizer_get_InvertedListScanner(swigCPtr, this, store_pairs);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
+ }
+
+ public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexIVFScalarQuantizer_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexIVFScalarQuantizer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFStats.java
new file mode 100644
index 000000000..b70bb07aa
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFStats.java
@@ -0,0 +1,99 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexIVFStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IndexIVFStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexIVFStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexIVFStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNq(long value) {
+ swigfaissJNI.IndexIVFStats_nq_set(swigCPtr, this, value);
+ }
+
+ public long getNq() {
+ return swigfaissJNI.IndexIVFStats_nq_get(swigCPtr, this);
+ }
+
+ public void setNlist(long value) {
+ swigfaissJNI.IndexIVFStats_nlist_set(swigCPtr, this, value);
+ }
+
+ public long getNlist() {
+ return swigfaissJNI.IndexIVFStats_nlist_get(swigCPtr, this);
+ }
+
+ public void setNdis(long value) {
+ swigfaissJNI.IndexIVFStats_ndis_set(swigCPtr, this, value);
+ }
+
+ public long getNdis() {
+ return swigfaissJNI.IndexIVFStats_ndis_get(swigCPtr, this);
+ }
+
+ public void setNheap_updates(long value) {
+ swigfaissJNI.IndexIVFStats_nheap_updates_set(swigCPtr, this, value);
+ }
+
+ public long getNheap_updates() {
+ return swigfaissJNI.IndexIVFStats_nheap_updates_get(swigCPtr, this);
+ }
+
+ public void setQuantization_time(double value) {
+ swigfaissJNI.IndexIVFStats_quantization_time_set(swigCPtr, this, value);
+ }
+
+ public double getQuantization_time() {
+ return swigfaissJNI.IndexIVFStats_quantization_time_get(swigCPtr, this);
+ }
+
+ public void setSearch_time(double value) {
+ swigfaissJNI.IndexIVFStats_search_time_set(swigCPtr, this, value);
+ }
+
+ public double getSearch_time() {
+ return swigfaissJNI.IndexIVFStats_search_time_get(swigCPtr, this);
+ }
+
+ public IndexIVFStats() {
+ this(swigfaissJNI.new_IndexIVFStats(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexIVFStats_reset(swigCPtr, this);
+ }
+
+ public void add(IndexIVFStats other) {
+ swigfaissJNI.IndexIVFStats_add(swigCPtr, this, IndexIVFStats.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexLSH.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexLSH.java
new file mode 100644
index 000000000..77c1cb855
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexLSH.java
@@ -0,0 +1,122 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexLSH extends IndexFlatCodes {
+ private transient long swigCPtr;
+
+ protected IndexLSH(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexLSH_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexLSH obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexLSH(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setNbits(int value) {
+ swigfaissJNI.IndexLSH_nbits_set(swigCPtr, this, value);
+ }
+
+ public int getNbits() {
+ return swigfaissJNI.IndexLSH_nbits_get(swigCPtr, this);
+ }
+
+ public void setRotate_data(boolean value) {
+ swigfaissJNI.IndexLSH_rotate_data_set(swigCPtr, this, value);
+ }
+
+ public boolean getRotate_data() {
+ return swigfaissJNI.IndexLSH_rotate_data_get(swigCPtr, this);
+ }
+
+ public void setTrain_thresholds(boolean value) {
+ swigfaissJNI.IndexLSH_train_thresholds_set(swigCPtr, this, value);
+ }
+
+ public boolean getTrain_thresholds() {
+ return swigfaissJNI.IndexLSH_train_thresholds_get(swigCPtr, this);
+ }
+
+ public void setRrot(RandomRotationMatrix value) {
+ swigfaissJNI.IndexLSH_rrot_set(swigCPtr, this, RandomRotationMatrix.getCPtr(value), value);
+ }
+
+ public RandomRotationMatrix getRrot() {
+ long cPtr = swigfaissJNI.IndexLSH_rrot_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new RandomRotationMatrix(cPtr, false);
+ }
+
+ public void setThresholds(FloatVector value) {
+ swigfaissJNI.IndexLSH_thresholds_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getThresholds() {
+ long cPtr = swigfaissJNI.IndexLSH_thresholds_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public IndexLSH(long d, int nbits, boolean rotate_data, boolean train_thresholds) {
+ this(swigfaissJNI.new_IndexLSH__SWIG_0(d, nbits, rotate_data, train_thresholds), true);
+ }
+
+ public IndexLSH(long d, int nbits, boolean rotate_data) {
+ this(swigfaissJNI.new_IndexLSH__SWIG_1(d, nbits, rotate_data), true);
+ }
+
+ public IndexLSH(long d, int nbits) {
+ this(swigfaissJNI.new_IndexLSH__SWIG_2(d, nbits), true);
+ }
+
+ public SWIGTYPE_p_float apply_preprocess(long n, SWIGTYPE_p_float x) {
+ long cPtr = swigfaissJNI.IndexLSH_apply_preprocess(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexLSH_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexLSH_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void transfer_thresholds(LinearTransform vt) {
+ swigfaissJNI.IndexLSH_transfer_thresholds(swigCPtr, this, LinearTransform.getCPtr(vt), vt);
+ }
+
+ public IndexLSH() {
+ this(swigfaissJNI.new_IndexLSH__SWIG_3(), true);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexLSH_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexLSH_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQ.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQ.java
new file mode 100644
index 000000000..b0e874cbc
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQ.java
@@ -0,0 +1,182 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexPQ extends IndexFlatCodes {
+ private transient long swigCPtr;
+
+ protected IndexPQ(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexPQ_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexPQ obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexPQ(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setPq(ProductQuantizer value) {
+ swigfaissJNI.IndexPQ_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
+ }
+
+ public ProductQuantizer getPq() {
+ long cPtr = swigfaissJNI.IndexPQ_pq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
+ }
+
+ public IndexPQ(int d, long M, long nbits, MetricType metric) {
+ this(swigfaissJNI.new_IndexPQ__SWIG_0(d, M, nbits, metric.swigValue()), true);
+ }
+
+ public IndexPQ(int d, long M, long nbits) {
+ this(swigfaissJNI.new_IndexPQ__SWIG_1(d, M, nbits), true);
+ }
+
+ public IndexPQ() {
+ this(swigfaissJNI.new_IndexPQ__SWIG_2(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexPQ_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexPQ_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexPQ_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexPQ_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.IndexPQ_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public void setDo_polysemous_training(boolean value) {
+ swigfaissJNI.IndexPQ_do_polysemous_training_set(swigCPtr, this, value);
+ }
+
+ public boolean getDo_polysemous_training() {
+ return swigfaissJNI.IndexPQ_do_polysemous_training_get(swigCPtr, this);
+ }
+
+ public void setPolysemous_training(PolysemousTraining value) {
+ swigfaissJNI.IndexPQ_polysemous_training_set(swigCPtr, this, PolysemousTraining.getCPtr(value), value);
+ }
+
+ public PolysemousTraining getPolysemous_training() {
+ long cPtr = swigfaissJNI.IndexPQ_polysemous_training_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new PolysemousTraining(cPtr, false);
+ }
+
+ public void setSearch_type(IndexPQ.Search_type_t value) {
+ swigfaissJNI.IndexPQ_search_type_set(swigCPtr, this, value.swigValue());
+ }
+
+ public IndexPQ.Search_type_t getSearch_type() {
+ return IndexPQ.Search_type_t.swigToEnum(swigfaissJNI.IndexPQ_search_type_get(swigCPtr, this));
+ }
+
+ public void setEncode_signs(boolean value) {
+ swigfaissJNI.IndexPQ_encode_signs_set(swigCPtr, this, value);
+ }
+
+ public boolean getEncode_signs() {
+ return swigfaissJNI.IndexPQ_encode_signs_get(swigCPtr, this);
+ }
+
+ public void setPolysemous_ht(int value) {
+ swigfaissJNI.IndexPQ_polysemous_ht_set(swigCPtr, this, value);
+ }
+
+ public int getPolysemous_ht() {
+ return swigfaissJNI.IndexPQ_polysemous_ht_get(swigCPtr, this);
+ }
+
+ public void search_core_polysemous(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexPQ_search_core_polysemous(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void hamming_distance_histogram(long n, SWIGTYPE_p_float x, long nb, SWIGTYPE_p_float xb, LongVector dist_histogram) {
+ swigfaissJNI.IndexPQ_hamming_distance_histogram(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), nb, SWIGTYPE_p_float.getCPtr(xb), SWIGTYPE_p_long_long.getCPtr(dist_histogram.data()), dist_histogram);
+ }
+
+ public void hamming_distance_table(long n, SWIGTYPE_p_float x, SWIGTYPE_p_int dis) {
+ swigfaissJNI.IndexPQ_hamming_distance_table(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_int.getCPtr(dis));
+ }
+
+ public final static class Search_type_t {
+ public final static IndexPQ.Search_type_t ST_PQ = new IndexPQ.Search_type_t("ST_PQ");
+ public final static IndexPQ.Search_type_t ST_HE = new IndexPQ.Search_type_t("ST_HE");
+ public final static IndexPQ.Search_type_t ST_generalized_HE = new IndexPQ.Search_type_t("ST_generalized_HE");
+ public final static IndexPQ.Search_type_t ST_SDC = new IndexPQ.Search_type_t("ST_SDC");
+ public final static IndexPQ.Search_type_t ST_polysemous = new IndexPQ.Search_type_t("ST_polysemous");
+ public final static IndexPQ.Search_type_t ST_polysemous_generalize = new IndexPQ.Search_type_t("ST_polysemous_generalize");
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public String toString() {
+ return swigName;
+ }
+
+ public static Search_type_t swigToEnum(int swigValue) {
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (int i = 0; i < swigValues.length; i++)
+ if (swigValues[i].swigValue == swigValue)
+ return swigValues[i];
+ throw new IllegalArgumentException("No enum " + Search_type_t.class + " with value " + swigValue);
+ }
+
+ private Search_type_t(String swigName) {
+ this.swigName = swigName;
+ this.swigValue = swigNext++;
+ }
+
+ private Search_type_t(String swigName, int swigValue) {
+ this.swigName = swigName;
+ this.swigValue = swigValue;
+ swigNext = swigValue+1;
+ }
+
+ private Search_type_t(String swigName, Search_type_t swigEnum) {
+ this.swigName = swigName;
+ this.swigValue = swigEnum.swigValue;
+ swigNext = this.swigValue+1;
+ }
+
+ private static Search_type_t[] swigValues = { ST_PQ, ST_HE, ST_generalized_HE, ST_SDC, ST_polysemous, ST_polysemous_generalize };
+ private static int swigNext = 0;
+ private final int swigValue;
+ private final String swigName;
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQStats.java
new file mode 100644
index 000000000..c5e0b9d2b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQStats.java
@@ -0,0 +1,71 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexPQStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IndexPQStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexPQStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexPQStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNq(long value) {
+ swigfaissJNI.IndexPQStats_nq_set(swigCPtr, this, value);
+ }
+
+ public long getNq() {
+ return swigfaissJNI.IndexPQStats_nq_get(swigCPtr, this);
+ }
+
+ public void setNcode(long value) {
+ swigfaissJNI.IndexPQStats_ncode_set(swigCPtr, this, value);
+ }
+
+ public long getNcode() {
+ return swigfaissJNI.IndexPQStats_ncode_get(swigCPtr, this);
+ }
+
+ public void setN_hamming_pass(long value) {
+ swigfaissJNI.IndexPQStats_n_hamming_pass_set(swigCPtr, this, value);
+ }
+
+ public long getN_hamming_pass() {
+ return swigfaissJNI.IndexPQStats_n_hamming_pass_get(swigCPtr, this);
+ }
+
+ public IndexPQStats() {
+ this(swigfaissJNI.new_IndexPQStats(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexPQStats_reset(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefine.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefine.java
new file mode 100644
index 000000000..f0e1269d8
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefine.java
@@ -0,0 +1,121 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexRefine extends Index {
+ private transient long swigCPtr;
+
+ protected IndexRefine(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexRefine_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexRefine obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexRefine(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setBase_index(Index value) {
+ swigfaissJNI.IndexRefine_base_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getBase_index() {
+ long cPtr = swigfaissJNI.IndexRefine_base_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setRefine_index(Index value) {
+ swigfaissJNI.IndexRefine_refine_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getRefine_index() {
+ long cPtr = swigfaissJNI.IndexRefine_refine_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexRefine_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexRefine_own_fields_get(swigCPtr, this);
+ }
+
+ public void setOwn_refine_index(boolean value) {
+ swigfaissJNI.IndexRefine_own_refine_index_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_refine_index() {
+ return swigfaissJNI.IndexRefine_own_refine_index_get(swigCPtr, this);
+ }
+
+ public void setK_factor(float value) {
+ swigfaissJNI.IndexRefine_k_factor_set(swigCPtr, this, value);
+ }
+
+ public float getK_factor() {
+ return swigfaissJNI.IndexRefine_k_factor_get(swigCPtr, this);
+ }
+
+ public IndexRefine(Index base_index, Index refine_index) {
+ this(swigfaissJNI.new_IndexRefine__SWIG_0(Index.getCPtr(base_index), base_index, Index.getCPtr(refine_index), refine_index), true);
+ }
+
+ public IndexRefine() {
+ this(swigfaissJNI.new_IndexRefine__SWIG_1(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexRefine_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexRefine_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexRefine_reset(swigCPtr, this);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexRefine_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.IndexRefine_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+ public long sa_code_size() {
+ return swigfaissJNI.IndexRefine_sa_code_size(swigCPtr, this);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexRefine_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexRefine_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefineFlat.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefineFlat.java
new file mode 100644
index 000000000..5b4b43b03
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefineFlat.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexRefineFlat extends IndexRefine {
+ private transient long swigCPtr;
+
+ protected IndexRefineFlat(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexRefineFlat_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexRefineFlat obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexRefineFlat(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public IndexRefineFlat(Index base_index) {
+ this(swigfaissJNI.new_IndexRefineFlat__SWIG_0(Index.getCPtr(base_index), base_index), true);
+ }
+
+ public IndexRefineFlat(Index base_index, SWIGTYPE_p_float xb) {
+ this(swigfaissJNI.new_IndexRefineFlat__SWIG_1(Index.getCPtr(base_index), base_index, SWIGTYPE_p_float.getCPtr(xb)), true);
+ }
+
+ public IndexRefineFlat() {
+ this(swigfaissJNI.new_IndexRefineFlat__SWIG_2(), true);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexRefineFlat_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexScalarQuantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexScalarQuantizer.java
new file mode 100644
index 000000000..0d7e862e5
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexScalarQuantizer.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexScalarQuantizer extends IndexFlatCodes {
+ private transient long swigCPtr;
+
+ protected IndexScalarQuantizer(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexScalarQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexScalarQuantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexScalarQuantizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setSq(SWIGTYPE_p_ScalarQuantizer value) {
+ swigfaissJNI.IndexScalarQuantizer_sq_set(swigCPtr, this, SWIGTYPE_p_ScalarQuantizer.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_ScalarQuantizer getSq() {
+ return new SWIGTYPE_p_ScalarQuantizer(swigfaissJNI.IndexScalarQuantizer_sq_get(swigCPtr, this), true);
+ }
+
+ public IndexScalarQuantizer(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric) {
+ this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_0(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue()), true);
+ }
+
+ public IndexScalarQuantizer(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype) {
+ this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_1(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype)), true);
+ }
+
+ public IndexScalarQuantizer() {
+ this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_2(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexScalarQuantizer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexScalarQuantizer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public DistanceComputer get_distance_computer() {
+ long cPtr = swigfaissJNI.IndexScalarQuantizer_get_distance_computer(swigCPtr, this);
+ return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
+ }
+
+ public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
+ swigfaissJNI.IndexScalarQuantizer_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
+ }
+
+ public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexScalarQuantizer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexShards.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexShards.java
new file mode 100644
index 000000000..a86d128f9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexShards.java
@@ -0,0 +1,99 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexShards {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IndexShards(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexShards obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexShards(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public IndexShards(boolean threaded, boolean successive_ids) {
+ this(swigfaissJNI.new_IndexShards__SWIG_0(threaded, successive_ids), true);
+ }
+
+ public IndexShards(boolean threaded) {
+ this(swigfaissJNI.new_IndexShards__SWIG_1(threaded), true);
+ }
+
+ public IndexShards() {
+ this(swigfaissJNI.new_IndexShards__SWIG_2(), true);
+ }
+
+ public IndexShards(int d, boolean threaded, boolean successive_ids) {
+ this(swigfaissJNI.new_IndexShards__SWIG_3(d, threaded, successive_ids), true);
+ }
+
+ public IndexShards(int d, boolean threaded) {
+ this(swigfaissJNI.new_IndexShards__SWIG_4(d, threaded), true);
+ }
+
+ public IndexShards(int d) {
+ this(swigfaissJNI.new_IndexShards__SWIG_5(d), true);
+ }
+
+ public void add_shard(Index index) {
+ swigfaissJNI.IndexShards_add_shard(swigCPtr, this, Index.getCPtr(index), index);
+ }
+
+ public void remove_shard(Index index) {
+ swigfaissJNI.IndexShards_remove_shard(swigCPtr, this, Index.getCPtr(index), index);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexShards_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
+ swigfaissJNI.IndexShards_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexShards_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexShards_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void setSuccessive_ids(boolean value) {
+ swigfaissJNI.IndexShards_successive_ids_set(swigCPtr, this, value);
+ }
+
+ public boolean getSuccessive_ids() {
+ return swigfaissJNI.IndexShards_successive_ids_get(swigCPtr, this);
+ }
+
+ public void syncWithSubIndexes() {
+ swigfaissJNI.IndexShards_syncWithSubIndexes(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IndexSplitVectors.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexSplitVectors.java
new file mode 100644
index 000000000..701d89919
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IndexSplitVectors.java
@@ -0,0 +1,96 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IndexSplitVectors extends Index {
+ private transient long swigCPtr;
+
+ protected IndexSplitVectors(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IndexSplitVectors_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IndexSplitVectors obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IndexSplitVectors(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.IndexSplitVectors_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.IndexSplitVectors_own_fields_get(swigCPtr, this);
+ }
+
+ public void setThreaded(boolean value) {
+ swigfaissJNI.IndexSplitVectors_threaded_set(swigCPtr, this, value);
+ }
+
+ public boolean getThreaded() {
+ return swigfaissJNI.IndexSplitVectors_threaded_get(swigCPtr, this);
+ }
+
+ public void setSub_indexes(SWIGTYPE_p_std__vectorT_faiss__Index_p_t value) {
+ swigfaissJNI.IndexSplitVectors_sub_indexes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__Index_p_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__Index_p_t getSub_indexes() {
+ long cPtr = swigfaissJNI.IndexSplitVectors_sub_indexes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__Index_p_t(cPtr, false);
+ }
+
+ public void setSum_d(long value) {
+ swigfaissJNI.IndexSplitVectors_sum_d_set(swigCPtr, this, value);
+ }
+
+ public long getSum_d() {
+ return swigfaissJNI.IndexSplitVectors_sum_d_get(swigCPtr, this);
+}
+
+ public void add_sub_index(Index arg0) {
+ swigfaissJNI.IndexSplitVectors_add_sub_index(swigCPtr, this, Index.getCPtr(arg0), arg0);
+ }
+
+ public void sync_with_sub_indexes() {
+ swigfaissJNI.IndexSplitVectors_sync_with_sub_indexes(swigCPtr, this);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexSplitVectors_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.IndexSplitVectors_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.IndexSplitVectors_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.IndexSplitVectors_reset(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IntVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IntVector.java
new file mode 100644
index 000000000..712ea3718
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IntVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IntVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected IntVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IntVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IntVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public IntVector() {
+ this(swigfaissJNI.new_IntVector(), true);
+ }
+
+ public void push_back(int arg0) {
+ swigfaissJNI.IntVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.IntVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_int data() {
+ long cPtr = swigfaissJNI.IntVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.IntVector_size(swigCPtr, this);
+ }
+
+ public int at(long n) {
+ return swigfaissJNI.IntVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.IntVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.IntVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(IntVector other) {
+ swigfaissJNI.IntVector_swap(swigCPtr, this, IntVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/InterruptCallback.java b/ann/src/main/java/com/twitter/ann/faiss/swig/InterruptCallback.java
new file mode 100644
index 000000000..3213696de
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/InterruptCallback.java
@@ -0,0 +1,59 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class InterruptCallback {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected InterruptCallback(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(InterruptCallback obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_InterruptCallback(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public boolean want_interrupt() {
+ return swigfaissJNI.InterruptCallback_want_interrupt(swigCPtr, this);
+ }
+
+ public static void clear_instance() {
+ swigfaissJNI.InterruptCallback_clear_instance();
+ }
+
+ public static void check() {
+ swigfaissJNI.InterruptCallback_check();
+ }
+
+ public static boolean is_interrupted() {
+ return swigfaissJNI.InterruptCallback_is_interrupted();
+ }
+
+ public static long get_period_hint(long flops) {
+ return swigfaissJNI.InterruptCallback_get_period_hint(flops);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/IntersectionCriterion.java b/ann/src/main/java/com/twitter/ann/faiss/swig/IntersectionCriterion.java
new file mode 100644
index 000000000..80f44e1d2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/IntersectionCriterion.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class IntersectionCriterion extends AutoTuneCriterion {
+ private transient long swigCPtr;
+
+ protected IntersectionCriterion(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.IntersectionCriterion_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(IntersectionCriterion obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_IntersectionCriterion(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setR(long value) {
+ swigfaissJNI.IntersectionCriterion_R_set(swigCPtr, this, value);
+ }
+
+ public long getR() {
+ return swigfaissJNI.IntersectionCriterion_R_get(swigCPtr, this);
+}
+
+ public IntersectionCriterion(long nq, long R) {
+ this(swigfaissJNI.new_IntersectionCriterion(nq, R), true);
+ }
+
+ public double evaluate(SWIGTYPE_p_float D, LongVector I) {
+ return swigfaissJNI.IntersectionCriterion_evaluate(swigCPtr, this, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedLists.java
new file mode 100644
index 000000000..d7311cc75
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedLists.java
@@ -0,0 +1,262 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class InvertedLists {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected InvertedLists(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(InvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_InvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNlist(long value) {
+ swigfaissJNI.InvertedLists_nlist_set(swigCPtr, this, value);
+ }
+
+ public long getNlist() {
+ return swigfaissJNI.InvertedLists_nlist_get(swigCPtr, this);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.InvertedLists_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.InvertedLists_code_size_get(swigCPtr, this);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.InvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.InvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.InvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.InvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.InvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.InvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.InvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.InvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+ public long add_entry(long list_no, long theid, SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.InvertedLists_add_entry(swigCPtr, this, list_no, theid, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.InvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void update_entry(long list_no, long offset, long id, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.InvertedLists_update_entry(swigCPtr, this, list_no, offset, id, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.InvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void resize(long list_no, long new_size) {
+ swigfaissJNI.InvertedLists_resize(swigCPtr, this, list_no, new_size);
+ }
+
+ public void reset() {
+ swigfaissJNI.InvertedLists_reset(swigCPtr, this);
+ }
+
+ public void merge_from(InvertedLists oivf, long add_id) {
+ swigfaissJNI.InvertedLists_merge_from(swigCPtr, this, InvertedLists.getCPtr(oivf), oivf, add_id);
+ }
+
+ public double imbalance_factor() {
+ return swigfaissJNI.InvertedLists_imbalance_factor(swigCPtr, this);
+ }
+
+ public void print_stats() {
+ swigfaissJNI.InvertedLists_print_stats(swigCPtr, this);
+ }
+
+ public long compute_ntotal() {
+ return swigfaissJNI.InvertedLists_compute_ntotal(swigCPtr, this);
+ }
+
+ static public class ScopedIds {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ScopedIds(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ScopedIds obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_InvertedLists_ScopedIds(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setIl(InvertedLists value) {
+ swigfaissJNI.InvertedLists_ScopedIds_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl() {
+ long cPtr = swigfaissJNI.InvertedLists_ScopedIds_il_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.InvertedLists_ScopedIds_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_ids_get(swigCPtr, this), false);
+ }
+
+ public void setList_no(long value) {
+ swigfaissJNI.InvertedLists_ScopedIds_list_no_set(swigCPtr, this, value);
+ }
+
+ public long getList_no() {
+ return swigfaissJNI.InvertedLists_ScopedIds_list_no_get(swigCPtr, this);
+ }
+
+ public ScopedIds(InvertedLists il, long list_no) {
+ this(swigfaissJNI.new_InvertedLists_ScopedIds(InvertedLists.getCPtr(il), il, list_no), true);
+ }
+
+ public LongVector get() {
+ return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_get(swigCPtr, this), false);
+ }
+
+ }
+
+ static public class ScopedCodes {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ScopedCodes(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ScopedCodes obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_InvertedLists_ScopedCodes(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setIl(InvertedLists value) {
+ swigfaissJNI.InvertedLists_ScopedCodes_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl() {
+ long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_il_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setCodes(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.InvertedLists_ScopedCodes_codes_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCodes() {
+ long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_codes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setList_no(long value) {
+ swigfaissJNI.InvertedLists_ScopedCodes_list_no_set(swigCPtr, this, value);
+ }
+
+ public long getList_no() {
+ return swigfaissJNI.InvertedLists_ScopedCodes_list_no_get(swigCPtr, this);
+ }
+
+ public ScopedCodes(InvertedLists il, long list_no) {
+ this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_0(InvertedLists.getCPtr(il), il, list_no), true);
+ }
+
+ public ScopedCodes(InvertedLists il, long list_no, long offset) {
+ this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_1(InvertedLists.getCPtr(il), il, list_no, offset), true);
+ }
+
+ public SWIGTYPE_p_unsigned_char get() {
+ long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ }
+
+ public final static long INVALID_CODE_SIZE = swigfaissJNI.InvertedLists_INVALID_CODE_SIZE_get();
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedListsPtrVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedListsPtrVector.java
new file mode 100644
index 000000000..4c9a14b74
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/InvertedListsPtrVector.java
@@ -0,0 +1,77 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class InvertedListsPtrVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected InvertedListsPtrVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(InvertedListsPtrVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_InvertedListsPtrVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public InvertedListsPtrVector() {
+ this(swigfaissJNI.new_InvertedListsPtrVector(), true);
+ }
+
+ public void push_back(InvertedLists arg0) {
+ swigfaissJNI.InvertedListsPtrVector_push_back(swigCPtr, this, InvertedLists.getCPtr(arg0), arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.InvertedListsPtrVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_p_faiss__InvertedLists data() {
+ long cPtr = swigfaissJNI.InvertedListsPtrVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_p_faiss__InvertedLists(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.InvertedListsPtrVector_size(swigCPtr, this);
+ }
+
+ public InvertedLists at(long n) {
+ long cPtr = swigfaissJNI.InvertedListsPtrVector_at(swigCPtr, this, n);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.InvertedListsPtrVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.InvertedListsPtrVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(InvertedListsPtrVector other) {
+ swigfaissJNI.InvertedListsPtrVector_swap(swigCPtr, this, InvertedListsPtrVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Level1Quantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Level1Quantizer.java
new file mode 100644
index 000000000..9de2d8c44
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Level1Quantizer.java
@@ -0,0 +1,114 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Level1Quantizer {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected Level1Quantizer(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Level1Quantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Level1Quantizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setQuantizer(Index value) {
+ swigfaissJNI.Level1Quantizer_quantizer_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getQuantizer() {
+ long cPtr = swigfaissJNI.Level1Quantizer_quantizer_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setNlist(long value) {
+ swigfaissJNI.Level1Quantizer_nlist_set(swigCPtr, this, value);
+ }
+
+ public long getNlist() {
+ return swigfaissJNI.Level1Quantizer_nlist_get(swigCPtr, this);
+ }
+
+ public void setQuantizer_trains_alone(char value) {
+ swigfaissJNI.Level1Quantizer_quantizer_trains_alone_set(swigCPtr, this, value);
+ }
+
+ public char getQuantizer_trains_alone() {
+ return swigfaissJNI.Level1Quantizer_quantizer_trains_alone_get(swigCPtr, this);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.Level1Quantizer_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.Level1Quantizer_own_fields_get(swigCPtr, this);
+ }
+
+ public void setCp(ClusteringParameters value) {
+ swigfaissJNI.Level1Quantizer_cp_set(swigCPtr, this, ClusteringParameters.getCPtr(value), value);
+ }
+
+ public ClusteringParameters getCp() {
+ long cPtr = swigfaissJNI.Level1Quantizer_cp_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ClusteringParameters(cPtr, false);
+ }
+
+ public void setClustering_index(Index value) {
+ swigfaissJNI.Level1Quantizer_clustering_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getClustering_index() {
+ long cPtr = swigfaissJNI.Level1Quantizer_clustering_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void train_q1(long n, SWIGTYPE_p_float x, boolean verbose, MetricType metric_type) {
+ swigfaissJNI.Level1Quantizer_train_q1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), verbose, metric_type.swigValue());
+ }
+
+ public long coarse_code_size() {
+ return swigfaissJNI.Level1Quantizer_coarse_code_size(swigCPtr, this);
+ }
+
+ public void encode_listno(long list_no, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.Level1Quantizer_encode_listno(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public long decode_listno(SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.Level1Quantizer_decode_listno(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(code));
+}
+
+ public Level1Quantizer(Index quantizer, long nlist) {
+ this(swigfaissJNI.new_Level1Quantizer__SWIG_0(Index.getCPtr(quantizer), quantizer, nlist), true);
+ }
+
+ public Level1Quantizer() {
+ this(swigfaissJNI.new_Level1Quantizer__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/LinearTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/LinearTransform.java
new file mode 100644
index 000000000..6353fb0c2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/LinearTransform.java
@@ -0,0 +1,117 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class LinearTransform extends VectorTransform {
+ private transient long swigCPtr;
+
+ protected LinearTransform(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.LinearTransform_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(LinearTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_LinearTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setHave_bias(boolean value) {
+ swigfaissJNI.LinearTransform_have_bias_set(swigCPtr, this, value);
+ }
+
+ public boolean getHave_bias() {
+ return swigfaissJNI.LinearTransform_have_bias_get(swigCPtr, this);
+ }
+
+ public void setIs_orthonormal(boolean value) {
+ swigfaissJNI.LinearTransform_is_orthonormal_set(swigCPtr, this, value);
+ }
+
+ public boolean getIs_orthonormal() {
+ return swigfaissJNI.LinearTransform_is_orthonormal_get(swigCPtr, this);
+ }
+
+ public void setA(FloatVector value) {
+ swigfaissJNI.LinearTransform_A_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getA() {
+ long cPtr = swigfaissJNI.LinearTransform_A_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setB(FloatVector value) {
+ swigfaissJNI.LinearTransform_b_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getB() {
+ long cPtr = swigfaissJNI.LinearTransform_b_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public LinearTransform(int d_in, int d_out, boolean have_bias) {
+ this(swigfaissJNI.new_LinearTransform__SWIG_0(d_in, d_out, have_bias), true);
+ }
+
+ public LinearTransform(int d_in, int d_out) {
+ this(swigfaissJNI.new_LinearTransform__SWIG_1(d_in, d_out), true);
+ }
+
+ public LinearTransform(int d_in) {
+ this(swigfaissJNI.new_LinearTransform__SWIG_2(d_in), true);
+ }
+
+ public LinearTransform() {
+ this(swigfaissJNI.new_LinearTransform__SWIG_3(), true);
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.LinearTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+ public void transform_transpose(long n, SWIGTYPE_p_float y, SWIGTYPE_p_float x) {
+ swigfaissJNI.LinearTransform_transform_transpose(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(y), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
+ swigfaissJNI.LinearTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void set_is_orthonormal() {
+ swigfaissJNI.LinearTransform_set_is_orthonormal(swigCPtr, this);
+ }
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.LinearTransform_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.LinearTransform_verbose_get(swigCPtr, this);
+ }
+
+ public void print_if_verbose(String name, DoubleVector mat, int n, int d) {
+ swigfaissJNI.LinearTransform_print_if_verbose(swigCPtr, this, name, DoubleVector.getCPtr(mat), mat, n, d);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/LongVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/LongVector.java
new file mode 100644
index 000000000..89c5cdf5a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/LongVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class LongVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected LongVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(LongVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_LongVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public LongVector() {
+ this(swigfaissJNI.new_LongVector(), true);
+ }
+
+ public void push_back(long arg0) {
+ swigfaissJNI.LongVector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.LongVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_long_long data() {
+ long cPtr = swigfaissJNI.LongVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_long_long(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.LongVector_size(swigCPtr, this);
+ }
+
+ public long at(long n) {
+ return swigfaissJNI.LongVector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.LongVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.LongVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(LongVector other) {
+ swigfaissJNI.LongVector_swap(swigCPtr, this, LongVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/LongVectorVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/LongVectorVector.java
new file mode 100644
index 000000000..485573bac
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/LongVectorVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class LongVectorVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected LongVectorVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(LongVectorVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_LongVectorVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public LongVectorVector() {
+ this(swigfaissJNI.new_LongVectorVector(), true);
+ }
+
+ public void push_back(SWIGTYPE_p_std__vectorT_long_t arg0) {
+ swigfaissJNI.LongVectorVector_push_back(swigCPtr, this, SWIGTYPE_p_std__vectorT_long_t.getCPtr(arg0));
+ }
+
+ public void clear() {
+ swigfaissJNI.LongVectorVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_std__vectorT_long_t data() {
+ long cPtr = swigfaissJNI.LongVectorVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_long_t(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.LongVectorVector_size(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_std__vectorT_long_t at(long n) {
+ return new SWIGTYPE_p_std__vectorT_long_t(swigfaissJNI.LongVectorVector_at(swigCPtr, this, n), true);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.LongVectorVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.LongVectorVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(LongVectorVector other) {
+ swigfaissJNI.LongVectorVector_swap(swigCPtr, this, LongVectorVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/MapLong2Long.java b/ann/src/main/java/com/twitter/ann/faiss/swig/MapLong2Long.java
new file mode 100644
index 000000000..0ecaaf053
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/MapLong2Long.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class MapLong2Long {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected MapLong2Long(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(MapLong2Long obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_MapLong2Long(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setMap(SWIGTYPE_p_std__unordered_mapT_long_long_t value) {
+ swigfaissJNI.MapLong2Long_map_set(swigCPtr, this, SWIGTYPE_p_std__unordered_mapT_long_long_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__unordered_mapT_long_long_t getMap() {
+ return new SWIGTYPE_p_std__unordered_mapT_long_long_t(swigfaissJNI.MapLong2Long_map_get(swigCPtr, this), true);
+ }
+
+ public void add(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_long vals) {
+ swigfaissJNI.MapLong2Long_add(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(keys), SWIGTYPE_p_long.getCPtr(vals));
+ }
+
+ public int search(int key) {
+ return swigfaissJNI.MapLong2Long_search(swigCPtr, this, key);
+ }
+
+ public void search_multiple(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_long vals) {
+ swigfaissJNI.MapLong2Long_search_multiple(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(keys), SWIGTYPE_p_long.getCPtr(vals));
+ }
+
+ public MapLong2Long() {
+ this(swigfaissJNI.new_MapLong2Long(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/MaskedInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/MaskedInvertedLists.java
new file mode 100644
index 000000000..70dbb1a72
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/MaskedInvertedLists.java
@@ -0,0 +1,95 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class MaskedInvertedLists extends ReadOnlyInvertedLists {
+ private transient long swigCPtr;
+
+ protected MaskedInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.MaskedInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(MaskedInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_MaskedInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIl0(InvertedLists value) {
+ swigfaissJNI.MaskedInvertedLists_il0_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl0() {
+ long cPtr = swigfaissJNI.MaskedInvertedLists_il0_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setIl1(InvertedLists value) {
+ swigfaissJNI.MaskedInvertedLists_il1_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl1() {
+ long cPtr = swigfaissJNI.MaskedInvertedLists_il1_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public MaskedInvertedLists(InvertedLists il0, InvertedLists il1) {
+ this(swigfaissJNI.new_MaskedInvertedLists(InvertedLists.getCPtr(il0), il0, InvertedLists.getCPtr(il1), il1), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.MaskedInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.MaskedInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.MaskedInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.MaskedInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.MaskedInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.MaskedInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.MaskedInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.MaskedInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/MetricType.java b/ann/src/main/java/com/twitter/ann/faiss/swig/MetricType.java
new file mode 100644
index 000000000..5382e1544
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/MetricType.java
@@ -0,0 +1,60 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public final class MetricType {
+ public final static MetricType METRIC_INNER_PRODUCT = new MetricType("METRIC_INNER_PRODUCT", swigfaissJNI.METRIC_INNER_PRODUCT_get());
+ public final static MetricType METRIC_L2 = new MetricType("METRIC_L2", swigfaissJNI.METRIC_L2_get());
+ public final static MetricType METRIC_L1 = new MetricType("METRIC_L1");
+ public final static MetricType METRIC_Linf = new MetricType("METRIC_Linf");
+ public final static MetricType METRIC_Lp = new MetricType("METRIC_Lp");
+ public final static MetricType METRIC_Canberra = new MetricType("METRIC_Canberra", swigfaissJNI.METRIC_Canberra_get());
+ public final static MetricType METRIC_BrayCurtis = new MetricType("METRIC_BrayCurtis");
+ public final static MetricType METRIC_JensenShannon = new MetricType("METRIC_JensenShannon");
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public String toString() {
+ return swigName;
+ }
+
+ public static MetricType swigToEnum(int swigValue) {
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (int i = 0; i < swigValues.length; i++)
+ if (swigValues[i].swigValue == swigValue)
+ return swigValues[i];
+ throw new IllegalArgumentException("No enum " + MetricType.class + " with value " + swigValue);
+ }
+
+ private MetricType(String swigName) {
+ this.swigName = swigName;
+ this.swigValue = swigNext++;
+ }
+
+ private MetricType(String swigName, int swigValue) {
+ this.swigName = swigName;
+ this.swigValue = swigValue;
+ swigNext = swigValue+1;
+ }
+
+ private MetricType(String swigName, MetricType swigEnum) {
+ this.swigName = swigName;
+ this.swigValue = swigEnum.swigValue;
+ swigNext = this.swigValue+1;
+ }
+
+ private static MetricType[] swigValues = { METRIC_INNER_PRODUCT, METRIC_L2, METRIC_L1, METRIC_Linf, METRIC_Lp, METRIC_Canberra, METRIC_BrayCurtis, METRIC_JensenShannon };
+ private static int swigNext = 0;
+ private final int swigValue;
+ private final String swigName;
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer.java
new file mode 100644
index 000000000..b0ee9c3c4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class MultiIndexQuantizer extends Index {
+ private transient long swigCPtr;
+
+ protected MultiIndexQuantizer(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.MultiIndexQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(MultiIndexQuantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_MultiIndexQuantizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setPq(ProductQuantizer value) {
+ swigfaissJNI.MultiIndexQuantizer_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
+ }
+
+ public ProductQuantizer getPq() {
+ long cPtr = swigfaissJNI.MultiIndexQuantizer_pq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
+ }
+
+ public MultiIndexQuantizer(int d, long M, long nbits) {
+ this(swigfaissJNI.new_MultiIndexQuantizer__SWIG_0(d, M, nbits), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.MultiIndexQuantizer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.MultiIndexQuantizer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public void add(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.MultiIndexQuantizer_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void reset() {
+ swigfaissJNI.MultiIndexQuantizer_reset(swigCPtr, this);
+ }
+
+ public MultiIndexQuantizer() {
+ this(swigfaissJNI.new_MultiIndexQuantizer__SWIG_1(), true);
+ }
+
+ public void reconstruct(long key, SWIGTYPE_p_float recons) {
+ swigfaissJNI.MultiIndexQuantizer_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer2.java b/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer2.java
new file mode 100644
index 000000000..519c123c4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/MultiIndexQuantizer2.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class MultiIndexQuantizer2 extends MultiIndexQuantizer {
+ private transient long swigCPtr;
+
+ protected MultiIndexQuantizer2(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.MultiIndexQuantizer2_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(MultiIndexQuantizer2 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_MultiIndexQuantizer2(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setAssign_indexes(SWIGTYPE_p_std__vectorT_faiss__Index_p_t value) {
+ swigfaissJNI.MultiIndexQuantizer2_assign_indexes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__Index_p_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__Index_p_t getAssign_indexes() {
+ long cPtr = swigfaissJNI.MultiIndexQuantizer2_assign_indexes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__Index_p_t(cPtr, false);
+ }
+
+ public void setOwn_fields(boolean value) {
+ swigfaissJNI.MultiIndexQuantizer2_own_fields_set(swigCPtr, this, value);
+ }
+
+ public boolean getOwn_fields() {
+ return swigfaissJNI.MultiIndexQuantizer2_own_fields_get(swigCPtr, this);
+ }
+
+ public MultiIndexQuantizer2(int d, long M, long nbits, SWIGTYPE_p_p_faiss__Index indexes) {
+ this(swigfaissJNI.new_MultiIndexQuantizer2__SWIG_0(d, M, nbits, SWIGTYPE_p_p_faiss__Index.getCPtr(indexes)), true);
+ }
+
+ public MultiIndexQuantizer2(int d, long nbits, Index assign_index_0, Index assign_index_1) {
+ this(swigfaissJNI.new_MultiIndexQuantizer2__SWIG_1(d, nbits, Index.getCPtr(assign_index_0), assign_index_0, Index.getCPtr(assign_index_1), assign_index_1), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.MultiIndexQuantizer2_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
+ swigfaissJNI.MultiIndexQuantizer2_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/NormalizationTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/NormalizationTransform.java
new file mode 100644
index 000000000..aaa38642c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/NormalizationTransform.java
@@ -0,0 +1,67 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class NormalizationTransform extends VectorTransform {
+ private transient long swigCPtr;
+
+ protected NormalizationTransform(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.NormalizationTransform_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(NormalizationTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_NormalizationTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setNorm(float value) {
+ swigfaissJNI.NormalizationTransform_norm_set(swigCPtr, this, value);
+ }
+
+ public float getNorm() {
+ return swigfaissJNI.NormalizationTransform_norm_get(swigCPtr, this);
+ }
+
+ public NormalizationTransform(int d, float norm) {
+ this(swigfaissJNI.new_NormalizationTransform__SWIG_0(d, norm), true);
+ }
+
+ public NormalizationTransform(int d) {
+ this(swigfaissJNI.new_NormalizationTransform__SWIG_1(d), true);
+ }
+
+ public NormalizationTransform() {
+ this(swigfaissJNI.new_NormalizationTransform__SWIG_2(), true);
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.NormalizationTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+ public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
+ swigfaissJNI.NormalizationTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OPQMatrix.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OPQMatrix.java
new file mode 100644
index 000000000..fafaf07d9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OPQMatrix.java
@@ -0,0 +1,116 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OPQMatrix extends LinearTransform {
+ private transient long swigCPtr;
+
+ protected OPQMatrix(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.OPQMatrix_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OPQMatrix obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OPQMatrix(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setM(int value) {
+ swigfaissJNI.OPQMatrix_M_set(swigCPtr, this, value);
+ }
+
+ public int getM() {
+ return swigfaissJNI.OPQMatrix_M_get(swigCPtr, this);
+ }
+
+ public void setNiter(int value) {
+ swigfaissJNI.OPQMatrix_niter_set(swigCPtr, this, value);
+ }
+
+ public int getNiter() {
+ return swigfaissJNI.OPQMatrix_niter_get(swigCPtr, this);
+ }
+
+ public void setNiter_pq(int value) {
+ swigfaissJNI.OPQMatrix_niter_pq_set(swigCPtr, this, value);
+ }
+
+ public int getNiter_pq() {
+ return swigfaissJNI.OPQMatrix_niter_pq_get(swigCPtr, this);
+ }
+
+ public void setNiter_pq_0(int value) {
+ swigfaissJNI.OPQMatrix_niter_pq_0_set(swigCPtr, this, value);
+ }
+
+ public int getNiter_pq_0() {
+ return swigfaissJNI.OPQMatrix_niter_pq_0_get(swigCPtr, this);
+ }
+
+ public void setMax_train_points(long value) {
+ swigfaissJNI.OPQMatrix_max_train_points_set(swigCPtr, this, value);
+ }
+
+ public long getMax_train_points() {
+ return swigfaissJNI.OPQMatrix_max_train_points_get(swigCPtr, this);
+ }
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.OPQMatrix_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.OPQMatrix_verbose_get(swigCPtr, this);
+ }
+
+ public void setPq(ProductQuantizer value) {
+ swigfaissJNI.OPQMatrix_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
+ }
+
+ public ProductQuantizer getPq() {
+ long cPtr = swigfaissJNI.OPQMatrix_pq_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
+ }
+
+ public OPQMatrix(int d, int M, int d2) {
+ this(swigfaissJNI.new_OPQMatrix__SWIG_0(d, M, d2), true);
+ }
+
+ public OPQMatrix(int d, int M) {
+ this(swigfaissJNI.new_OPQMatrix__SWIG_1(d, M), true);
+ }
+
+ public OPQMatrix(int d) {
+ this(swigfaissJNI.new_OPQMatrix__SWIG_2(d), true);
+ }
+
+ public OPQMatrix() {
+ this(swigfaissJNI.new_OPQMatrix__SWIG_3(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.OPQMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedLists.java
new file mode 100644
index 000000000..94d13f522
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedLists.java
@@ -0,0 +1,251 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OnDiskInvertedLists extends InvertedLists {
+ private transient long swigCPtr;
+
+ protected OnDiskInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.OnDiskInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OnDiskInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OnDiskInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setLists(SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t value) {
+ swigfaissJNI.OnDiskInvertedLists_lists_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t getLists() {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_lists_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t(cPtr, false);
+ }
+
+ static public class Slot {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected Slot(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Slot obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OnDiskInvertedLists_Slot(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setOffset(long value) {
+ swigfaissJNI.OnDiskInvertedLists_Slot_offset_set(swigCPtr, this, value);
+ }
+
+ public long getOffset() {
+ return swigfaissJNI.OnDiskInvertedLists_Slot_offset_get(swigCPtr, this);
+ }
+
+ public void setCapacity(long value) {
+ swigfaissJNI.OnDiskInvertedLists_Slot_capacity_set(swigCPtr, this, value);
+ }
+
+ public long getCapacity() {
+ return swigfaissJNI.OnDiskInvertedLists_Slot_capacity_get(swigCPtr, this);
+ }
+
+ public Slot(long offset, long capacity) {
+ this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_0(offset, capacity), true);
+ }
+
+ public Slot() {
+ this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_1(), true);
+ }
+
+ }
+
+ public void setSlots(SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t value) {
+ swigfaissJNI.OnDiskInvertedLists_slots_set(swigCPtr, this, SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t getSlots() {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_slots_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t(cPtr, false);
+ }
+
+ public void setFilename(String value) {
+ swigfaissJNI.OnDiskInvertedLists_filename_set(swigCPtr, this, value);
+ }
+
+ public String getFilename() {
+ return swigfaissJNI.OnDiskInvertedLists_filename_get(swigCPtr, this);
+ }
+
+ public void setTotsize(long value) {
+ swigfaissJNI.OnDiskInvertedLists_totsize_set(swigCPtr, this, value);
+ }
+
+ public long getTotsize() {
+ return swigfaissJNI.OnDiskInvertedLists_totsize_get(swigCPtr, this);
+ }
+
+ public void setPtr(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.OnDiskInvertedLists_ptr_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getPtr() {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_ptr_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setRead_only(boolean value) {
+ swigfaissJNI.OnDiskInvertedLists_read_only_set(swigCPtr, this, value);
+ }
+
+ public boolean getRead_only() {
+ return swigfaissJNI.OnDiskInvertedLists_read_only_get(swigCPtr, this);
+ }
+
+ public OnDiskInvertedLists(long nlist, long code_size, String filename) {
+ this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_0(nlist, code_size, filename), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.OnDiskInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.OnDiskInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.OnDiskInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.OnDiskInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void resize(long list_no, long new_size) {
+ swigfaissJNI.OnDiskInvertedLists_resize(swigCPtr, this, list_no, new_size);
+ }
+
+ public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il, boolean verbose) {
+ return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_0(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il, verbose);
+ }
+
+ public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il) {
+ return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_1(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il);
+ }
+
+ public long merge_from_1(InvertedLists il, boolean verbose) {
+ return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, verbose);
+ }
+
+ public long merge_from_1(InvertedLists il) {
+ return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
+ }
+
+ public void crop_invlists(long l0, long l1) {
+ swigfaissJNI.OnDiskInvertedLists_crop_invlists(swigCPtr, this, l0, l1);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.OnDiskInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+ public void setLocks(SWIGTYPE_p_faiss__LockLevels value) {
+ swigfaissJNI.OnDiskInvertedLists_locks_set(swigCPtr, this, SWIGTYPE_p_faiss__LockLevels.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__LockLevels getLocks() {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_locks_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__LockLevels(cPtr, false);
+ }
+
+ public void setPf(SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch value) {
+ swigfaissJNI.OnDiskInvertedLists_pf_set(swigCPtr, this, SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch getPf() {
+ long cPtr = swigfaissJNI.OnDiskInvertedLists_pf_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch(cPtr, false);
+ }
+
+ public void setPrefetch_nthread(int value) {
+ swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_set(swigCPtr, this, value);
+ }
+
+ public int getPrefetch_nthread() {
+ return swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_get(swigCPtr, this);
+ }
+
+ public void do_mmap() {
+ swigfaissJNI.OnDiskInvertedLists_do_mmap(swigCPtr, this);
+ }
+
+ public void update_totsize(long new_totsize) {
+ swigfaissJNI.OnDiskInvertedLists_update_totsize(swigCPtr, this, new_totsize);
+ }
+
+ public void resize_locked(long list_no, long new_size) {
+ swigfaissJNI.OnDiskInvertedLists_resize_locked(swigCPtr, this, list_no, new_size);
+ }
+
+ public long allocate_slot(long capacity) {
+ return swigfaissJNI.OnDiskInvertedLists_allocate_slot(swigCPtr, this, capacity);
+ }
+
+ public void free_slot(long offset, long capacity) {
+ swigfaissJNI.OnDiskInvertedLists_free_slot(swigCPtr, this, offset, capacity);
+ }
+
+ public void set_all_lists_sizes(SWIGTYPE_p_unsigned_long sizes) {
+ swigfaissJNI.OnDiskInvertedLists_set_all_lists_sizes(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(sizes));
+ }
+
+ public OnDiskInvertedLists() {
+ this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedListsIOHook.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedListsIOHook.java
new file mode 100644
index 000000000..15a2138ee
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskInvertedListsIOHook.java
@@ -0,0 +1,57 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OnDiskInvertedListsIOHook {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected OnDiskInvertedListsIOHook(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OnDiskInvertedListsIOHook obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OnDiskInvertedListsIOHook(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public OnDiskInvertedListsIOHook() {
+ this(swigfaissJNI.new_OnDiskInvertedListsIOHook(), true);
+ }
+
+ public void write(InvertedLists ils, SWIGTYPE_p_IOWriter f) {
+ swigfaissJNI.OnDiskInvertedListsIOHook_write(swigCPtr, this, InvertedLists.getCPtr(ils), ils, SWIGTYPE_p_IOWriter.getCPtr(f));
+ }
+
+ public InvertedLists read(SWIGTYPE_p_IOReader f, int io_flags) {
+ long cPtr = swigfaissJNI.OnDiskInvertedListsIOHook_read(swigCPtr, this, SWIGTYPE_p_IOReader.getCPtr(f), io_flags);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public InvertedLists read_ArrayInvertedLists(SWIGTYPE_p_IOReader f, int io_flags, long nlist, long code_size, Uint64Vector sizes) {
+ long cPtr = swigfaissJNI.OnDiskInvertedListsIOHook_read_ArrayInvertedLists(swigCPtr, this, SWIGTYPE_p_IOReader.getCPtr(f), io_flags, nlist, code_size, Uint64Vector.getCPtr(sizes), sizes);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskOneList.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskOneList.java
new file mode 100644
index 000000000..acc2cfae7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OnDiskOneList.java
@@ -0,0 +1,67 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OnDiskOneList {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected OnDiskOneList(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OnDiskOneList obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OnDiskOneList(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setSize(long value) {
+ swigfaissJNI.OnDiskOneList_size_set(swigCPtr, this, value);
+ }
+
+ public long getSize() {
+ return swigfaissJNI.OnDiskOneList_size_get(swigCPtr, this);
+ }
+
+ public void setCapacity(long value) {
+ swigfaissJNI.OnDiskOneList_capacity_set(swigCPtr, this, value);
+ }
+
+ public long getCapacity() {
+ return swigfaissJNI.OnDiskOneList_capacity_get(swigCPtr, this);
+ }
+
+ public void setOffset(long value) {
+ swigfaissJNI.OnDiskOneList_offset_set(swigCPtr, this, value);
+ }
+
+ public long getOffset() {
+ return swigfaissJNI.OnDiskOneList_offset_get(swigCPtr, this);
+ }
+
+ public OnDiskOneList() {
+ this(swigfaissJNI.new_OnDiskOneList(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OneRecallAtRCriterion.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OneRecallAtRCriterion.java
new file mode 100644
index 000000000..f57214205
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OneRecallAtRCriterion.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OneRecallAtRCriterion extends AutoTuneCriterion {
+ private transient long swigCPtr;
+
+ protected OneRecallAtRCriterion(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.OneRecallAtRCriterion_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OneRecallAtRCriterion obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OneRecallAtRCriterion(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setR(long value) {
+ swigfaissJNI.OneRecallAtRCriterion_R_set(swigCPtr, this, value);
+ }
+
+ public long getR() {
+ return swigfaissJNI.OneRecallAtRCriterion_R_get(swigCPtr, this);
+}
+
+ public OneRecallAtRCriterion(long nq, long R) {
+ this(swigfaissJNI.new_OneRecallAtRCriterion(nq, R), true);
+ }
+
+ public double evaluate(SWIGTYPE_p_float D, LongVector I) {
+ return swigfaissJNI.OneRecallAtRCriterion_evaluate(swigCPtr, this, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoint.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoint.java
new file mode 100644
index 000000000..ed0f71f5d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoint.java
@@ -0,0 +1,75 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OperatingPoint {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected OperatingPoint(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OperatingPoint obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OperatingPoint(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setPerf(double value) {
+ swigfaissJNI.OperatingPoint_perf_set(swigCPtr, this, value);
+ }
+
+ public double getPerf() {
+ return swigfaissJNI.OperatingPoint_perf_get(swigCPtr, this);
+ }
+
+ public void setT(double value) {
+ swigfaissJNI.OperatingPoint_t_set(swigCPtr, this, value);
+ }
+
+ public double getT() {
+ return swigfaissJNI.OperatingPoint_t_get(swigCPtr, this);
+ }
+
+ public void setKey(String value) {
+ swigfaissJNI.OperatingPoint_key_set(swigCPtr, this, value);
+ }
+
+ public String getKey() {
+ return swigfaissJNI.OperatingPoint_key_get(swigCPtr, this);
+ }
+
+ public void setCno(long value) {
+ swigfaissJNI.OperatingPoint_cno_set(swigCPtr, this, value);
+ }
+
+ public long getCno() {
+ return swigfaissJNI.OperatingPoint_cno_get(swigCPtr, this);
+}
+
+ public OperatingPoint() {
+ this(swigfaissJNI.new_OperatingPoint(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPointVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPointVector.java
new file mode 100644
index 000000000..42fab072b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPointVector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OperatingPointVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected OperatingPointVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OperatingPointVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OperatingPointVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public OperatingPointVector() {
+ this(swigfaissJNI.new_OperatingPointVector(), true);
+ }
+
+ public void push_back(OperatingPoint arg0) {
+ swigfaissJNI.OperatingPointVector_push_back(swigCPtr, this, OperatingPoint.getCPtr(arg0), arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.OperatingPointVector_clear(swigCPtr, this);
+ }
+
+ public OperatingPoint data() {
+ long cPtr = swigfaissJNI.OperatingPointVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new OperatingPoint(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.OperatingPointVector_size(swigCPtr, this);
+ }
+
+ public OperatingPoint at(long n) {
+ return new OperatingPoint(swigfaissJNI.OperatingPointVector_at(swigCPtr, this, n), true);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.OperatingPointVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.OperatingPointVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(OperatingPointVector other) {
+ swigfaissJNI.OperatingPointVector_swap(swigCPtr, this, OperatingPointVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoints.java b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoints.java
new file mode 100644
index 000000000..036e6730d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/OperatingPoints.java
@@ -0,0 +1,101 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class OperatingPoints {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected OperatingPoints(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(OperatingPoints obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_OperatingPoints(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setAll_pts(OperatingPointVector value) {
+ swigfaissJNI.OperatingPoints_all_pts_set(swigCPtr, this, OperatingPointVector.getCPtr(value), value);
+ }
+
+ public OperatingPointVector getAll_pts() {
+ long cPtr = swigfaissJNI.OperatingPoints_all_pts_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new OperatingPointVector(cPtr, false);
+ }
+
+ public void setOptimal_pts(OperatingPointVector value) {
+ swigfaissJNI.OperatingPoints_optimal_pts_set(swigCPtr, this, OperatingPointVector.getCPtr(value), value);
+ }
+
+ public OperatingPointVector getOptimal_pts() {
+ long cPtr = swigfaissJNI.OperatingPoints_optimal_pts_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new OperatingPointVector(cPtr, false);
+ }
+
+ public OperatingPoints() {
+ this(swigfaissJNI.new_OperatingPoints(), true);
+ }
+
+ public int merge_with(OperatingPoints other, String prefix) {
+ return swigfaissJNI.OperatingPoints_merge_with__SWIG_0(swigCPtr, this, OperatingPoints.getCPtr(other), other, prefix);
+ }
+
+ public int merge_with(OperatingPoints other) {
+ return swigfaissJNI.OperatingPoints_merge_with__SWIG_1(swigCPtr, this, OperatingPoints.getCPtr(other), other);
+ }
+
+ public void clear() {
+ swigfaissJNI.OperatingPoints_clear(swigCPtr, this);
+ }
+
+ public boolean add(double perf, double t, String key, long cno) {
+ return swigfaissJNI.OperatingPoints_add__SWIG_0(swigCPtr, this, perf, t, key, cno);
+ }
+
+ public boolean add(double perf, double t, String key) {
+ return swigfaissJNI.OperatingPoints_add__SWIG_1(swigCPtr, this, perf, t, key);
+ }
+
+ public double t_for_perf(double perf) {
+ return swigfaissJNI.OperatingPoints_t_for_perf(swigCPtr, this, perf);
+ }
+
+ public void display(boolean only_optimal) {
+ swigfaissJNI.OperatingPoints_display__SWIG_0(swigCPtr, this, only_optimal);
+ }
+
+ public void display() {
+ swigfaissJNI.OperatingPoints_display__SWIG_1(swigCPtr, this);
+ }
+
+ public void all_to_gnuplot(String fname) {
+ swigfaissJNI.OperatingPoints_all_to_gnuplot(swigCPtr, this, fname);
+ }
+
+ public void optimal_to_gnuplot(String fname) {
+ swigfaissJNI.OperatingPoints_optimal_to_gnuplot(swigCPtr, this, fname);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PCAMatrix.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PCAMatrix.java
new file mode 100644
index 000000000..caa7864a0
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PCAMatrix.java
@@ -0,0 +1,138 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PCAMatrix extends LinearTransform {
+ private transient long swigCPtr;
+
+ protected PCAMatrix(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.PCAMatrix_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PCAMatrix obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PCAMatrix(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setEigen_power(float value) {
+ swigfaissJNI.PCAMatrix_eigen_power_set(swigCPtr, this, value);
+ }
+
+ public float getEigen_power() {
+ return swigfaissJNI.PCAMatrix_eigen_power_get(swigCPtr, this);
+ }
+
+ public void setEpsilon(float value) {
+ swigfaissJNI.PCAMatrix_epsilon_set(swigCPtr, this, value);
+ }
+
+ public float getEpsilon() {
+ return swigfaissJNI.PCAMatrix_epsilon_get(swigCPtr, this);
+ }
+
+ public void setRandom_rotation(boolean value) {
+ swigfaissJNI.PCAMatrix_random_rotation_set(swigCPtr, this, value);
+ }
+
+ public boolean getRandom_rotation() {
+ return swigfaissJNI.PCAMatrix_random_rotation_get(swigCPtr, this);
+ }
+
+ public void setMax_points_per_d(long value) {
+ swigfaissJNI.PCAMatrix_max_points_per_d_set(swigCPtr, this, value);
+ }
+
+ public long getMax_points_per_d() {
+ return swigfaissJNI.PCAMatrix_max_points_per_d_get(swigCPtr, this);
+ }
+
+ public void setBalanced_bins(int value) {
+ swigfaissJNI.PCAMatrix_balanced_bins_set(swigCPtr, this, value);
+ }
+
+ public int getBalanced_bins() {
+ return swigfaissJNI.PCAMatrix_balanced_bins_get(swigCPtr, this);
+ }
+
+ public void setMean(FloatVector value) {
+ swigfaissJNI.PCAMatrix_mean_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getMean() {
+ long cPtr = swigfaissJNI.PCAMatrix_mean_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setEigenvalues(FloatVector value) {
+ swigfaissJNI.PCAMatrix_eigenvalues_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getEigenvalues() {
+ long cPtr = swigfaissJNI.PCAMatrix_eigenvalues_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setPCAMat(FloatVector value) {
+ swigfaissJNI.PCAMatrix_PCAMat_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getPCAMat() {
+ long cPtr = swigfaissJNI.PCAMatrix_PCAMat_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public PCAMatrix(int d_in, int d_out, float eigen_power, boolean random_rotation) {
+ this(swigfaissJNI.new_PCAMatrix__SWIG_0(d_in, d_out, eigen_power, random_rotation), true);
+ }
+
+ public PCAMatrix(int d_in, int d_out, float eigen_power) {
+ this(swigfaissJNI.new_PCAMatrix__SWIG_1(d_in, d_out, eigen_power), true);
+ }
+
+ public PCAMatrix(int d_in, int d_out) {
+ this(swigfaissJNI.new_PCAMatrix__SWIG_2(d_in, d_out), true);
+ }
+
+ public PCAMatrix(int d_in) {
+ this(swigfaissJNI.new_PCAMatrix__SWIG_3(d_in), true);
+ }
+
+ public PCAMatrix() {
+ this(swigfaissJNI.new_PCAMatrix__SWIG_4(), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.PCAMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void copy_from(PCAMatrix other) {
+ swigfaissJNI.PCAMatrix_copy_from(swigCPtr, this, PCAMatrix.getCPtr(other), other);
+ }
+
+ public void prepare_Ab() {
+ swigfaissJNI.PCAMatrix_prepare_Ab(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder16.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder16.java
new file mode 100644
index 000000000..f40c70814
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder16.java
@@ -0,0 +1,57 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQDecoder16 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQDecoder16(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQDecoder16 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQDecoder16(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_uint16_t value) {
+ swigfaissJNI.PQDecoder16_code_set(swigCPtr, this, SWIGTYPE_p_uint16_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_uint16_t getCode() {
+ long cPtr = swigfaissJNI.PQDecoder16_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
+ }
+
+ public PQDecoder16(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQDecoder16(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public long decode() {
+ return swigfaissJNI.PQDecoder16_decode(swigCPtr, this);
+ }
+
+ public final static int nbits = swigfaissJNI.PQDecoder16_nbits_get();
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder8.java
new file mode 100644
index 000000000..ee384cdaf
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoder8.java
@@ -0,0 +1,57 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQDecoder8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQDecoder8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQDecoder8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQDecoder8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.PQDecoder8_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.PQDecoder8_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public PQDecoder8(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQDecoder8(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public long decode() {
+ return swigfaissJNI.PQDecoder8_decode(swigCPtr, this);
+ }
+
+ public final static int nbits = swigfaissJNI.PQDecoder8_nbits_get();
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoderGeneric.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoderGeneric.java
new file mode 100644
index 000000000..487b48a0f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQDecoderGeneric.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQDecoderGeneric {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQDecoderGeneric(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQDecoderGeneric obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQDecoderGeneric(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.PQDecoderGeneric_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.PQDecoderGeneric_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setOffset(short value) {
+ swigfaissJNI.PQDecoderGeneric_offset_set(swigCPtr, this, value);
+ }
+
+ public short getOffset() {
+ return swigfaissJNI.PQDecoderGeneric_offset_get(swigCPtr, this);
+ }
+
+ public int getNbits() {
+ return swigfaissJNI.PQDecoderGeneric_nbits_get(swigCPtr, this);
+ }
+
+ public long getMask() {
+ return swigfaissJNI.PQDecoderGeneric_mask_get(swigCPtr, this);
+ }
+
+ public void setReg(short value) {
+ swigfaissJNI.PQDecoderGeneric_reg_set(swigCPtr, this, value);
+ }
+
+ public short getReg() {
+ return swigfaissJNI.PQDecoderGeneric_reg_get(swigCPtr, this);
+ }
+
+ public PQDecoderGeneric(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQDecoderGeneric(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public long decode() {
+ return swigfaissJNI.PQDecoderGeneric_decode(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder16.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder16.java
new file mode 100644
index 000000000..56727e772
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder16.java
@@ -0,0 +1,56 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQEncoder16 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQEncoder16(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQEncoder16 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQEncoder16(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_uint16_t value) {
+ swigfaissJNI.PQEncoder16_code_set(swigCPtr, this, SWIGTYPE_p_uint16_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_uint16_t getCode() {
+ long cPtr = swigfaissJNI.PQEncoder16_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
+ }
+
+ public PQEncoder16(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQEncoder16(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public void encode(long x) {
+ swigfaissJNI.PQEncoder16_encode(swigCPtr, this, x);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder8.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder8.java
new file mode 100644
index 000000000..fdb0fac47
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoder8.java
@@ -0,0 +1,56 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQEncoder8 {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQEncoder8(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQEncoder8 obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQEncoder8(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.PQEncoder8_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.PQEncoder8_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public PQEncoder8(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQEncoder8(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public void encode(long x) {
+ swigfaissJNI.PQEncoder8_encode(swigCPtr, this, x);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoderGeneric.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoderGeneric.java
new file mode 100644
index 000000000..682f526cf
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PQEncoderGeneric.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PQEncoderGeneric {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PQEncoderGeneric(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PQEncoderGeneric obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PQEncoderGeneric(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setCode(SWIGTYPE_p_unsigned_char value) {
+ swigfaissJNI.PQEncoderGeneric_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_char getCode() {
+ long cPtr = swigfaissJNI.PQEncoderGeneric_code_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void setOffset(short value) {
+ swigfaissJNI.PQEncoderGeneric_offset_set(swigCPtr, this, value);
+ }
+
+ public short getOffset() {
+ return swigfaissJNI.PQEncoderGeneric_offset_get(swigCPtr, this);
+ }
+
+ public int getNbits() {
+ return swigfaissJNI.PQEncoderGeneric_nbits_get(swigCPtr, this);
+ }
+
+ public void setReg(short value) {
+ swigfaissJNI.PQEncoderGeneric_reg_set(swigCPtr, this, value);
+ }
+
+ public short getReg() {
+ return swigfaissJNI.PQEncoderGeneric_reg_get(swigCPtr, this);
+ }
+
+ public PQEncoderGeneric(SWIGTYPE_p_unsigned_char code, int nbits, short offset) {
+ this(swigfaissJNI.new_PQEncoderGeneric__SWIG_0(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits, offset), true);
+ }
+
+ public PQEncoderGeneric(SWIGTYPE_p_unsigned_char code, int nbits) {
+ this(swigfaissJNI.new_PQEncoderGeneric__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
+ }
+
+ public void encode(long x) {
+ swigfaissJNI.PQEncoderGeneric_encode(swigCPtr, this, x);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterRange.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterRange.java
new file mode 100644
index 000000000..4f6643dae
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterRange.java
@@ -0,0 +1,60 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ParameterRange {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ParameterRange(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ParameterRange obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ParameterRange(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setName(String value) {
+ swigfaissJNI.ParameterRange_name_set(swigCPtr, this, value);
+ }
+
+ public String getName() {
+ return swigfaissJNI.ParameterRange_name_get(swigCPtr, this);
+ }
+
+ public void setValues(DoubleVector value) {
+ swigfaissJNI.ParameterRange_values_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
+ }
+
+ public DoubleVector getValues() {
+ long cPtr = swigfaissJNI.ParameterRange_values_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
+ }
+
+ public ParameterRange() {
+ this(swigfaissJNI.new_ParameterRange(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterSpace.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterSpace.java
new file mode 100644
index 000000000..210509c38
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ParameterSpace.java
@@ -0,0 +1,136 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ParameterSpace {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ParameterSpace(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ParameterSpace obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ParameterSpace(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setParameter_ranges(SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t value) {
+ swigfaissJNI.ParameterSpace_parameter_ranges_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t getParameter_ranges() {
+ long cPtr = swigfaissJNI.ParameterSpace_parameter_ranges_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t(cPtr, false);
+ }
+
+ public void setVerbose(int value) {
+ swigfaissJNI.ParameterSpace_verbose_set(swigCPtr, this, value);
+ }
+
+ public int getVerbose() {
+ return swigfaissJNI.ParameterSpace_verbose_get(swigCPtr, this);
+ }
+
+ public void setN_experiments(int value) {
+ swigfaissJNI.ParameterSpace_n_experiments_set(swigCPtr, this, value);
+ }
+
+ public int getN_experiments() {
+ return swigfaissJNI.ParameterSpace_n_experiments_get(swigCPtr, this);
+ }
+
+ public void setBatchsize(long value) {
+ swigfaissJNI.ParameterSpace_batchsize_set(swigCPtr, this, value);
+ }
+
+ public long getBatchsize() {
+ return swigfaissJNI.ParameterSpace_batchsize_get(swigCPtr, this);
+ }
+
+ public void setThread_over_batches(boolean value) {
+ swigfaissJNI.ParameterSpace_thread_over_batches_set(swigCPtr, this, value);
+ }
+
+ public boolean getThread_over_batches() {
+ return swigfaissJNI.ParameterSpace_thread_over_batches_get(swigCPtr, this);
+ }
+
+ public void setMin_test_duration(double value) {
+ swigfaissJNI.ParameterSpace_min_test_duration_set(swigCPtr, this, value);
+ }
+
+ public double getMin_test_duration() {
+ return swigfaissJNI.ParameterSpace_min_test_duration_get(swigCPtr, this);
+ }
+
+ public ParameterSpace() {
+ this(swigfaissJNI.new_ParameterSpace(), true);
+ }
+
+ public long n_combinations() {
+ return swigfaissJNI.ParameterSpace_n_combinations(swigCPtr, this);
+ }
+
+ public boolean combination_ge(long c1, long c2) {
+ return swigfaissJNI.ParameterSpace_combination_ge(swigCPtr, this, c1, c2);
+ }
+
+ public String combination_name(long cno) {
+ return swigfaissJNI.ParameterSpace_combination_name(swigCPtr, this, cno);
+ }
+
+ public void display() {
+ swigfaissJNI.ParameterSpace_display(swigCPtr, this);
+ }
+
+ public ParameterRange add_range(String name) {
+ return new ParameterRange(swigfaissJNI.ParameterSpace_add_range(swigCPtr, this, name), false);
+ }
+
+ public void initialize(Index index) {
+ swigfaissJNI.ParameterSpace_initialize(swigCPtr, this, Index.getCPtr(index), index);
+ }
+
+ public void set_index_parameters(Index index, long cno) {
+ swigfaissJNI.ParameterSpace_set_index_parameters__SWIG_0(swigCPtr, this, Index.getCPtr(index), index, cno);
+ }
+
+ public void set_index_parameters(Index index, String param_string) {
+ swigfaissJNI.ParameterSpace_set_index_parameters__SWIG_1(swigCPtr, this, Index.getCPtr(index), index, param_string);
+ }
+
+ public void set_index_parameter(Index index, String name, double val) {
+ swigfaissJNI.ParameterSpace_set_index_parameter(swigCPtr, this, Index.getCPtr(index), index, name, val);
+ }
+
+ public void update_bounds(long cno, OperatingPoint op, SWIGTYPE_p_double upper_bound_perf, SWIGTYPE_p_double lower_bound_t) {
+ swigfaissJNI.ParameterSpace_update_bounds(swigCPtr, this, cno, OperatingPoint.getCPtr(op), op, SWIGTYPE_p_double.getCPtr(upper_bound_perf), SWIGTYPE_p_double.getCPtr(lower_bound_t));
+ }
+
+ public void explore(Index index, long nq, SWIGTYPE_p_float xq, AutoTuneCriterion crit, OperatingPoints ops) {
+ swigfaissJNI.ParameterSpace_explore(swigCPtr, this, Index.getCPtr(index), index, nq, SWIGTYPE_p_float.getCPtr(xq), AutoTuneCriterion.getCPtr(crit), crit, OperatingPoints.getCPtr(ops), ops);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PartitionStats.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PartitionStats.java
new file mode 100644
index 000000000..ea9038771
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PartitionStats.java
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PartitionStats {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PartitionStats(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PartitionStats obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PartitionStats(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setBissect_cycles(long value) {
+ swigfaissJNI.PartitionStats_bissect_cycles_set(swigCPtr, this, value);
+ }
+
+ public long getBissect_cycles() {
+ return swigfaissJNI.PartitionStats_bissect_cycles_get(swigCPtr, this);
+ }
+
+ public void setCompress_cycles(long value) {
+ swigfaissJNI.PartitionStats_compress_cycles_set(swigCPtr, this, value);
+ }
+
+ public long getCompress_cycles() {
+ return swigfaissJNI.PartitionStats_compress_cycles_get(swigCPtr, this);
+ }
+
+ public PartitionStats() {
+ this(swigfaissJNI.new_PartitionStats(), true);
+ }
+
+ public void reset() {
+ swigfaissJNI.PartitionStats_reset(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PermutationObjective.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PermutationObjective.java
new file mode 100644
index 000000000..5a6d0b54c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PermutationObjective.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PermutationObjective {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected PermutationObjective(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PermutationObjective obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PermutationObjective(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.PermutationObjective_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.PermutationObjective_n_get(swigCPtr, this);
+ }
+
+ public double compute_cost(SWIGTYPE_p_int perm) {
+ return swigfaissJNI.PermutationObjective_compute_cost(swigCPtr, this, SWIGTYPE_p_int.getCPtr(perm));
+ }
+
+ public double cost_update(SWIGTYPE_p_int perm, int iw, int jw) {
+ return swigfaissJNI.PermutationObjective_cost_update(swigCPtr, this, SWIGTYPE_p_int.getCPtr(perm), iw, jw);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/PolysemousTraining.java b/ann/src/main/java/com/twitter/ann/faiss/swig/PolysemousTraining.java
new file mode 100644
index 000000000..d65dcfeb8
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/PolysemousTraining.java
@@ -0,0 +1,144 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class PolysemousTraining extends SimulatedAnnealingParameters {
+ private transient long swigCPtr;
+
+ protected PolysemousTraining(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.PolysemousTraining_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(PolysemousTraining obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_PolysemousTraining(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setOptimization_type(PolysemousTraining.Optimization_type_t value) {
+ swigfaissJNI.PolysemousTraining_optimization_type_set(swigCPtr, this, value.swigValue());
+ }
+
+ public PolysemousTraining.Optimization_type_t getOptimization_type() {
+ return PolysemousTraining.Optimization_type_t.swigToEnum(swigfaissJNI.PolysemousTraining_optimization_type_get(swigCPtr, this));
+ }
+
+ public void setNtrain_permutation(int value) {
+ swigfaissJNI.PolysemousTraining_ntrain_permutation_set(swigCPtr, this, value);
+ }
+
+ public int getNtrain_permutation() {
+ return swigfaissJNI.PolysemousTraining_ntrain_permutation_get(swigCPtr, this);
+ }
+
+ public void setDis_weight_factor(double value) {
+ swigfaissJNI.PolysemousTraining_dis_weight_factor_set(swigCPtr, this, value);
+ }
+
+ public double getDis_weight_factor() {
+ return swigfaissJNI.PolysemousTraining_dis_weight_factor_get(swigCPtr, this);
+ }
+
+ public void setMax_memory(long value) {
+ swigfaissJNI.PolysemousTraining_max_memory_set(swigCPtr, this, value);
+ }
+
+ public long getMax_memory() {
+ return swigfaissJNI.PolysemousTraining_max_memory_get(swigCPtr, this);
+ }
+
+ public void setLog_pattern(String value) {
+ swigfaissJNI.PolysemousTraining_log_pattern_set(swigCPtr, this, value);
+ }
+
+ public String getLog_pattern() {
+ return swigfaissJNI.PolysemousTraining_log_pattern_get(swigCPtr, this);
+ }
+
+ public PolysemousTraining() {
+ this(swigfaissJNI.new_PolysemousTraining(), true);
+ }
+
+ public void optimize_pq_for_hamming(ProductQuantizer pq, long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.PolysemousTraining_optimize_pq_for_hamming(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void optimize_ranking(ProductQuantizer pq, long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.PolysemousTraining_optimize_ranking(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void optimize_reproduce_distances(ProductQuantizer pq) {
+ swigfaissJNI.PolysemousTraining_optimize_reproduce_distances(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq);
+ }
+
+ public long memory_usage_per_thread(ProductQuantizer pq) {
+ return swigfaissJNI.PolysemousTraining_memory_usage_per_thread(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq);
+ }
+
+ public final static class Optimization_type_t {
+ public final static PolysemousTraining.Optimization_type_t OT_None = new PolysemousTraining.Optimization_type_t("OT_None");
+ public final static PolysemousTraining.Optimization_type_t OT_ReproduceDistances_affine = new PolysemousTraining.Optimization_type_t("OT_ReproduceDistances_affine");
+ public final static PolysemousTraining.Optimization_type_t OT_Ranking_weighted_diff = new PolysemousTraining.Optimization_type_t("OT_Ranking_weighted_diff");
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public String toString() {
+ return swigName;
+ }
+
+ public static Optimization_type_t swigToEnum(int swigValue) {
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (int i = 0; i < swigValues.length; i++)
+ if (swigValues[i].swigValue == swigValue)
+ return swigValues[i];
+ throw new IllegalArgumentException("No enum " + Optimization_type_t.class + " with value " + swigValue);
+ }
+
+ private Optimization_type_t(String swigName) {
+ this.swigName = swigName;
+ this.swigValue = swigNext++;
+ }
+
+ private Optimization_type_t(String swigName, int swigValue) {
+ this.swigName = swigName;
+ this.swigValue = swigValue;
+ swigNext = swigValue+1;
+ }
+
+ private Optimization_type_t(String swigName, Optimization_type_t swigEnum) {
+ this.swigName = swigName;
+ this.swigValue = swigEnum.swigValue;
+ swigNext = this.swigValue+1;
+ }
+
+ private static Optimization_type_t[] swigValues = { OT_None, OT_ReproduceDistances_affine, OT_Ranking_weighted_diff };
+ private static int swigNext = 0;
+ private final int swigValue;
+ private final String swigName;
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ProductQuantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ProductQuantizer.java
new file mode 100644
index 000000000..0249e29e3
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ProductQuantizer.java
@@ -0,0 +1,279 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ProductQuantizer {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ProductQuantizer(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ProductQuantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ProductQuantizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD(long value) {
+ swigfaissJNI.ProductQuantizer_d_set(swigCPtr, this, value);
+ }
+
+ public long getD() {
+ return swigfaissJNI.ProductQuantizer_d_get(swigCPtr, this);
+ }
+
+ public void setM(long value) {
+ swigfaissJNI.ProductQuantizer_M_set(swigCPtr, this, value);
+ }
+
+ public long getM() {
+ return swigfaissJNI.ProductQuantizer_M_get(swigCPtr, this);
+ }
+
+ public void setNbits(long value) {
+ swigfaissJNI.ProductQuantizer_nbits_set(swigCPtr, this, value);
+ }
+
+ public long getNbits() {
+ return swigfaissJNI.ProductQuantizer_nbits_get(swigCPtr, this);
+ }
+
+ public void setDsub(long value) {
+ swigfaissJNI.ProductQuantizer_dsub_set(swigCPtr, this, value);
+ }
+
+ public long getDsub() {
+ return swigfaissJNI.ProductQuantizer_dsub_get(swigCPtr, this);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.ProductQuantizer_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.ProductQuantizer_code_size_get(swigCPtr, this);
+ }
+
+ public void setKsub(long value) {
+ swigfaissJNI.ProductQuantizer_ksub_set(swigCPtr, this, value);
+ }
+
+ public long getKsub() {
+ return swigfaissJNI.ProductQuantizer_ksub_get(swigCPtr, this);
+ }
+
+ public void setVerbose(boolean value) {
+ swigfaissJNI.ProductQuantizer_verbose_set(swigCPtr, this, value);
+ }
+
+ public boolean getVerbose() {
+ return swigfaissJNI.ProductQuantizer_verbose_get(swigCPtr, this);
+ }
+
+ public void setTrain_type(ProductQuantizer.train_type_t value) {
+ swigfaissJNI.ProductQuantizer_train_type_set(swigCPtr, this, value.swigValue());
+ }
+
+ public ProductQuantizer.train_type_t getTrain_type() {
+ return ProductQuantizer.train_type_t.swigToEnum(swigfaissJNI.ProductQuantizer_train_type_get(swigCPtr, this));
+ }
+
+ public void setCp(ClusteringParameters value) {
+ swigfaissJNI.ProductQuantizer_cp_set(swigCPtr, this, ClusteringParameters.getCPtr(value), value);
+ }
+
+ public ClusteringParameters getCp() {
+ long cPtr = swigfaissJNI.ProductQuantizer_cp_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ClusteringParameters(cPtr, false);
+ }
+
+ public void setAssign_index(Index value) {
+ swigfaissJNI.ProductQuantizer_assign_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getAssign_index() {
+ long cPtr = swigfaissJNI.ProductQuantizer_assign_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setCentroids(FloatVector value) {
+ swigfaissJNI.ProductQuantizer_centroids_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getCentroids() {
+ long cPtr = swigfaissJNI.ProductQuantizer_centroids_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public SWIGTYPE_p_float get_centroids(long m, long i) {
+ long cPtr = swigfaissJNI.ProductQuantizer_get_centroids(swigCPtr, this, m, i);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public void train(int n, SWIGTYPE_p_float x) {
+ swigfaissJNI.ProductQuantizer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public ProductQuantizer(long d, long M, long nbits) {
+ this(swigfaissJNI.new_ProductQuantizer__SWIG_0(d, M, nbits), true);
+ }
+
+ public ProductQuantizer() {
+ this(swigfaissJNI.new_ProductQuantizer__SWIG_1(), true);
+ }
+
+ public void set_derived_values() {
+ swigfaissJNI.ProductQuantizer_set_derived_values(swigCPtr, this);
+ }
+
+ public void set_params(SWIGTYPE_p_float centroids, int m) {
+ swigfaissJNI.ProductQuantizer_set_params(swigCPtr, this, SWIGTYPE_p_float.getCPtr(centroids), m);
+ }
+
+ public void compute_code(SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.ProductQuantizer_compute_code(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void compute_codes(SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes, long n) {
+ swigfaissJNI.ProductQuantizer_compute_codes(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes), n);
+ }
+
+ public void compute_codes_with_assign_index(SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes, long n) {
+ swigfaissJNI.ProductQuantizer_compute_codes_with_assign_index(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes), n);
+ }
+
+ public void decode(SWIGTYPE_p_unsigned_char code, SWIGTYPE_p_float x) {
+ swigfaissJNI.ProductQuantizer_decode__SWIG_0(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(code), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void decode(SWIGTYPE_p_unsigned_char code, SWIGTYPE_p_float x, long n) {
+ swigfaissJNI.ProductQuantizer_decode__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(code), SWIGTYPE_p_float.getCPtr(x), n);
+ }
+
+ public void compute_code_from_distance_table(SWIGTYPE_p_float tab, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.ProductQuantizer_compute_code_from_distance_table(swigCPtr, this, SWIGTYPE_p_float.getCPtr(tab), SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void compute_distance_table(SWIGTYPE_p_float x, SWIGTYPE_p_float dis_table) {
+ swigfaissJNI.ProductQuantizer_compute_distance_table(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(dis_table));
+ }
+
+ public void compute_inner_prod_table(SWIGTYPE_p_float x, SWIGTYPE_p_float dis_table) {
+ swigfaissJNI.ProductQuantizer_compute_inner_prod_table(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(dis_table));
+ }
+
+ public void compute_distance_tables(long nx, SWIGTYPE_p_float x, SWIGTYPE_p_float dis_tables) {
+ swigfaissJNI.ProductQuantizer_compute_distance_tables(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(dis_tables));
+ }
+
+ public void compute_inner_prod_tables(long nx, SWIGTYPE_p_float x, SWIGTYPE_p_float dis_tables) {
+ swigfaissJNI.ProductQuantizer_compute_inner_prod_tables(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(dis_tables));
+ }
+
+ public void search(SWIGTYPE_p_float x, long nx, SWIGTYPE_p_unsigned_char codes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t res, boolean init_finalize_heap) {
+ swigfaissJNI.ProductQuantizer_search__SWIG_0(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), nx, SWIGTYPE_p_unsigned_char.getCPtr(codes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.getCPtr(res), init_finalize_heap);
+ }
+
+ public void search(SWIGTYPE_p_float x, long nx, SWIGTYPE_p_unsigned_char codes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t res) {
+ swigfaissJNI.ProductQuantizer_search__SWIG_1(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), nx, SWIGTYPE_p_unsigned_char.getCPtr(codes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.getCPtr(res));
+ }
+
+ public void search_ip(SWIGTYPE_p_float x, long nx, SWIGTYPE_p_unsigned_char codes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t res, boolean init_finalize_heap) {
+ swigfaissJNI.ProductQuantizer_search_ip__SWIG_0(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), nx, SWIGTYPE_p_unsigned_char.getCPtr(codes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t.getCPtr(res), init_finalize_heap);
+ }
+
+ public void search_ip(SWIGTYPE_p_float x, long nx, SWIGTYPE_p_unsigned_char codes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t res) {
+ swigfaissJNI.ProductQuantizer_search_ip__SWIG_1(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), nx, SWIGTYPE_p_unsigned_char.getCPtr(codes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t.getCPtr(res));
+ }
+
+ public void setSdc_table(FloatVector value) {
+ swigfaissJNI.ProductQuantizer_sdc_table_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getSdc_table() {
+ long cPtr = swigfaissJNI.ProductQuantizer_sdc_table_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void compute_sdc_table() {
+ swigfaissJNI.ProductQuantizer_compute_sdc_table(swigCPtr, this);
+ }
+
+ public void search_sdc(SWIGTYPE_p_unsigned_char qcodes, long nq, SWIGTYPE_p_unsigned_char bcodes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t res, boolean init_finalize_heap) {
+ swigfaissJNI.ProductQuantizer_search_sdc__SWIG_0(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(qcodes), nq, SWIGTYPE_p_unsigned_char.getCPtr(bcodes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.getCPtr(res), init_finalize_heap);
+ }
+
+ public void search_sdc(SWIGTYPE_p_unsigned_char qcodes, long nq, SWIGTYPE_p_unsigned_char bcodes, long ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t res) {
+ swigfaissJNI.ProductQuantizer_search_sdc__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(qcodes), nq, SWIGTYPE_p_unsigned_char.getCPtr(bcodes), ncodes, SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.getCPtr(res));
+ }
+
+ public final static class train_type_t {
+ public final static ProductQuantizer.train_type_t Train_default = new ProductQuantizer.train_type_t("Train_default");
+ public final static ProductQuantizer.train_type_t Train_hot_start = new ProductQuantizer.train_type_t("Train_hot_start");
+ public final static ProductQuantizer.train_type_t Train_shared = new ProductQuantizer.train_type_t("Train_shared");
+ public final static ProductQuantizer.train_type_t Train_hypercube = new ProductQuantizer.train_type_t("Train_hypercube");
+ public final static ProductQuantizer.train_type_t Train_hypercube_pca = new ProductQuantizer.train_type_t("Train_hypercube_pca");
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public String toString() {
+ return swigName;
+ }
+
+ public static train_type_t swigToEnum(int swigValue) {
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (int i = 0; i < swigValues.length; i++)
+ if (swigValues[i].swigValue == swigValue)
+ return swigValues[i];
+ throw new IllegalArgumentException("No enum " + train_type_t.class + " with value " + swigValue);
+ }
+
+ private train_type_t(String swigName) {
+ this.swigName = swigName;
+ this.swigValue = swigNext++;
+ }
+
+ private train_type_t(String swigName, int swigValue) {
+ this.swigName = swigName;
+ this.swigValue = swigValue;
+ swigNext = swigValue+1;
+ }
+
+ private train_type_t(String swigName, train_type_t swigEnum) {
+ this.swigName = swigName;
+ this.swigValue = swigEnum.swigValue;
+ swigNext = this.swigValue+1;
+ }
+
+ private static train_type_t[] swigValues = { Train_default, Train_hot_start, Train_shared, Train_hypercube, Train_hypercube_pca };
+ private static int swigNext = 0;
+ private final int swigValue;
+ private final String swigName;
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClustering.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClustering.java
new file mode 100644
index 000000000..2fbd8e406
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClustering.java
@@ -0,0 +1,85 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ProgressiveDimClustering extends ProgressiveDimClusteringParameters {
+ private transient long swigCPtr;
+
+ protected ProgressiveDimClustering(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ProgressiveDimClustering_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ProgressiveDimClustering obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ProgressiveDimClustering(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setD(long value) {
+ swigfaissJNI.ProgressiveDimClustering_d_set(swigCPtr, this, value);
+ }
+
+ public long getD() {
+ return swigfaissJNI.ProgressiveDimClustering_d_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.ProgressiveDimClustering_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.ProgressiveDimClustering_k_get(swigCPtr, this);
+ }
+
+ public void setCentroids(FloatVector value) {
+ swigfaissJNI.ProgressiveDimClustering_centroids_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getCentroids() {
+ long cPtr = swigfaissJNI.ProgressiveDimClustering_centroids_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setIteration_stats(SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t value) {
+ swigfaissJNI.ProgressiveDimClustering_iteration_stats_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t getIteration_stats() {
+ long cPtr = swigfaissJNI.ProgressiveDimClustering_iteration_stats_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t(cPtr, false);
+ }
+
+ public ProgressiveDimClustering(int d, int k) {
+ this(swigfaissJNI.new_ProgressiveDimClustering__SWIG_0(d, k), true);
+ }
+
+ public ProgressiveDimClustering(int d, int k, ProgressiveDimClusteringParameters cp) {
+ this(swigfaissJNI.new_ProgressiveDimClustering__SWIG_1(d, k, ProgressiveDimClusteringParameters.getCPtr(cp), cp), true);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x, ProgressiveDimIndexFactory factory) {
+ swigfaissJNI.ProgressiveDimClustering_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), ProgressiveDimIndexFactory.getCPtr(factory), factory);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClusteringParameters.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClusteringParameters.java
new file mode 100644
index 000000000..927c92c18
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimClusteringParameters.java
@@ -0,0 +1,59 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ProgressiveDimClusteringParameters extends ClusteringParameters {
+ private transient long swigCPtr;
+
+ protected ProgressiveDimClusteringParameters(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ProgressiveDimClusteringParameters_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ProgressiveDimClusteringParameters obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ProgressiveDimClusteringParameters(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setProgressive_dim_steps(int value) {
+ swigfaissJNI.ProgressiveDimClusteringParameters_progressive_dim_steps_set(swigCPtr, this, value);
+ }
+
+ public int getProgressive_dim_steps() {
+ return swigfaissJNI.ProgressiveDimClusteringParameters_progressive_dim_steps_get(swigCPtr, this);
+ }
+
+ public void setApply_pca(boolean value) {
+ swigfaissJNI.ProgressiveDimClusteringParameters_apply_pca_set(swigCPtr, this, value);
+ }
+
+ public boolean getApply_pca() {
+ return swigfaissJNI.ProgressiveDimClusteringParameters_apply_pca_get(swigCPtr, this);
+ }
+
+ public ProgressiveDimClusteringParameters() {
+ this(swigfaissJNI.new_ProgressiveDimClusteringParameters(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimIndexFactory.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimIndexFactory.java
new file mode 100644
index 000000000..d01483ca9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ProgressiveDimIndexFactory.java
@@ -0,0 +1,43 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ProgressiveDimIndexFactory {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ProgressiveDimIndexFactory(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ProgressiveDimIndexFactory obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ProgressiveDimIndexFactory(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public ProgressiveDimIndexFactory() {
+ this(swigfaissJNI.new_ProgressiveDimIndexFactory(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/RandomRotationMatrix.java b/ann/src/main/java/com/twitter/ann/faiss/swig/RandomRotationMatrix.java
new file mode 100644
index 000000000..104487d46
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/RandomRotationMatrix.java
@@ -0,0 +1,55 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class RandomRotationMatrix extends LinearTransform {
+ private transient long swigCPtr;
+
+ protected RandomRotationMatrix(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.RandomRotationMatrix_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(RandomRotationMatrix obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_RandomRotationMatrix(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public RandomRotationMatrix(int d_in, int d_out) {
+ this(swigfaissJNI.new_RandomRotationMatrix__SWIG_0(d_in, d_out), true);
+ }
+
+ public void init(int seed) {
+ swigfaissJNI.RandomRotationMatrix_init(swigCPtr, this, seed);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.RandomRotationMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public RandomRotationMatrix() {
+ this(swigfaissJNI.new_RandomRotationMatrix__SWIG_1(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/RangeQueryResult.java b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeQueryResult.java
new file mode 100644
index 000000000..83fb5e284
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeQueryResult.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class RangeQueryResult {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected RangeQueryResult(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(RangeQueryResult obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_RangeQueryResult(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setQno(long value) {
+ swigfaissJNI.RangeQueryResult_qno_set(swigCPtr, this, value);
+ }
+
+ public long getQno() {
+ return swigfaissJNI.RangeQueryResult_qno_get(swigCPtr, this);
+}
+
+ public void setNres(long value) {
+ swigfaissJNI.RangeQueryResult_nres_set(swigCPtr, this, value);
+ }
+
+ public long getNres() {
+ return swigfaissJNI.RangeQueryResult_nres_get(swigCPtr, this);
+ }
+
+ public void setPres(RangeSearchPartialResult value) {
+ swigfaissJNI.RangeQueryResult_pres_set(swigCPtr, this, RangeSearchPartialResult.getCPtr(value), value);
+ }
+
+ public RangeSearchPartialResult getPres() {
+ long cPtr = swigfaissJNI.RangeQueryResult_pres_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new RangeSearchPartialResult(cPtr, false);
+ }
+
+ public void add(float dis, long id) {
+ swigfaissJNI.RangeQueryResult_add(swigCPtr, this, dis, id);
+ }
+
+ public RangeQueryResult() {
+ this(swigfaissJNI.new_RangeQueryResult(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchPartialResult.java b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchPartialResult.java
new file mode 100644
index 000000000..b7348762a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchPartialResult.java
@@ -0,0 +1,81 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class RangeSearchPartialResult extends BufferList {
+ private transient long swigCPtr;
+
+ protected RangeSearchPartialResult(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.RangeSearchPartialResult_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(RangeSearchPartialResult obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_RangeSearchPartialResult(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setRes(RangeSearchResult value) {
+ swigfaissJNI.RangeSearchPartialResult_res_set(swigCPtr, this, RangeSearchResult.getCPtr(value), value);
+ }
+
+ public RangeSearchResult getRes() {
+ long cPtr = swigfaissJNI.RangeSearchPartialResult_res_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new RangeSearchResult(cPtr, false);
+ }
+
+ public void setQueries(SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t value) {
+ swigfaissJNI.RangeSearchPartialResult_queries_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t getQueries() {
+ long cPtr = swigfaissJNI.RangeSearchPartialResult_queries_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t(cPtr, false);
+ }
+
+ public RangeQueryResult new_result(long qno) {
+ return new RangeQueryResult(swigfaissJNI.RangeSearchPartialResult_new_result(swigCPtr, this, qno), false);
+ }
+
+ public void set_lims() {
+ swigfaissJNI.RangeSearchPartialResult_set_lims(swigCPtr, this);
+ }
+
+ public void copy_result(boolean incremental) {
+ swigfaissJNI.RangeSearchPartialResult_copy_result__SWIG_0(swigCPtr, this, incremental);
+ }
+
+ public void copy_result() {
+ swigfaissJNI.RangeSearchPartialResult_copy_result__SWIG_1(swigCPtr, this);
+ }
+
+ public static void merge(SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t partial_results, boolean do_delete) {
+ swigfaissJNI.RangeSearchPartialResult_merge__SWIG_0(SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t.getCPtr(partial_results), do_delete);
+ }
+
+ public static void merge(SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t partial_results) {
+ swigfaissJNI.RangeSearchPartialResult_merge__SWIG_1(SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t.getCPtr(partial_results));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchResult.java b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchResult.java
new file mode 100644
index 000000000..0779b6d70
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/RangeSearchResult.java
@@ -0,0 +1,85 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class RangeSearchResult {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected RangeSearchResult(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(RangeSearchResult obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_RangeSearchResult(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNq(long value) {
+ swigfaissJNI.RangeSearchResult_nq_set(swigCPtr, this, value);
+ }
+
+ public long getNq() {
+ return swigfaissJNI.RangeSearchResult_nq_get(swigCPtr, this);
+ }
+
+ public void setLims(SWIGTYPE_p_unsigned_long value) {
+ swigfaissJNI.RangeSearchResult_lims_set(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_unsigned_long getLims() {
+ long cPtr = swigfaissJNI.RangeSearchResult_lims_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
+ }
+
+ public void setLabels(LongVector value) {
+ swigfaissJNI.RangeSearchResult_labels_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getLabels() {
+ return new LongVector(swigfaissJNI.RangeSearchResult_labels_get(swigCPtr, this), false);
+}
+
+ public void setDistances(SWIGTYPE_p_float value) {
+ swigfaissJNI.RangeSearchResult_distances_set(swigCPtr, this, SWIGTYPE_p_float.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_float getDistances() {
+ long cPtr = swigfaissJNI.RangeSearchResult_distances_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public void setBuffer_size(long value) {
+ swigfaissJNI.RangeSearchResult_buffer_size_set(swigCPtr, this, value);
+ }
+
+ public long getBuffer_size() {
+ return swigfaissJNI.RangeSearchResult_buffer_size_get(swigCPtr, this);
+ }
+
+ public void do_allocation() {
+ swigfaissJNI.RangeSearchResult_do_allocation(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ReadOnlyInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ReadOnlyInvertedLists.java
new file mode 100644
index 000000000..8e85a70bc
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ReadOnlyInvertedLists.java
@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ReadOnlyInvertedLists extends InvertedLists {
+ private transient long swigCPtr;
+
+ protected ReadOnlyInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ReadOnlyInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ReadOnlyInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ReadOnlyInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ return swigfaissJNI.ReadOnlyInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.ReadOnlyInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void resize(long list_no, long new_size) {
+ swigfaissJNI.ReadOnlyInvertedLists_resize(swigCPtr, this, list_no, new_size);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ReconstructFromNeighbors.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ReconstructFromNeighbors.java
new file mode 100644
index 000000000..31eaab625
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ReconstructFromNeighbors.java
@@ -0,0 +1,161 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ReconstructFromNeighbors {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected ReconstructFromNeighbors(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ReconstructFromNeighbors obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ReconstructFromNeighbors(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public IndexHNSW getIndex() {
+ return new IndexHNSW(swigfaissJNI.ReconstructFromNeighbors_index_get(swigCPtr, this), false);
+ }
+
+ public void setM(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_M_set(swigCPtr, this, value);
+ }
+
+ public long getM() {
+ return swigfaissJNI.ReconstructFromNeighbors_M_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.ReconstructFromNeighbors_k_get(swigCPtr, this);
+ }
+
+ public void setNsq(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_nsq_set(swigCPtr, this, value);
+ }
+
+ public long getNsq() {
+ return swigfaissJNI.ReconstructFromNeighbors_nsq_get(swigCPtr, this);
+ }
+
+ public void setCode_size(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_code_size_set(swigCPtr, this, value);
+ }
+
+ public long getCode_size() {
+ return swigfaissJNI.ReconstructFromNeighbors_code_size_get(swigCPtr, this);
+ }
+
+ public void setK_reorder(int value) {
+ swigfaissJNI.ReconstructFromNeighbors_k_reorder_set(swigCPtr, this, value);
+ }
+
+ public int getK_reorder() {
+ return swigfaissJNI.ReconstructFromNeighbors_k_reorder_get(swigCPtr, this);
+ }
+
+ public void setCodebook(FloatVector value) {
+ swigfaissJNI.ReconstructFromNeighbors_codebook_set(swigCPtr, this, FloatVector.getCPtr(value), value);
+ }
+
+ public FloatVector getCodebook() {
+ long cPtr = swigfaissJNI.ReconstructFromNeighbors_codebook_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new FloatVector(cPtr, false);
+ }
+
+ public void setCodes(ByteVector value) {
+ swigfaissJNI.ReconstructFromNeighbors_codes_set(swigCPtr, this, ByteVector.getCPtr(value), value);
+ }
+
+ public ByteVector getCodes() {
+ long cPtr = swigfaissJNI.ReconstructFromNeighbors_codes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVector(cPtr, false);
+ }
+
+ public void setNtotal(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_ntotal_set(swigCPtr, this, value);
+ }
+
+ public long getNtotal() {
+ return swigfaissJNI.ReconstructFromNeighbors_ntotal_get(swigCPtr, this);
+ }
+
+ public void setD(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_d_set(swigCPtr, this, value);
+ }
+
+ public long getD() {
+ return swigfaissJNI.ReconstructFromNeighbors_d_get(swigCPtr, this);
+ }
+
+ public void setDsub(long value) {
+ swigfaissJNI.ReconstructFromNeighbors_dsub_set(swigCPtr, this, value);
+ }
+
+ public long getDsub() {
+ return swigfaissJNI.ReconstructFromNeighbors_dsub_get(swigCPtr, this);
+ }
+
+ public ReconstructFromNeighbors(IndexHNSW index, long k, long nsq) {
+ this(swigfaissJNI.new_ReconstructFromNeighbors__SWIG_0(IndexHNSW.getCPtr(index), index, k, nsq), true);
+ }
+
+ public ReconstructFromNeighbors(IndexHNSW index, long k) {
+ this(swigfaissJNI.new_ReconstructFromNeighbors__SWIG_1(IndexHNSW.getCPtr(index), index, k), true);
+ }
+
+ public ReconstructFromNeighbors(IndexHNSW index) {
+ this(swigfaissJNI.new_ReconstructFromNeighbors__SWIG_2(IndexHNSW.getCPtr(index), index), true);
+ }
+
+ public void add_codes(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.ReconstructFromNeighbors_add_codes(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public long compute_distances(long n, LongVector shortlist, SWIGTYPE_p_float query, SWIGTYPE_p_float distances) {
+ return swigfaissJNI.ReconstructFromNeighbors_compute_distances(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(shortlist.data()), shortlist, SWIGTYPE_p_float.getCPtr(query), SWIGTYPE_p_float.getCPtr(distances));
+ }
+
+ public void estimate_code(SWIGTYPE_p_float x, int i, SWIGTYPE_p_unsigned_char code) {
+ swigfaissJNI.ReconstructFromNeighbors_estimate_code(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), i, SWIGTYPE_p_unsigned_char.getCPtr(code));
+ }
+
+ public void reconstruct(int i, SWIGTYPE_p_float x, SWIGTYPE_p_float tmp) {
+ swigfaissJNI.ReconstructFromNeighbors_reconstruct(swigCPtr, this, i, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(tmp));
+ }
+
+ public void reconstruct_n(int n0, int ni, SWIGTYPE_p_float x) {
+ swigfaissJNI.ReconstructFromNeighbors_reconstruct_n(swigCPtr, this, n0, ni, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public void get_neighbor_table(int i, SWIGTYPE_p_float out) {
+ swigfaissJNI.ReconstructFromNeighbors_get_neighbor_table(swigCPtr, this, i, SWIGTYPE_p_float.getCPtr(out));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/RemapDimensionsTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/RemapDimensionsTransform.java
new file mode 100644
index 000000000..3b1af9df9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/RemapDimensionsTransform.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class RemapDimensionsTransform extends VectorTransform {
+ private transient long swigCPtr;
+
+ protected RemapDimensionsTransform(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.RemapDimensionsTransform_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(RemapDimensionsTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_RemapDimensionsTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setMap(IntVector value) {
+ swigfaissJNI.RemapDimensionsTransform_map_set(swigCPtr, this, IntVector.getCPtr(value), value);
+ }
+
+ public IntVector getMap() {
+ long cPtr = swigfaissJNI.RemapDimensionsTransform_map_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new IntVector(cPtr, false);
+ }
+
+ public RemapDimensionsTransform(int d_in, int d_out, SWIGTYPE_p_int map) {
+ this(swigfaissJNI.new_RemapDimensionsTransform__SWIG_0(d_in, d_out, SWIGTYPE_p_int.getCPtr(map)), true);
+ }
+
+ public RemapDimensionsTransform(int d_in, int d_out, boolean uniform) {
+ this(swigfaissJNI.new_RemapDimensionsTransform__SWIG_1(d_in, d_out, uniform), true);
+ }
+
+ public RemapDimensionsTransform(int d_in, int d_out) {
+ this(swigfaissJNI.new_RemapDimensionsTransform__SWIG_2(d_in, d_out), true);
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.RemapDimensionsTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+ public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
+ swigfaissJNI.RemapDimensionsTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public RemapDimensionsTransform() {
+ this(swigfaissJNI.new_RemapDimensionsTransform__SWIG_3(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/ReproduceDistancesObjective.java b/ann/src/main/java/com/twitter/ann/faiss/swig/ReproduceDistancesObjective.java
new file mode 100644
index 000000000..19b762d7e
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/ReproduceDistancesObjective.java
@@ -0,0 +1,106 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class ReproduceDistancesObjective extends PermutationObjective {
+ private transient long swigCPtr;
+
+ protected ReproduceDistancesObjective(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.ReproduceDistancesObjective_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(ReproduceDistancesObjective obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_ReproduceDistancesObjective(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setDis_weight_factor(double value) {
+ swigfaissJNI.ReproduceDistancesObjective_dis_weight_factor_set(swigCPtr, this, value);
+ }
+
+ public double getDis_weight_factor() {
+ return swigfaissJNI.ReproduceDistancesObjective_dis_weight_factor_get(swigCPtr, this);
+ }
+
+ public static double sqr(double x) {
+ return swigfaissJNI.ReproduceDistancesObjective_sqr(x);
+ }
+
+ public double dis_weight(double x) {
+ return swigfaissJNI.ReproduceDistancesObjective_dis_weight(swigCPtr, this, x);
+ }
+
+ public void setSource_dis(DoubleVector value) {
+ swigfaissJNI.ReproduceDistancesObjective_source_dis_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
+ }
+
+ public DoubleVector getSource_dis() {
+ long cPtr = swigfaissJNI.ReproduceDistancesObjective_source_dis_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
+ }
+
+ public void setTarget_dis(SWIGTYPE_p_double value) {
+ swigfaissJNI.ReproduceDistancesObjective_target_dis_set(swigCPtr, this, SWIGTYPE_p_double.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_double getTarget_dis() {
+ long cPtr = swigfaissJNI.ReproduceDistancesObjective_target_dis_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false);
+ }
+
+ public void setWeights(DoubleVector value) {
+ swigfaissJNI.ReproduceDistancesObjective_weights_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
+ }
+
+ public DoubleVector getWeights() {
+ long cPtr = swigfaissJNI.ReproduceDistancesObjective_weights_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
+ }
+
+ public double get_source_dis(int i, int j) {
+ return swigfaissJNI.ReproduceDistancesObjective_get_source_dis(swigCPtr, this, i, j);
+ }
+
+ public double compute_cost(SWIGTYPE_p_int perm) {
+ return swigfaissJNI.ReproduceDistancesObjective_compute_cost(swigCPtr, this, SWIGTYPE_p_int.getCPtr(perm));
+ }
+
+ public double cost_update(SWIGTYPE_p_int perm, int iw, int jw) {
+ return swigfaissJNI.ReproduceDistancesObjective_cost_update(swigCPtr, this, SWIGTYPE_p_int.getCPtr(perm), iw, jw);
+ }
+
+ public ReproduceDistancesObjective(int n, SWIGTYPE_p_double source_dis_in, SWIGTYPE_p_double target_dis_in, double dis_weight_factor) {
+ this(swigfaissJNI.new_ReproduceDistancesObjective(n, SWIGTYPE_p_double.getCPtr(source_dis_in), SWIGTYPE_p_double.getCPtr(target_dis_in), dis_weight_factor), true);
+ }
+
+ public static void compute_mean_stdev(SWIGTYPE_p_double tab, long n2, SWIGTYPE_p_double mean_out, SWIGTYPE_p_double stddev_out) {
+ swigfaissJNI.ReproduceDistancesObjective_compute_mean_stdev(SWIGTYPE_p_double.getCPtr(tab), n2, SWIGTYPE_p_double.getCPtr(mean_out), SWIGTYPE_p_double.getCPtr(stddev_out));
+ }
+
+ public void set_affine_target_dis(SWIGTYPE_p_double source_dis_in) {
+ swigfaissJNI.ReproduceDistancesObjective_set_affine_target_dis(swigCPtr, this, SWIGTYPE_p_double.getCPtr(source_dis_in));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_32_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_32_t.java
new file mode 100644
index 000000000..c2ca5d995
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_32_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_AlignedTableT_float_32_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_AlignedTableT_float_32_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_AlignedTableT_float_32_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_AlignedTableT_float_32_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_t.java
new file mode 100644
index 000000000..f77626d23
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_AlignedTableT_float_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_AlignedTableT_float_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_AlignedTableT_float_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_AlignedTableT_float_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_AlignedTableT_float_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap.java
new file mode 100644
index 000000000..d4a2f0015
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_DirectMap {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_DirectMap(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_DirectMap() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_DirectMap obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap__Type.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap__Type.java
new file mode 100644
index 000000000..94763e8df
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_DirectMap__Type.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_DirectMap__Type {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_DirectMap__Type(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_DirectMap__Type() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_DirectMap__Type obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_FILE.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_FILE.java
new file mode 100644
index 000000000..7e2733107
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_FILE.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_FILE {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_FILE(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_FILE() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_FILE obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOReader.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOReader.java
new file mode 100644
index 000000000..e4003ea9c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOReader.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_IOReader {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_IOReader(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_IOReader() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_IOReader obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOWriter.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOWriter.java
new file mode 100644
index 000000000..c618a7728
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_IOWriter.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_IOWriter {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_IOWriter(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_IOWriter() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_IOWriter obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer.java
new file mode 100644
index 000000000..aa797717e
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_ScalarQuantizer {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_ScalarQuantizer(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_ScalarQuantizer() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_ScalarQuantizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer__QuantizerType.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer__QuantizerType.java
new file mode 100644
index 000000000..79c1e62c4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_ScalarQuantizer__QuantizerType.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_ScalarQuantizer__QuantizerType {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_ScalarQuantizer__QuantizerType(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_ScalarQuantizer__QuantizerType() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_ScalarQuantizer__QuantizerType obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_double.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_double.java
new file mode 100644
index 000000000..3fc49d14e
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_double.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_double {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_double(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_double() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_double obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t.java
new file mode 100644
index 000000000..bef0e5fd1
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t.java
new file mode 100644
index 000000000..0c63b2e1c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t.java
new file mode 100644
index 000000000..a347de470
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__BinaryInvertedListScanner.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__BinaryInvertedListScanner.java
new file mode 100644
index 000000000..9c0c3af14
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__BinaryInvertedListScanner.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__BinaryInvertedListScanner {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__BinaryInvertedListScanner(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__BinaryInvertedListScanner() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__BinaryInvertedListScanner obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.java
new file mode 100644
index 000000000..8f084c126
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_float_int64_t_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.java
new file mode 100644
index 000000000..2200ff2f0
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t.java
new file mode 100644
index 000000000..e8582625f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMinT_float_int64_t_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOReader.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOReader.java
new file mode 100644
index 000000000..26aa9a153
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOReader.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__IOReader {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__IOReader(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__IOReader() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__IOReader obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOWriter.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOWriter.java
new file mode 100644
index 000000000..7733421c1
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__IOWriter.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__IOWriter {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__IOWriter(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__IOWriter() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__IOWriter obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__InvertedListScanner.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__InvertedListScanner.java
new file mode 100644
index 000000000..c94ea8604
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__InvertedListScanner.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__InvertedListScanner {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__InvertedListScanner(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__InvertedListScanner() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__InvertedListScanner obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__LockLevels.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__LockLevels.java
new file mode 100644
index 000000000..6f709e65b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__LockLevels.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__LockLevels {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__LockLevels(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__LockLevels() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__LockLevels obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.java
new file mode 100644
index 000000000..49c0a423f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__RandomGenerator.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__RandomGenerator.java
new file mode 100644
index 000000000..6c3a98878
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_faiss__RandomGenerator.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_faiss__RandomGenerator {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_faiss__RandomGenerator(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_faiss__RandomGenerator() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_faiss__RandomGenerator obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_float.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_float.java
new file mode 100644
index 000000000..e4856b983
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_float.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_float {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_float(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_float() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_float obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_int.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_int.java
new file mode 100644
index 000000000..b3df7335d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_int.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_int {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_int(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_int() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_int obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long.java
new file mode 100644
index 000000000..4f8fa7370
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_long {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_long(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_long() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_long obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long_long.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long_long.java
new file mode 100644
index 000000000..e3eda3886
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_long_long.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_long_long {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_long_long(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_long_long() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_long_long obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_omp_lock_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_omp_lock_t.java
new file mode 100644
index 000000000..dd051ae05
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_omp_lock_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_omp_lock_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_omp_lock_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_omp_lock_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_omp_lock_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__Index.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__Index.java
new file mode 100644
index 000000000..6521ff457
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__Index.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_p_faiss__Index {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_p_faiss__Index(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_p_faiss__Index() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_p_faiss__Index obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__InvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__InvertedLists.java
new file mode 100644
index 000000000..f59b0d9ca
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__InvertedLists.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_p_faiss__InvertedLists {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_p_faiss__InvertedLists(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_p_faiss__InvertedLists() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_p_faiss__InvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__VectorTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__VectorTransform.java
new file mode 100644
index 000000000..7868f49b5
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_p_faiss__VectorTransform.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_p_faiss__VectorTransform {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_p_faiss__VectorTransform(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_p_faiss__VectorTransform() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_p_faiss__VectorTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.java
new file mode 100644
index 000000000..a57effe96
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__pairT_float_int_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__pairT_float_int_t.java
new file mode 100644
index 000000000..e168f768c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__pairT_float_int_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__pairT_float_int_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__pairT_float_int_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__pairT_float_int_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__pairT_float_int_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t.java
new file mode 100644
index 000000000..e36ee5f13
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t.java
new file mode 100644
index 000000000..582f8a1c5
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_mapT_long_long_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_mapT_long_long_t.java
new file mode 100644
index 000000000..2d3e1688d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_mapT_long_long_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__unordered_mapT_long_long_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__unordered_mapT_long_long_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__unordered_mapT_long_long_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__unordered_mapT_long_long_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t.java
new file mode 100644
index 000000000..443e100db
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t.java
new file mode 100644
index 000000000..0e65925c3
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.java
new file mode 100644
index 000000000..c0eaa547f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t.java
new file mode 100644
index 000000000..52c8371c7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__Index_p_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__Index_p_t.java
new file mode 100644
index 000000000..f79e29ad6
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__Index_p_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__Index_p_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__Index_p_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__Index_p_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__Index_p_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.java
new file mode 100644
index 000000000..2e14f35c5
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.java
new file mode 100644
index 000000000..9d79a184c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t.java
new file mode 100644
index 000000000..99e3adabf
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__ParameterRange_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t.java
new file mode 100644
index 000000000..64a1711ab
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__RangeQueryResult_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t.java
new file mode 100644
index 000000000..67cd2d26a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_faiss__RangeSearchPartialResult_p_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_int64_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_int64_t_t.java
new file mode 100644
index 000000000..06db35e07
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_int64_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_int64_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_int64_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_int64_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_int64_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_long_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_long_t.java
new file mode 100644
index 000000000..4ad496dc7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_long_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_long_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_long_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_long_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_long_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_omp_lock_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_omp_lock_t_t.java
new file mode 100644
index 000000000..81c9e88a1
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_omp_lock_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_omp_lock_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_omp_lock_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_omp_lock_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_omp_lock_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t.java
new file mode 100644
index 000000000..7e5504484
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t.java
new file mode 100644
index 000000000..dbd515dcc
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint16_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint16_t.java
new file mode 100644
index 000000000..5ac22962a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint16_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_uint16_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_uint16_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_uint16_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_uint16_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint32_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint32_t.java
new file mode 100644
index 000000000..3f2db2873
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_uint32_t.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_uint32_t {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_uint32_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_uint32_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_uint32_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_char.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_char.java
new file mode 100644
index 000000000..c34696c2c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_char.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_unsigned_char {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_unsigned_char(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_unsigned_char() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_unsigned_char obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_long.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_long.java
new file mode 100644
index 000000000..f303bca61
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_unsigned_long.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_unsigned_long {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_unsigned_long(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_unsigned_long() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_unsigned_long obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_void.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_void.java
new file mode 100644
index 000000000..2ec4d574c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SWIGTYPE_p_void.java
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SWIGTYPE_p_void {
+ private transient long swigCPtr;
+
+ protected SWIGTYPE_p_void(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_void() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_void obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingOptimizer.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingOptimizer.java
new file mode 100644
index 000000000..e3b2af66c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingOptimizer.java
@@ -0,0 +1,94 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SimulatedAnnealingOptimizer extends SimulatedAnnealingParameters {
+ private transient long swigCPtr;
+
+ protected SimulatedAnnealingOptimizer(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.SimulatedAnnealingOptimizer_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(SimulatedAnnealingOptimizer obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_SimulatedAnnealingOptimizer(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setObj(PermutationObjective value) {
+ swigfaissJNI.SimulatedAnnealingOptimizer_obj_set(swigCPtr, this, PermutationObjective.getCPtr(value), value);
+ }
+
+ public PermutationObjective getObj() {
+ long cPtr = swigfaissJNI.SimulatedAnnealingOptimizer_obj_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new PermutationObjective(cPtr, false);
+ }
+
+ public void setN(int value) {
+ swigfaissJNI.SimulatedAnnealingOptimizer_n_set(swigCPtr, this, value);
+ }
+
+ public int getN() {
+ return swigfaissJNI.SimulatedAnnealingOptimizer_n_get(swigCPtr, this);
+ }
+
+ public void setLogfile(SWIGTYPE_p_FILE value) {
+ swigfaissJNI.SimulatedAnnealingOptimizer_logfile_set(swigCPtr, this, SWIGTYPE_p_FILE.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_FILE getLogfile() {
+ long cPtr = swigfaissJNI.SimulatedAnnealingOptimizer_logfile_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_FILE(cPtr, false);
+ }
+
+ public SimulatedAnnealingOptimizer(PermutationObjective obj, SimulatedAnnealingParameters p) {
+ this(swigfaissJNI.new_SimulatedAnnealingOptimizer(PermutationObjective.getCPtr(obj), obj, SimulatedAnnealingParameters.getCPtr(p), p), true);
+ }
+
+ public void setRnd(SWIGTYPE_p_faiss__RandomGenerator value) {
+ swigfaissJNI.SimulatedAnnealingOptimizer_rnd_set(swigCPtr, this, SWIGTYPE_p_faiss__RandomGenerator.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_faiss__RandomGenerator getRnd() {
+ long cPtr = swigfaissJNI.SimulatedAnnealingOptimizer_rnd_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__RandomGenerator(cPtr, false);
+ }
+
+ public void setInit_cost(double value) {
+ swigfaissJNI.SimulatedAnnealingOptimizer_init_cost_set(swigCPtr, this, value);
+ }
+
+ public double getInit_cost() {
+ return swigfaissJNI.SimulatedAnnealingOptimizer_init_cost_get(swigCPtr, this);
+ }
+
+ public double optimize(SWIGTYPE_p_int perm) {
+ return swigfaissJNI.SimulatedAnnealingOptimizer_optimize(swigCPtr, this, SWIGTYPE_p_int.getCPtr(perm));
+ }
+
+ public double run_optimization(SWIGTYPE_p_int best_perm) {
+ return swigfaissJNI.SimulatedAnnealingOptimizer_run_optimization(swigCPtr, this, SWIGTYPE_p_int.getCPtr(best_perm));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingParameters.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingParameters.java
new file mode 100644
index 000000000..612d9be4e
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SimulatedAnnealingParameters.java
@@ -0,0 +1,107 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SimulatedAnnealingParameters {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected SimulatedAnnealingParameters(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(SimulatedAnnealingParameters obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_SimulatedAnnealingParameters(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setInit_temperature(double value) {
+ swigfaissJNI.SimulatedAnnealingParameters_init_temperature_set(swigCPtr, this, value);
+ }
+
+ public double getInit_temperature() {
+ return swigfaissJNI.SimulatedAnnealingParameters_init_temperature_get(swigCPtr, this);
+ }
+
+ public void setTemperature_decay(double value) {
+ swigfaissJNI.SimulatedAnnealingParameters_temperature_decay_set(swigCPtr, this, value);
+ }
+
+ public double getTemperature_decay() {
+ return swigfaissJNI.SimulatedAnnealingParameters_temperature_decay_get(swigCPtr, this);
+ }
+
+ public void setN_iter(int value) {
+ swigfaissJNI.SimulatedAnnealingParameters_n_iter_set(swigCPtr, this, value);
+ }
+
+ public int getN_iter() {
+ return swigfaissJNI.SimulatedAnnealingParameters_n_iter_get(swigCPtr, this);
+ }
+
+ public void setN_redo(int value) {
+ swigfaissJNI.SimulatedAnnealingParameters_n_redo_set(swigCPtr, this, value);
+ }
+
+ public int getN_redo() {
+ return swigfaissJNI.SimulatedAnnealingParameters_n_redo_get(swigCPtr, this);
+ }
+
+ public void setSeed(int value) {
+ swigfaissJNI.SimulatedAnnealingParameters_seed_set(swigCPtr, this, value);
+ }
+
+ public int getSeed() {
+ return swigfaissJNI.SimulatedAnnealingParameters_seed_get(swigCPtr, this);
+ }
+
+ public void setVerbose(int value) {
+ swigfaissJNI.SimulatedAnnealingParameters_verbose_set(swigCPtr, this, value);
+ }
+
+ public int getVerbose() {
+ return swigfaissJNI.SimulatedAnnealingParameters_verbose_get(swigCPtr, this);
+ }
+
+ public void setOnly_bit_flips(boolean value) {
+ swigfaissJNI.SimulatedAnnealingParameters_only_bit_flips_set(swigCPtr, this, value);
+ }
+
+ public boolean getOnly_bit_flips() {
+ return swigfaissJNI.SimulatedAnnealingParameters_only_bit_flips_get(swigCPtr, this);
+ }
+
+ public void setInit_random(boolean value) {
+ swigfaissJNI.SimulatedAnnealingParameters_init_random_set(swigCPtr, this, value);
+ }
+
+ public boolean getInit_random() {
+ return swigfaissJNI.SimulatedAnnealingParameters_init_random_get(swigCPtr, this);
+ }
+
+ public SimulatedAnnealingParameters() {
+ this(swigfaissJNI.new_SimulatedAnnealingParameters(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SliceInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SliceInvertedLists.java
new file mode 100644
index 000000000..6a551db14
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SliceInvertedLists.java
@@ -0,0 +1,102 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SliceInvertedLists extends ReadOnlyInvertedLists {
+ private transient long swigCPtr;
+
+ protected SliceInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.SliceInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(SliceInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_SliceInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIl(InvertedLists value) {
+ swigfaissJNI.SliceInvertedLists_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl() {
+ long cPtr = swigfaissJNI.SliceInvertedLists_il_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setI0(long value) {
+ swigfaissJNI.SliceInvertedLists_i0_set(swigCPtr, this, value);
+ }
+
+ public long getI0() {
+ return swigfaissJNI.SliceInvertedLists_i0_get(swigCPtr, this);
+}
+
+ public void setI1(long value) {
+ swigfaissJNI.SliceInvertedLists_i1_set(swigCPtr, this, value);
+ }
+
+ public long getI1() {
+ return swigfaissJNI.SliceInvertedLists_i1_get(swigCPtr, this);
+}
+
+ public SliceInvertedLists(InvertedLists il, long i0, long i1) {
+ this(swigfaissJNI.new_SliceInvertedLists(InvertedLists.getCPtr(il), il, i0, i1), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.SliceInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.SliceInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.SliceInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.SliceInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.SliceInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.SliceInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.SliceInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.SliceInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/SlidingIndexWindow.java b/ann/src/main/java/com/twitter/ann/faiss/swig/SlidingIndexWindow.java
new file mode 100644
index 000000000..c866e2fa2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/SlidingIndexWindow.java
@@ -0,0 +1,90 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class SlidingIndexWindow {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected SlidingIndexWindow(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(SlidingIndexWindow obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_SlidingIndexWindow(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setIndex(Index value) {
+ swigfaissJNI.SlidingIndexWindow_index_set(swigCPtr, this, Index.getCPtr(value), value);
+ }
+
+ public Index getIndex() {
+ long cPtr = swigfaissJNI.SlidingIndexWindow_index_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public void setIls(ArrayInvertedLists value) {
+ swigfaissJNI.SlidingIndexWindow_ils_set(swigCPtr, this, ArrayInvertedLists.getCPtr(value), value);
+ }
+
+ public ArrayInvertedLists getIls() {
+ long cPtr = swigfaissJNI.SlidingIndexWindow_ils_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ArrayInvertedLists(cPtr, false);
+ }
+
+ public void setN_slice(int value) {
+ swigfaissJNI.SlidingIndexWindow_n_slice_set(swigCPtr, this, value);
+ }
+
+ public int getN_slice() {
+ return swigfaissJNI.SlidingIndexWindow_n_slice_get(swigCPtr, this);
+ }
+
+ public void setNlist(long value) {
+ swigfaissJNI.SlidingIndexWindow_nlist_set(swigCPtr, this, value);
+ }
+
+ public long getNlist() {
+ return swigfaissJNI.SlidingIndexWindow_nlist_get(swigCPtr, this);
+ }
+
+ public void setSizes(SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t value) {
+ swigfaissJNI.SlidingIndexWindow_sizes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t getSizes() {
+ long cPtr = swigfaissJNI.SlidingIndexWindow_sizes_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_std__vectorT_unsigned_long_t_t(cPtr, false);
+ }
+
+ public SlidingIndexWindow(Index index) {
+ this(swigfaissJNI.new_SlidingIndexWindow(Index.getCPtr(index), index), true);
+ }
+
+ public void step(Index sub_index, boolean remove_oldest) {
+ swigfaissJNI.SlidingIndexWindow_step(swigCPtr, this, Index.getCPtr(sub_index), sub_index, remove_oldest);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/StopWordsInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/StopWordsInvertedLists.java
new file mode 100644
index 000000000..d951d207d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/StopWordsInvertedLists.java
@@ -0,0 +1,94 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class StopWordsInvertedLists extends ReadOnlyInvertedLists {
+ private transient long swigCPtr;
+
+ protected StopWordsInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.StopWordsInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(StopWordsInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_StopWordsInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIl0(InvertedLists value) {
+ swigfaissJNI.StopWordsInvertedLists_il0_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
+ }
+
+ public InvertedLists getIl0() {
+ long cPtr = swigfaissJNI.StopWordsInvertedLists_il0_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public void setMaxsize(long value) {
+ swigfaissJNI.StopWordsInvertedLists_maxsize_set(swigCPtr, this, value);
+ }
+
+ public long getMaxsize() {
+ return swigfaissJNI.StopWordsInvertedLists_maxsize_get(swigCPtr, this);
+ }
+
+ public StopWordsInvertedLists(InvertedLists il, long maxsize) {
+ this(swigfaissJNI.new_StopWordsInvertedLists(InvertedLists.getCPtr(il), il, maxsize), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.StopWordsInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.StopWordsInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.StopWordsInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.StopWordsInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.StopWordsInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.StopWordsInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.StopWordsInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.StopWordsInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/Uint64Vector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/Uint64Vector.java
new file mode 100644
index 000000000..cd9b40be7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/Uint64Vector.java
@@ -0,0 +1,76 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class Uint64Vector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected Uint64Vector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(Uint64Vector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_Uint64Vector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public Uint64Vector() {
+ this(swigfaissJNI.new_Uint64Vector(), true);
+ }
+
+ public void push_back(long arg0) {
+ swigfaissJNI.Uint64Vector_push_back(swigCPtr, this, arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.Uint64Vector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_unsigned_long data() {
+ long cPtr = swigfaissJNI.Uint64Vector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.Uint64Vector_size(swigCPtr, this);
+ }
+
+ public long at(long n) {
+ return swigfaissJNI.Uint64Vector_at(swigCPtr, this, n);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.Uint64Vector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.Uint64Vector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(Uint64Vector other) {
+ swigfaissJNI.Uint64Vector_swap(swigCPtr, this, Uint64Vector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/VStackInvertedLists.java b/ann/src/main/java/com/twitter/ann/faiss/swig/VStackInvertedLists.java
new file mode 100644
index 000000000..127a4a953
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/VStackInvertedLists.java
@@ -0,0 +1,95 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class VStackInvertedLists extends ReadOnlyInvertedLists {
+ private transient long swigCPtr;
+
+ protected VStackInvertedLists(long cPtr, boolean cMemoryOwn) {
+ super(swigfaissJNI.VStackInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(VStackInvertedLists obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_VStackInvertedLists(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ super.delete();
+ }
+
+ public void setIls(SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t value) {
+ swigfaissJNI.VStackInvertedLists_ils_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t getIls() {
+ long cPtr = swigfaissJNI.VStackInvertedLists_ils_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t(cPtr, false);
+ }
+
+ public void setCumsz(SWIGTYPE_p_std__vectorT_int64_t_t value) {
+ swigfaissJNI.VStackInvertedLists_cumsz_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_std__vectorT_int64_t_t getCumsz() {
+ long cPtr = swigfaissJNI.VStackInvertedLists_cumsz_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
+ }
+
+ public VStackInvertedLists(int nil, SWIGTYPE_p_p_faiss__InvertedLists ils) {
+ this(swigfaissJNI.new_VStackInvertedLists(nil, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils)), true);
+ }
+
+ public long list_size(long list_no) {
+ return swigfaissJNI.VStackInvertedLists_list_size(swigCPtr, this, list_no);
+ }
+
+ public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
+ long cPtr = swigfaissJNI.VStackInvertedLists_get_codes(swigCPtr, this, list_no);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public LongVector get_ids(long list_no) {
+ return new LongVector(swigfaissJNI.VStackInvertedLists_get_ids(swigCPtr, this, list_no), false);
+}
+
+ public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
+ swigfaissJNI.VStackInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
+ }
+
+ public void release_ids(long list_no, LongVector ids) {
+ swigfaissJNI.VStackInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
+ }
+
+ public long get_single_id(long list_no, long offset) {
+ return swigfaissJNI.VStackInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
+}
+
+ public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
+ long cPtr = swigfaissJNI.VStackInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+ }
+
+ public void prefetch_lists(LongVector list_nos, int nlist) {
+ swigfaissJNI.VStackInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransform.java b/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransform.java
new file mode 100644
index 000000000..e17ad0f4d
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransform.java
@@ -0,0 +1,80 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class VectorTransform {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected VectorTransform(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(VectorTransform obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_VectorTransform(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setD_in(int value) {
+ swigfaissJNI.VectorTransform_d_in_set(swigCPtr, this, value);
+ }
+
+ public int getD_in() {
+ return swigfaissJNI.VectorTransform_d_in_get(swigCPtr, this);
+ }
+
+ public void setD_out(int value) {
+ swigfaissJNI.VectorTransform_d_out_set(swigCPtr, this, value);
+ }
+
+ public int getD_out() {
+ return swigfaissJNI.VectorTransform_d_out_get(swigCPtr, this);
+ }
+
+ public void setIs_trained(boolean value) {
+ swigfaissJNI.VectorTransform_is_trained_set(swigCPtr, this, value);
+ }
+
+ public boolean getIs_trained() {
+ return swigfaissJNI.VectorTransform_is_trained_get(swigCPtr, this);
+ }
+
+ public void train(long n, SWIGTYPE_p_float x) {
+ swigfaissJNI.VectorTransform_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ }
+
+ public SWIGTYPE_p_float apply(long n, SWIGTYPE_p_float x) {
+ long cPtr = swigfaissJNI.VectorTransform_apply(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
+ swigfaissJNI.VectorTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
+ }
+
+ public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
+ swigfaissJNI.VectorTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransformVector.java b/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransformVector.java
new file mode 100644
index 000000000..d7a1a6f6f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/VectorTransformVector.java
@@ -0,0 +1,77 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class VectorTransformVector {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected VectorTransformVector(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(VectorTransformVector obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_VectorTransformVector(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public VectorTransformVector() {
+ this(swigfaissJNI.new_VectorTransformVector(), true);
+ }
+
+ public void push_back(VectorTransform arg0) {
+ swigfaissJNI.VectorTransformVector_push_back(swigCPtr, this, VectorTransform.getCPtr(arg0), arg0);
+ }
+
+ public void clear() {
+ swigfaissJNI.VectorTransformVector_clear(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_p_faiss__VectorTransform data() {
+ long cPtr = swigfaissJNI.VectorTransformVector_data(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_p_faiss__VectorTransform(cPtr, false);
+ }
+
+ public long size() {
+ return swigfaissJNI.VectorTransformVector_size(swigCPtr, this);
+ }
+
+ public VectorTransform at(long n) {
+ long cPtr = swigfaissJNI.VectorTransformVector_at(swigCPtr, this, n);
+ return (cPtr == 0) ? null : new VectorTransform(cPtr, false);
+ }
+
+ public void resize(long n) {
+ swigfaissJNI.VectorTransformVector_resize(swigCPtr, this, n);
+ }
+
+ public void reserve(long n) {
+ swigfaissJNI.VectorTransformVector_reserve(swigCPtr, this, n);
+ }
+
+ public void swap(VectorTransformVector other) {
+ swigfaissJNI.VectorTransformVector_swap(swigCPtr, this, VectorTransformVector.getCPtr(other), other);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/VisitedTable.java b/ann/src/main/java/com/twitter/ann/faiss/swig/VisitedTable.java
new file mode 100644
index 000000000..69b1108a4
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/VisitedTable.java
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class VisitedTable {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected VisitedTable(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(VisitedTable obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_VisitedTable(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setVisited(ByteVector value) {
+ swigfaissJNI.VisitedTable_visited_set(swigCPtr, this, ByteVector.getCPtr(value), value);
+ }
+
+ public ByteVector getVisited() {
+ long cPtr = swigfaissJNI.VisitedTable_visited_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new ByteVector(cPtr, false);
+ }
+
+ public void setVisno(int value) {
+ swigfaissJNI.VisitedTable_visno_set(swigCPtr, this, value);
+ }
+
+ public int getVisno() {
+ return swigfaissJNI.VisitedTable_visno_get(swigCPtr, this);
+ }
+
+ public VisitedTable(int size) {
+ this(swigfaissJNI.new_VisitedTable(size), true);
+ }
+
+ public void set(int no) {
+ swigfaissJNI.VisitedTable_set(swigCPtr, this, no);
+ }
+
+ public boolean get(int no) {
+ return swigfaissJNI.VisitedTable_get(swigCPtr, this, no);
+ }
+
+ public void advance() {
+ swigfaissJNI.VisitedTable_advance(swigCPtr, this);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/doubleArray.java b/ann/src/main/java/com/twitter/ann/faiss/swig/doubleArray.java
new file mode 100644
index 000000000..f37b56e4a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/doubleArray.java
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class doubleArray {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected doubleArray(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(doubleArray obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_doubleArray(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public doubleArray(int nelements) {
+ this(swigfaissJNI.new_doubleArray(nelements), true);
+ }
+
+ public double getitem(int index) {
+ return swigfaissJNI.doubleArray_getitem(swigCPtr, this, index);
+ }
+
+ public void setitem(int index, double value) {
+ swigfaissJNI.doubleArray_setitem(swigCPtr, this, index, value);
+ }
+
+ public SWIGTYPE_p_double cast() {
+ long cPtr = swigfaissJNI.doubleArray_cast(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false);
+ }
+
+ public static doubleArray frompointer(SWIGTYPE_p_double t) {
+ long cPtr = swigfaissJNI.doubleArray_frompointer(SWIGTYPE_p_double.getCPtr(t));
+ return (cPtr == 0) ? null : new doubleArray(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/floatArray.java b/ann/src/main/java/com/twitter/ann/faiss/swig/floatArray.java
new file mode 100644
index 000000000..641dc844b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/floatArray.java
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class floatArray {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected floatArray(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(floatArray obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_floatArray(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public floatArray(int nelements) {
+ this(swigfaissJNI.new_floatArray(nelements), true);
+ }
+
+ public float getitem(int index) {
+ return swigfaissJNI.floatArray_getitem(swigCPtr, this, index);
+ }
+
+ public void setitem(int index, float value) {
+ swigfaissJNI.floatArray_setitem(swigCPtr, this, index, value);
+ }
+
+ public SWIGTYPE_p_float cast() {
+ long cPtr = swigfaissJNI.floatArray_cast(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public static floatArray frompointer(SWIGTYPE_p_float t) {
+ long cPtr = swigfaissJNI.floatArray_frompointer(SWIGTYPE_p_float.getCPtr(t));
+ return (cPtr == 0) ? null : new floatArray(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/float_maxheap_array_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/float_maxheap_array_t.java
new file mode 100644
index 000000000..875ef1c4a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/float_maxheap_array_t.java
@@ -0,0 +1,133 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class float_maxheap_array_t {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected float_maxheap_array_t(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(float_maxheap_array_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_float_maxheap_array_t(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNh(long value) {
+ swigfaissJNI.float_maxheap_array_t_nh_set(swigCPtr, this, value);
+ }
+
+ public long getNh() {
+ return swigfaissJNI.float_maxheap_array_t_nh_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.float_maxheap_array_t_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.float_maxheap_array_t_k_get(swigCPtr, this);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.float_maxheap_array_t_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.float_maxheap_array_t_ids_get(swigCPtr, this), false);
+}
+
+ public void setVal(SWIGTYPE_p_float value) {
+ swigfaissJNI.float_maxheap_array_t_val_set(swigCPtr, this, SWIGTYPE_p_float.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_float getVal() {
+ long cPtr = swigfaissJNI.float_maxheap_array_t_val_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public SWIGTYPE_p_float get_val(long key) {
+ long cPtr = swigfaissJNI.float_maxheap_array_t_get_val(swigCPtr, this, key);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public LongVector get_ids(long key) {
+ return new LongVector(swigfaissJNI.float_maxheap_array_t_get_ids(swigCPtr, this, key), false);
+}
+
+ public void heapify() {
+ swigfaissJNI.float_maxheap_array_t_heapify(swigCPtr, this);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0, long i0, long ni) {
+ swigfaissJNI.float_maxheap_array_t_addn__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0, i0, ni);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0, long i0) {
+ swigfaissJNI.float_maxheap_array_t_addn__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0, i0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0) {
+ swigfaissJNI.float_maxheap_array_t_addn__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin) {
+ swigfaissJNI.float_maxheap_array_t_addn__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin));
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride, long i0, long ni) {
+ swigfaissJNI.float_maxheap_array_t_addn_with_ids__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0, ni);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride, long i0) {
+ swigfaissJNI.float_maxheap_array_t_addn_with_ids__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride) {
+ swigfaissJNI.float_maxheap_array_t_addn_with_ids__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in) {
+ swigfaissJNI.float_maxheap_array_t_addn_with_ids__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin) {
+ swigfaissJNI.float_maxheap_array_t_addn_with_ids__SWIG_4(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin));
+ }
+
+ public void reorder() {
+ swigfaissJNI.float_maxheap_array_t_reorder(swigCPtr, this);
+ }
+
+ public void per_line_extrema(SWIGTYPE_p_float vals_out, LongVector idx_out) {
+ swigfaissJNI.float_maxheap_array_t_per_line_extrema(swigCPtr, this, SWIGTYPE_p_float.getCPtr(vals_out), SWIGTYPE_p_long_long.getCPtr(idx_out.data()), idx_out);
+ }
+
+ public float_maxheap_array_t() {
+ this(swigfaissJNI.new_float_maxheap_array_t(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/float_minheap_array_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/float_minheap_array_t.java
new file mode 100644
index 000000000..5944f2cc9
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/float_minheap_array_t.java
@@ -0,0 +1,133 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class float_minheap_array_t {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected float_minheap_array_t(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(float_minheap_array_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_float_minheap_array_t(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNh(long value) {
+ swigfaissJNI.float_minheap_array_t_nh_set(swigCPtr, this, value);
+ }
+
+ public long getNh() {
+ return swigfaissJNI.float_minheap_array_t_nh_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.float_minheap_array_t_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.float_minheap_array_t_k_get(swigCPtr, this);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.float_minheap_array_t_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.float_minheap_array_t_ids_get(swigCPtr, this), false);
+}
+
+ public void setVal(SWIGTYPE_p_float value) {
+ swigfaissJNI.float_minheap_array_t_val_set(swigCPtr, this, SWIGTYPE_p_float.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_float getVal() {
+ long cPtr = swigfaissJNI.float_minheap_array_t_val_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public SWIGTYPE_p_float get_val(long key) {
+ long cPtr = swigfaissJNI.float_minheap_array_t_get_val(swigCPtr, this, key);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public LongVector get_ids(long key) {
+ return new LongVector(swigfaissJNI.float_minheap_array_t_get_ids(swigCPtr, this, key), false);
+}
+
+ public void heapify() {
+ swigfaissJNI.float_minheap_array_t_heapify(swigCPtr, this);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0, long i0, long ni) {
+ swigfaissJNI.float_minheap_array_t_addn__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0, i0, ni);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0, long i0) {
+ swigfaissJNI.float_minheap_array_t_addn__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0, i0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin, long j0) {
+ swigfaissJNI.float_minheap_array_t_addn__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), j0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_float vin) {
+ swigfaissJNI.float_minheap_array_t_addn__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin));
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride, long i0, long ni) {
+ swigfaissJNI.float_minheap_array_t_addn_with_ids__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0, ni);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride, long i0) {
+ swigfaissJNI.float_minheap_array_t_addn_with_ids__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in, long id_stride) {
+ swigfaissJNI.float_minheap_array_t_addn_with_ids__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin, LongVector id_in) {
+ swigfaissJNI.float_minheap_array_t_addn_with_ids__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_float vin) {
+ swigfaissJNI.float_minheap_array_t_addn_with_ids__SWIG_4(swigCPtr, this, nj, SWIGTYPE_p_float.getCPtr(vin));
+ }
+
+ public void reorder() {
+ swigfaissJNI.float_minheap_array_t_reorder(swigCPtr, this);
+ }
+
+ public void per_line_extrema(SWIGTYPE_p_float vals_out, LongVector idx_out) {
+ swigfaissJNI.float_minheap_array_t_per_line_extrema(swigCPtr, this, SWIGTYPE_p_float.getCPtr(vals_out), SWIGTYPE_p_long_long.getCPtr(idx_out.data()), idx_out);
+ }
+
+ public float_minheap_array_t() {
+ this(swigfaissJNI.new_float_minheap_array_t(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/intArray.java b/ann/src/main/java/com/twitter/ann/faiss/swig/intArray.java
new file mode 100644
index 000000000..9774521a1
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/intArray.java
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class intArray {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected intArray(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(intArray obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_intArray(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public intArray(int nelements) {
+ this(swigfaissJNI.new_intArray(nelements), true);
+ }
+
+ public int getitem(int index) {
+ return swigfaissJNI.intArray_getitem(swigCPtr, this, index);
+ }
+
+ public void setitem(int index, int value) {
+ swigfaissJNI.intArray_setitem(swigCPtr, this, index, value);
+ }
+
+ public SWIGTYPE_p_int cast() {
+ long cPtr = swigfaissJNI.intArray_cast(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public static intArray frompointer(SWIGTYPE_p_int t) {
+ long cPtr = swigfaissJNI.intArray_frompointer(SWIGTYPE_p_int.getCPtr(t));
+ return (cPtr == 0) ? null : new intArray(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/int_maxheap_array_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/int_maxheap_array_t.java
new file mode 100644
index 000000000..07bf7a570
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/int_maxheap_array_t.java
@@ -0,0 +1,133 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class int_maxheap_array_t {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected int_maxheap_array_t(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(int_maxheap_array_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_int_maxheap_array_t(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNh(long value) {
+ swigfaissJNI.int_maxheap_array_t_nh_set(swigCPtr, this, value);
+ }
+
+ public long getNh() {
+ return swigfaissJNI.int_maxheap_array_t_nh_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.int_maxheap_array_t_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.int_maxheap_array_t_k_get(swigCPtr, this);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.int_maxheap_array_t_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.int_maxheap_array_t_ids_get(swigCPtr, this), false);
+}
+
+ public void setVal(SWIGTYPE_p_int value) {
+ swigfaissJNI.int_maxheap_array_t_val_set(swigCPtr, this, SWIGTYPE_p_int.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_int getVal() {
+ long cPtr = swigfaissJNI.int_maxheap_array_t_val_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public SWIGTYPE_p_int get_val(long key) {
+ long cPtr = swigfaissJNI.int_maxheap_array_t_get_val(swigCPtr, this, key);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public LongVector get_ids(long key) {
+ return new LongVector(swigfaissJNI.int_maxheap_array_t_get_ids(swigCPtr, this, key), false);
+}
+
+ public void heapify() {
+ swigfaissJNI.int_maxheap_array_t_heapify(swigCPtr, this);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0, long i0, long ni) {
+ swigfaissJNI.int_maxheap_array_t_addn__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0, i0, ni);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0, long i0) {
+ swigfaissJNI.int_maxheap_array_t_addn__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0, i0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0) {
+ swigfaissJNI.int_maxheap_array_t_addn__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin) {
+ swigfaissJNI.int_maxheap_array_t_addn__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin));
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride, long i0, long ni) {
+ swigfaissJNI.int_maxheap_array_t_addn_with_ids__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0, ni);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride, long i0) {
+ swigfaissJNI.int_maxheap_array_t_addn_with_ids__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride) {
+ swigfaissJNI.int_maxheap_array_t_addn_with_ids__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in) {
+ swigfaissJNI.int_maxheap_array_t_addn_with_ids__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin) {
+ swigfaissJNI.int_maxheap_array_t_addn_with_ids__SWIG_4(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin));
+ }
+
+ public void reorder() {
+ swigfaissJNI.int_maxheap_array_t_reorder(swigCPtr, this);
+ }
+
+ public void per_line_extrema(SWIGTYPE_p_int vals_out, LongVector idx_out) {
+ swigfaissJNI.int_maxheap_array_t_per_line_extrema(swigCPtr, this, SWIGTYPE_p_int.getCPtr(vals_out), SWIGTYPE_p_long_long.getCPtr(idx_out.data()), idx_out);
+ }
+
+ public int_maxheap_array_t() {
+ this(swigfaissJNI.new_int_maxheap_array_t(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/int_minheap_array_t.java b/ann/src/main/java/com/twitter/ann/faiss/swig/int_minheap_array_t.java
new file mode 100644
index 000000000..0a6064876
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/int_minheap_array_t.java
@@ -0,0 +1,133 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class int_minheap_array_t {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected int_minheap_array_t(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(int_minheap_array_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_int_minheap_array_t(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public void setNh(long value) {
+ swigfaissJNI.int_minheap_array_t_nh_set(swigCPtr, this, value);
+ }
+
+ public long getNh() {
+ return swigfaissJNI.int_minheap_array_t_nh_get(swigCPtr, this);
+ }
+
+ public void setK(long value) {
+ swigfaissJNI.int_minheap_array_t_k_set(swigCPtr, this, value);
+ }
+
+ public long getK() {
+ return swigfaissJNI.int_minheap_array_t_k_get(swigCPtr, this);
+ }
+
+ public void setIds(LongVector value) {
+ swigfaissJNI.int_minheap_array_t_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
+ }
+
+ public LongVector getIds() {
+ return new LongVector(swigfaissJNI.int_minheap_array_t_ids_get(swigCPtr, this), false);
+}
+
+ public void setVal(SWIGTYPE_p_int value) {
+ swigfaissJNI.int_minheap_array_t_val_set(swigCPtr, this, SWIGTYPE_p_int.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_int getVal() {
+ long cPtr = swigfaissJNI.int_minheap_array_t_val_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public SWIGTYPE_p_int get_val(long key) {
+ long cPtr = swigfaissJNI.int_minheap_array_t_get_val(swigCPtr, this, key);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public LongVector get_ids(long key) {
+ return new LongVector(swigfaissJNI.int_minheap_array_t_get_ids(swigCPtr, this, key), false);
+}
+
+ public void heapify() {
+ swigfaissJNI.int_minheap_array_t_heapify(swigCPtr, this);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0, long i0, long ni) {
+ swigfaissJNI.int_minheap_array_t_addn__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0, i0, ni);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0, long i0) {
+ swigfaissJNI.int_minheap_array_t_addn__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0, i0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin, long j0) {
+ swigfaissJNI.int_minheap_array_t_addn__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), j0);
+ }
+
+ public void addn(long nj, SWIGTYPE_p_int vin) {
+ swigfaissJNI.int_minheap_array_t_addn__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin));
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride, long i0, long ni) {
+ swigfaissJNI.int_minheap_array_t_addn_with_ids__SWIG_0(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0, ni);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride, long i0) {
+ swigfaissJNI.int_minheap_array_t_addn_with_ids__SWIG_1(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride, i0);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in, long id_stride) {
+ swigfaissJNI.int_minheap_array_t_addn_with_ids__SWIG_2(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in, id_stride);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin, LongVector id_in) {
+ swigfaissJNI.int_minheap_array_t_addn_with_ids__SWIG_3(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin), SWIGTYPE_p_long_long.getCPtr(id_in.data()), id_in);
+ }
+
+ public void addn_with_ids(long nj, SWIGTYPE_p_int vin) {
+ swigfaissJNI.int_minheap_array_t_addn_with_ids__SWIG_4(swigCPtr, this, nj, SWIGTYPE_p_int.getCPtr(vin));
+ }
+
+ public void reorder() {
+ swigfaissJNI.int_minheap_array_t_reorder(swigCPtr, this);
+ }
+
+ public void per_line_extrema(SWIGTYPE_p_int vals_out, LongVector idx_out) {
+ swigfaissJNI.int_minheap_array_t_per_line_extrema(swigCPtr, this, SWIGTYPE_p_int.getCPtr(vals_out), SWIGTYPE_p_long_long.getCPtr(idx_out.data()), idx_out);
+ }
+
+ public int_minheap_array_t() {
+ this(swigfaissJNI.new_int_minheap_array_t(), true);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/longArray.java b/ann/src/main/java/com/twitter/ann/faiss/swig/longArray.java
new file mode 100644
index 000000000..6d51d8fae
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/longArray.java
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class longArray {
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
+
+ protected longArray(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(longArray obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ swigfaissJNI.delete_longArray(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public longArray(int nelements) {
+ this(swigfaissJNI.new_longArray(nelements), true);
+ }
+
+ public long getitem(int index) {
+ return swigfaissJNI.longArray_getitem(swigCPtr, this, index);
+ }
+
+ public void setitem(int index, long value) {
+ swigfaissJNI.longArray_setitem(swigCPtr, this, index, value);
+ }
+
+ public SWIGTYPE_p_long_long cast() {
+ long cPtr = swigfaissJNI.longArray_cast(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_long_long(cPtr, false);
+ }
+
+ public static longArray frompointer(SWIGTYPE_p_long_long t) {
+ long cPtr = swigfaissJNI.longArray_frompointer(SWIGTYPE_p_long_long.getCPtr(t));
+ return (cPtr == 0) ? null : new longArray(cPtr, false);
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitignore b/ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitignore
new file mode 100644
index 000000000..caf63c285
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitignore
@@ -0,0 +1,7 @@
+*.so
+*.so.0
+*.so.1
+*.so.3
+*.so.5
+*.so.6
+*.dylib
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitkeep b/ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/resources/BUILD b/ann/src/main/java/com/twitter/ann/faiss/swig/resources/BUILD
new file mode 100644
index 000000000..58ba4703b
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/resources/BUILD
@@ -0,0 +1,17 @@
+resources(
+ name = "resources",
+ sources = [
+ "*.dylib",
+ "*.so",
+ "*.so.0",
+ "*.so.1",
+ "*.so.3",
+ "*.so.5",
+ "*.so.6",
+ ],
+ tags = [
+ "bazel-compatible",
+ "bazel-only",
+ "visibility://visibility:private",
+ ],
+)
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaiss.java b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaiss.java
new file mode 100644
index 000000000..d55793a69
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaiss.java
@@ -0,0 +1,575 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public class swigfaiss implements swigfaissConstants {
+ public static void bitvec_print(SWIGTYPE_p_unsigned_char b, long d) {
+ swigfaissJNI.bitvec_print(SWIGTYPE_p_unsigned_char.getCPtr(b), d);
+ }
+
+ public static void fvecs2bitvecs(SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char b, long d, long n) {
+ swigfaissJNI.fvecs2bitvecs(SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(b), d, n);
+ }
+
+ public static void bitvecs2fvecs(SWIGTYPE_p_unsigned_char b, SWIGTYPE_p_float x, long d, long n) {
+ swigfaissJNI.bitvecs2fvecs(SWIGTYPE_p_unsigned_char.getCPtr(b), SWIGTYPE_p_float.getCPtr(x), d, n);
+ }
+
+ public static void fvec2bitvec(SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char b, long d) {
+ swigfaissJNI.fvec2bitvec(SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(b), d);
+ }
+
+ public static void bitvec_shuffle(long n, long da, long db, SWIGTYPE_p_int order, SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b) {
+ swigfaissJNI.bitvec_shuffle(n, da, db, SWIGTYPE_p_int.getCPtr(order), SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b));
+ }
+
+ public static void setHamming_batch_size(long value) {
+ swigfaissJNI.hamming_batch_size_set(value);
+ }
+
+ public static long getHamming_batch_size() {
+ return swigfaissJNI.hamming_batch_size_get();
+ }
+
+ public static int popcount64(long x) {
+ return swigfaissJNI.popcount64(x);
+ }
+
+ public static void hammings(SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long na, long nb, long nbytespercode, SWIGTYPE_p_int dis) {
+ swigfaissJNI.hammings(SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), na, nb, nbytespercode, SWIGTYPE_p_int.getCPtr(dis));
+ }
+
+ public static void hammings_knn_hc(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t ha, SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long nb, long ncodes, int ordered) {
+ swigfaissJNI.hammings_knn_hc(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.getCPtr(ha), SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), nb, ncodes, ordered);
+ }
+
+ public static void hammings_knn(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t ha, SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long nb, long ncodes, int ordered) {
+ swigfaissJNI.hammings_knn(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.getCPtr(ha), SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), nb, ncodes, ordered);
+ }
+
+ public static void hammings_knn_mc(SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long na, long nb, long k, long ncodes, SWIGTYPE_p_int distances, LongVector labels) {
+ swigfaissJNI.hammings_knn_mc(SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), na, nb, k, ncodes, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
+ }
+
+ public static void hamming_range_search(SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long na, long nb, int radius, long ncodes, RangeSearchResult result) {
+ swigfaissJNI.hamming_range_search(SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), na, nb, radius, ncodes, RangeSearchResult.getCPtr(result), result);
+ }
+
+ public static void hamming_count_thres(SWIGTYPE_p_unsigned_char bs1, SWIGTYPE_p_unsigned_char bs2, long n1, long n2, int ht, long ncodes, SWIGTYPE_p_unsigned_long nptr) {
+ swigfaissJNI.hamming_count_thres(SWIGTYPE_p_unsigned_char.getCPtr(bs1), SWIGTYPE_p_unsigned_char.getCPtr(bs2), n1, n2, ht, ncodes, SWIGTYPE_p_unsigned_long.getCPtr(nptr));
+ }
+
+ public static long match_hamming_thres(SWIGTYPE_p_unsigned_char bs1, SWIGTYPE_p_unsigned_char bs2, long n1, long n2, int ht, long ncodes, LongVector idx, SWIGTYPE_p_int dis) {
+ return swigfaissJNI.match_hamming_thres(SWIGTYPE_p_unsigned_char.getCPtr(bs1), SWIGTYPE_p_unsigned_char.getCPtr(bs2), n1, n2, ht, ncodes, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_int.getCPtr(dis));
+ }
+
+ public static void crosshamming_count_thres(SWIGTYPE_p_unsigned_char dbs, long n, int ht, long ncodes, SWIGTYPE_p_unsigned_long nptr) {
+ swigfaissJNI.crosshamming_count_thres(SWIGTYPE_p_unsigned_char.getCPtr(dbs), n, ht, ncodes, SWIGTYPE_p_unsigned_long.getCPtr(nptr));
+ }
+
+ public static int get_num_gpus() {
+ return swigfaissJNI.get_num_gpus();
+ }
+
+ public static String get_compile_options() {
+ return swigfaissJNI.get_compile_options();
+ }
+
+ public static double getmillisecs() {
+ return swigfaissJNI.getmillisecs();
+ }
+
+ public static long get_mem_usage_kb() {
+ return swigfaissJNI.get_mem_usage_kb();
+ }
+
+ public static long get_cycles() {
+ return swigfaissJNI.get_cycles();
+ }
+
+ public static void fvec_madd(long n, SWIGTYPE_p_float a, float bf, SWIGTYPE_p_float b, SWIGTYPE_p_float c) {
+ swigfaissJNI.fvec_madd(n, SWIGTYPE_p_float.getCPtr(a), bf, SWIGTYPE_p_float.getCPtr(b), SWIGTYPE_p_float.getCPtr(c));
+ }
+
+ public static int fvec_madd_and_argmin(long n, SWIGTYPE_p_float a, float bf, SWIGTYPE_p_float b, SWIGTYPE_p_float c) {
+ return swigfaissJNI.fvec_madd_and_argmin(n, SWIGTYPE_p_float.getCPtr(a), bf, SWIGTYPE_p_float.getCPtr(b), SWIGTYPE_p_float.getCPtr(c));
+ }
+
+ public static void reflection(SWIGTYPE_p_float u, SWIGTYPE_p_float x, long n, long d, long nu) {
+ swigfaissJNI.reflection(SWIGTYPE_p_float.getCPtr(u), SWIGTYPE_p_float.getCPtr(x), n, d, nu);
+ }
+
+ public static void matrix_qr(int m, int n, SWIGTYPE_p_float a) {
+ swigfaissJNI.matrix_qr(m, n, SWIGTYPE_p_float.getCPtr(a));
+ }
+
+ public static void ranklist_handle_ties(int k, LongVector idx, SWIGTYPE_p_float dis) {
+ swigfaissJNI.ranklist_handle_ties(k, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_float.getCPtr(dis));
+ }
+
+ public static long ranklist_intersection_size(long k1, LongVector v1, long k2, LongVector v2) {
+ return swigfaissJNI.ranklist_intersection_size(k1, SWIGTYPE_p_long_long.getCPtr(v1.data()), v1, k2, SWIGTYPE_p_long_long.getCPtr(v2.data()), v2);
+ }
+
+ public static long merge_result_table_with(long n, long k, LongVector I0, SWIGTYPE_p_float D0, LongVector I1, SWIGTYPE_p_float D1, boolean keep_min, long translation) {
+ return swigfaissJNI.merge_result_table_with__SWIG_0(n, k, SWIGTYPE_p_long_long.getCPtr(I0.data()), I0, SWIGTYPE_p_float.getCPtr(D0), SWIGTYPE_p_long_long.getCPtr(I1.data()), I1, SWIGTYPE_p_float.getCPtr(D1), keep_min, translation);
+ }
+
+ public static long merge_result_table_with(long n, long k, LongVector I0, SWIGTYPE_p_float D0, LongVector I1, SWIGTYPE_p_float D1, boolean keep_min) {
+ return swigfaissJNI.merge_result_table_with__SWIG_1(n, k, SWIGTYPE_p_long_long.getCPtr(I0.data()), I0, SWIGTYPE_p_float.getCPtr(D0), SWIGTYPE_p_long_long.getCPtr(I1.data()), I1, SWIGTYPE_p_float.getCPtr(D1), keep_min);
+ }
+
+ public static long merge_result_table_with(long n, long k, LongVector I0, SWIGTYPE_p_float D0, LongVector I1, SWIGTYPE_p_float D1) {
+ return swigfaissJNI.merge_result_table_with__SWIG_2(n, k, SWIGTYPE_p_long_long.getCPtr(I0.data()), I0, SWIGTYPE_p_float.getCPtr(D0), SWIGTYPE_p_long_long.getCPtr(I1.data()), I1, SWIGTYPE_p_float.getCPtr(D1));
+ }
+
+ public static double imbalance_factor(int n, int k, LongVector assign) {
+ return swigfaissJNI.imbalance_factor__SWIG_0(n, k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign);
+ }
+
+ public static double imbalance_factor(int k, SWIGTYPE_p_int hist) {
+ return swigfaissJNI.imbalance_factor__SWIG_1(k, SWIGTYPE_p_int.getCPtr(hist));
+ }
+
+ public static void fvec_argsort(long n, SWIGTYPE_p_float vals, SWIGTYPE_p_unsigned_long perm) {
+ swigfaissJNI.fvec_argsort(n, SWIGTYPE_p_float.getCPtr(vals), SWIGTYPE_p_unsigned_long.getCPtr(perm));
+ }
+
+ public static void fvec_argsort_parallel(long n, SWIGTYPE_p_float vals, SWIGTYPE_p_unsigned_long perm) {
+ swigfaissJNI.fvec_argsort_parallel(n, SWIGTYPE_p_float.getCPtr(vals), SWIGTYPE_p_unsigned_long.getCPtr(perm));
+ }
+
+ public static int ivec_hist(long n, SWIGTYPE_p_int v, int vmax, SWIGTYPE_p_int hist) {
+ return swigfaissJNI.ivec_hist(n, SWIGTYPE_p_int.getCPtr(v), vmax, SWIGTYPE_p_int.getCPtr(hist));
+ }
+
+ public static void bincode_hist(long n, long nbits, SWIGTYPE_p_unsigned_char codes, SWIGTYPE_p_int hist) {
+ swigfaissJNI.bincode_hist(n, nbits, SWIGTYPE_p_unsigned_char.getCPtr(codes), SWIGTYPE_p_int.getCPtr(hist));
+ }
+
+ public static long ivec_checksum(long n, SWIGTYPE_p_int a) {
+ return swigfaissJNI.ivec_checksum(n, SWIGTYPE_p_int.getCPtr(a));
+ }
+
+ public static SWIGTYPE_p_float fvecs_maybe_subsample(long d, SWIGTYPE_p_unsigned_long n, long nmax, SWIGTYPE_p_float x, boolean verbose, long seed) {
+ long cPtr = swigfaissJNI.fvecs_maybe_subsample__SWIG_0(d, SWIGTYPE_p_unsigned_long.getCPtr(n), nmax, SWIGTYPE_p_float.getCPtr(x), verbose, seed);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public static SWIGTYPE_p_float fvecs_maybe_subsample(long d, SWIGTYPE_p_unsigned_long n, long nmax, SWIGTYPE_p_float x, boolean verbose) {
+ long cPtr = swigfaissJNI.fvecs_maybe_subsample__SWIG_1(d, SWIGTYPE_p_unsigned_long.getCPtr(n), nmax, SWIGTYPE_p_float.getCPtr(x), verbose);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public static SWIGTYPE_p_float fvecs_maybe_subsample(long d, SWIGTYPE_p_unsigned_long n, long nmax, SWIGTYPE_p_float x) {
+ long cPtr = swigfaissJNI.fvecs_maybe_subsample__SWIG_2(d, SWIGTYPE_p_unsigned_long.getCPtr(n), nmax, SWIGTYPE_p_float.getCPtr(x));
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public static void binary_to_real(long d, SWIGTYPE_p_unsigned_char x_in, SWIGTYPE_p_float x_out) {
+ swigfaissJNI.binary_to_real(d, SWIGTYPE_p_unsigned_char.getCPtr(x_in), SWIGTYPE_p_float.getCPtr(x_out));
+ }
+
+ public static void real_to_binary(long d, SWIGTYPE_p_float x_in, SWIGTYPE_p_unsigned_char x_out) {
+ swigfaissJNI.real_to_binary(d, SWIGTYPE_p_float.getCPtr(x_in), SWIGTYPE_p_unsigned_char.getCPtr(x_out));
+ }
+
+ public static long hash_bytes(SWIGTYPE_p_unsigned_char bytes, long n) {
+ return swigfaissJNI.hash_bytes(SWIGTYPE_p_unsigned_char.getCPtr(bytes), n);
+ }
+
+ public static boolean check_openmp() {
+ return swigfaissJNI.check_openmp();
+ }
+
+ public static float kmeans_clustering(long d, long n, long k, SWIGTYPE_p_float x, SWIGTYPE_p_float centroids) {
+ return swigfaissJNI.kmeans_clustering(d, n, k, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(centroids));
+ }
+
+ public static void setIndexPQ_stats(IndexPQStats value) {
+ swigfaissJNI.indexPQ_stats_set(IndexPQStats.getCPtr(value), value);
+ }
+
+ public static IndexPQStats getIndexPQ_stats() {
+ long cPtr = swigfaissJNI.indexPQ_stats_get();
+ return (cPtr == 0) ? null : new IndexPQStats(cPtr, false);
+ }
+
+ public static void setIndexIVF_stats(IndexIVFStats value) {
+ swigfaissJNI.indexIVF_stats_set(IndexIVFStats.getCPtr(value), value);
+ }
+
+ public static IndexIVFStats getIndexIVF_stats() {
+ long cPtr = swigfaissJNI.indexIVF_stats_get();
+ return (cPtr == 0) ? null : new IndexIVFStats(cPtr, false);
+ }
+
+ public static short[] getHamdis_tab_ham_bytes() {
+ return swigfaissJNI.hamdis_tab_ham_bytes_get();
+ }
+
+ public static int generalized_hamming_64(long a) {
+ return swigfaissJNI.generalized_hamming_64(a);
+ }
+
+ public static void generalized_hammings_knn_hc(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t ha, SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long nb, long code_size, int ordered) {
+ swigfaissJNI.generalized_hammings_knn_hc__SWIG_0(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.getCPtr(ha), SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), nb, code_size, ordered);
+ }
+
+ public static void generalized_hammings_knn_hc(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t ha, SWIGTYPE_p_unsigned_char a, SWIGTYPE_p_unsigned_char b, long nb, long code_size) {
+ swigfaissJNI.generalized_hammings_knn_hc__SWIG_1(SWIGTYPE_p_faiss__HeapArrayT_faiss__CMaxT_int_int64_t_t_t.getCPtr(ha), SWIGTYPE_p_unsigned_char.getCPtr(a), SWIGTYPE_p_unsigned_char.getCPtr(b), nb, code_size);
+ }
+
+ public static void check_compatible_for_merge(Index index1, Index index2) {
+ swigfaissJNI.check_compatible_for_merge(Index.getCPtr(index1), index1, Index.getCPtr(index2), index2);
+ }
+
+ public static IndexIVF extract_index_ivf(Index index) {
+ long cPtr = swigfaissJNI.extract_index_ivf__SWIG_0(Index.getCPtr(index), index);
+ return (cPtr == 0) ? null : new IndexIVF(cPtr, false);
+ }
+
+ public static IndexIVF try_extract_index_ivf(Index index) {
+ long cPtr = swigfaissJNI.try_extract_index_ivf__SWIG_0(Index.getCPtr(index), index);
+ return (cPtr == 0) ? null : new IndexIVF(cPtr, false);
+ }
+
+ public static void merge_into(Index index0, Index index1, boolean shift_ids) {
+ swigfaissJNI.merge_into(Index.getCPtr(index0), index0, Index.getCPtr(index1), index1, shift_ids);
+ }
+
+ public static void search_centroid(Index index, SWIGTYPE_p_float x, int n, LongVector centroid_ids) {
+ swigfaissJNI.search_centroid(Index.getCPtr(index), index, SWIGTYPE_p_float.getCPtr(x), n, SWIGTYPE_p_long_long.getCPtr(centroid_ids.data()), centroid_ids);
+ }
+
+ public static void search_and_return_centroids(Index index, long n, SWIGTYPE_p_float xin, int k, SWIGTYPE_p_float distances, LongVector labels, LongVector query_centroid_ids, LongVector result_centroid_ids) {
+ swigfaissJNI.search_and_return_centroids(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(xin), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_long_long.getCPtr(query_centroid_ids.data()), query_centroid_ids, SWIGTYPE_p_long_long.getCPtr(result_centroid_ids.data()), result_centroid_ids);
+ }
+
+ public static ArrayInvertedLists get_invlist_range(Index index, int i0, int i1) {
+ long cPtr = swigfaissJNI.get_invlist_range(Index.getCPtr(index), index, i0, i1);
+ return (cPtr == 0) ? null : new ArrayInvertedLists(cPtr, false);
+ }
+
+ public static void set_invlist_range(Index index, int i0, int i1, ArrayInvertedLists src) {
+ swigfaissJNI.set_invlist_range(Index.getCPtr(index), index, i0, i1, ArrayInvertedLists.getCPtr(src), src);
+ }
+
+ public static void search_with_parameters(Index index, long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, IVFSearchParameters params, SWIGTYPE_p_unsigned_long nb_dis, SWIGTYPE_p_double ms_per_stage) {
+ swigfaissJNI.search_with_parameters__SWIG_0(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, IVFSearchParameters.getCPtr(params), params, SWIGTYPE_p_unsigned_long.getCPtr(nb_dis), SWIGTYPE_p_double.getCPtr(ms_per_stage));
+ }
+
+ public static void search_with_parameters(Index index, long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, IVFSearchParameters params, SWIGTYPE_p_unsigned_long nb_dis) {
+ swigfaissJNI.search_with_parameters__SWIG_1(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, IVFSearchParameters.getCPtr(params), params, SWIGTYPE_p_unsigned_long.getCPtr(nb_dis));
+ }
+
+ public static void search_with_parameters(Index index, long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, IVFSearchParameters params) {
+ swigfaissJNI.search_with_parameters__SWIG_2(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public static void range_search_with_parameters(Index index, long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result, IVFSearchParameters params, SWIGTYPE_p_unsigned_long nb_dis, SWIGTYPE_p_double ms_per_stage) {
+ swigfaissJNI.range_search_with_parameters__SWIG_0(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result, IVFSearchParameters.getCPtr(params), params, SWIGTYPE_p_unsigned_long.getCPtr(nb_dis), SWIGTYPE_p_double.getCPtr(ms_per_stage));
+ }
+
+ public static void range_search_with_parameters(Index index, long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result, IVFSearchParameters params, SWIGTYPE_p_unsigned_long nb_dis) {
+ swigfaissJNI.range_search_with_parameters__SWIG_1(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result, IVFSearchParameters.getCPtr(params), params, SWIGTYPE_p_unsigned_long.getCPtr(nb_dis));
+ }
+
+ public static void range_search_with_parameters(Index index, long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result, IVFSearchParameters params) {
+ swigfaissJNI.range_search_with_parameters__SWIG_2(Index.getCPtr(index), index, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result, IVFSearchParameters.getCPtr(params), params);
+ }
+
+ public static void setHnsw_stats(HNSWStats value) {
+ swigfaissJNI.hnsw_stats_set(HNSWStats.getCPtr(value), value);
+ }
+
+ public static HNSWStats getHnsw_stats() {
+ long cPtr = swigfaissJNI.hnsw_stats_get();
+ return (cPtr == 0) ? null : new HNSWStats(cPtr, false);
+ }
+
+ public static void setPrecomputed_table_max_bytes(long value) {
+ swigfaissJNI.precomputed_table_max_bytes_set(value);
+ }
+
+ public static long getPrecomputed_table_max_bytes() {
+ return swigfaissJNI.precomputed_table_max_bytes_get();
+ }
+
+ public static void initialize_IVFPQ_precomputed_table(SWIGTYPE_p_int use_precomputed_table, Index quantizer, ProductQuantizer pq, SWIGTYPE_p_AlignedTableT_float_32_t precomputed_table, boolean verbose) {
+ swigfaissJNI.initialize_IVFPQ_precomputed_table(SWIGTYPE_p_int.getCPtr(use_precomputed_table), Index.getCPtr(quantizer), quantizer, ProductQuantizer.getCPtr(pq), pq, SWIGTYPE_p_AlignedTableT_float_32_t.getCPtr(precomputed_table), verbose);
+ }
+
+ public static void setIndexIVFPQ_stats(IndexIVFPQStats value) {
+ swigfaissJNI.indexIVFPQ_stats_set(IndexIVFPQStats.getCPtr(value), value);
+ }
+
+ public static IndexIVFPQStats getIndexIVFPQ_stats() {
+ long cPtr = swigfaissJNI.indexIVFPQ_stats_get();
+ return (cPtr == 0) ? null : new IndexIVFPQStats(cPtr, false);
+ }
+
+ public static Index downcast_index(Index index) {
+ long cPtr = swigfaissJNI.downcast_index(Index.getCPtr(index), index);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public static VectorTransform downcast_VectorTransform(VectorTransform vt) {
+ long cPtr = swigfaissJNI.downcast_VectorTransform(VectorTransform.getCPtr(vt), vt);
+ return (cPtr == 0) ? null : new VectorTransform(cPtr, false);
+ }
+
+ public static IndexBinary downcast_IndexBinary(IndexBinary index) {
+ long cPtr = swigfaissJNI.downcast_IndexBinary(IndexBinary.getCPtr(index), index);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, false);
+ }
+
+ public static Index upcast_IndexShards(IndexShards index) {
+ long cPtr = swigfaissJNI.upcast_IndexShards(IndexShards.getCPtr(index), index);
+ return (cPtr == 0) ? null : new Index(cPtr, false);
+ }
+
+ public static void write_index(Index idx, String fname) {
+ swigfaissJNI.write_index__SWIG_0(Index.getCPtr(idx), idx, fname);
+ }
+
+ public static void write_index(Index idx, SWIGTYPE_p_FILE f) {
+ swigfaissJNI.write_index__SWIG_1(Index.getCPtr(idx), idx, SWIGTYPE_p_FILE.getCPtr(f));
+ }
+
+ public static void write_index(Index idx, SWIGTYPE_p_faiss__IOWriter writer) {
+ swigfaissJNI.write_index__SWIG_2(Index.getCPtr(idx), idx, SWIGTYPE_p_faiss__IOWriter.getCPtr(writer));
+ }
+
+ public static void write_index_binary(IndexBinary idx, String fname) {
+ swigfaissJNI.write_index_binary__SWIG_0(IndexBinary.getCPtr(idx), idx, fname);
+ }
+
+ public static void write_index_binary(IndexBinary idx, SWIGTYPE_p_FILE f) {
+ swigfaissJNI.write_index_binary__SWIG_1(IndexBinary.getCPtr(idx), idx, SWIGTYPE_p_FILE.getCPtr(f));
+ }
+
+ public static void write_index_binary(IndexBinary idx, SWIGTYPE_p_faiss__IOWriter writer) {
+ swigfaissJNI.write_index_binary__SWIG_2(IndexBinary.getCPtr(idx), idx, SWIGTYPE_p_faiss__IOWriter.getCPtr(writer));
+ }
+
+ public static int getIO_FLAG_READ_ONLY() {
+ return swigfaissJNI.IO_FLAG_READ_ONLY_get();
+ }
+
+ public static int getIO_FLAG_ONDISK_SAME_DIR() {
+ return swigfaissJNI.IO_FLAG_ONDISK_SAME_DIR_get();
+ }
+
+ public static int getIO_FLAG_SKIP_IVF_DATA() {
+ return swigfaissJNI.IO_FLAG_SKIP_IVF_DATA_get();
+ }
+
+ public static int getIO_FLAG_MMAP() {
+ return swigfaissJNI.IO_FLAG_MMAP_get();
+ }
+
+ public static Index read_index(String fname, int io_flags) {
+ long cPtr = swigfaissJNI.read_index__SWIG_0(fname, io_flags);
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index read_index(String fname) {
+ long cPtr = swigfaissJNI.read_index__SWIG_1(fname);
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index read_index(SWIGTYPE_p_FILE f, int io_flags) {
+ long cPtr = swigfaissJNI.read_index__SWIG_2(SWIGTYPE_p_FILE.getCPtr(f), io_flags);
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index read_index(SWIGTYPE_p_FILE f) {
+ long cPtr = swigfaissJNI.read_index__SWIG_3(SWIGTYPE_p_FILE.getCPtr(f));
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index read_index(SWIGTYPE_p_faiss__IOReader reader, int io_flags) {
+ long cPtr = swigfaissJNI.read_index__SWIG_4(SWIGTYPE_p_faiss__IOReader.getCPtr(reader), io_flags);
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index read_index(SWIGTYPE_p_faiss__IOReader reader) {
+ long cPtr = swigfaissJNI.read_index__SWIG_5(SWIGTYPE_p_faiss__IOReader.getCPtr(reader));
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(String fname, int io_flags) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_0(fname, io_flags);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(String fname) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_1(fname);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(SWIGTYPE_p_FILE f, int io_flags) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_2(SWIGTYPE_p_FILE.getCPtr(f), io_flags);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(SWIGTYPE_p_FILE f) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_3(SWIGTYPE_p_FILE.getCPtr(f));
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(SWIGTYPE_p_faiss__IOReader reader, int io_flags) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_4(SWIGTYPE_p_faiss__IOReader.getCPtr(reader), io_flags);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static IndexBinary read_index_binary(SWIGTYPE_p_faiss__IOReader reader) {
+ long cPtr = swigfaissJNI.read_index_binary__SWIG_5(SWIGTYPE_p_faiss__IOReader.getCPtr(reader));
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static void write_VectorTransform(VectorTransform vt, String fname) {
+ swigfaissJNI.write_VectorTransform(VectorTransform.getCPtr(vt), vt, fname);
+ }
+
+ public static VectorTransform read_VectorTransform(String fname) {
+ long cPtr = swigfaissJNI.read_VectorTransform(fname);
+ return (cPtr == 0) ? null : new VectorTransform(cPtr, true);
+ }
+
+ public static ProductQuantizer read_ProductQuantizer(String fname) {
+ long cPtr = swigfaissJNI.read_ProductQuantizer__SWIG_0(fname);
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, true);
+ }
+
+ public static ProductQuantizer read_ProductQuantizer(SWIGTYPE_p_faiss__IOReader reader) {
+ long cPtr = swigfaissJNI.read_ProductQuantizer__SWIG_1(SWIGTYPE_p_faiss__IOReader.getCPtr(reader));
+ return (cPtr == 0) ? null : new ProductQuantizer(cPtr, true);
+ }
+
+ public static void write_ProductQuantizer(ProductQuantizer pq, String fname) {
+ swigfaissJNI.write_ProductQuantizer__SWIG_0(ProductQuantizer.getCPtr(pq), pq, fname);
+ }
+
+ public static void write_ProductQuantizer(ProductQuantizer pq, SWIGTYPE_p_faiss__IOWriter f) {
+ swigfaissJNI.write_ProductQuantizer__SWIG_1(ProductQuantizer.getCPtr(pq), pq, SWIGTYPE_p_faiss__IOWriter.getCPtr(f));
+ }
+
+ public static void write_InvertedLists(InvertedLists ils, SWIGTYPE_p_faiss__IOWriter f) {
+ swigfaissJNI.write_InvertedLists(InvertedLists.getCPtr(ils), ils, SWIGTYPE_p_faiss__IOWriter.getCPtr(f));
+ }
+
+ public static InvertedLists read_InvertedLists(SWIGTYPE_p_faiss__IOReader reader, int io_flags) {
+ long cPtr = swigfaissJNI.read_InvertedLists__SWIG_0(SWIGTYPE_p_faiss__IOReader.getCPtr(reader), io_flags);
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public static InvertedLists read_InvertedLists(SWIGTYPE_p_faiss__IOReader reader) {
+ long cPtr = swigfaissJNI.read_InvertedLists__SWIG_1(SWIGTYPE_p_faiss__IOReader.getCPtr(reader));
+ return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
+ }
+
+ public static Index index_factory(int d, String description, MetricType metric) {
+ long cPtr = swigfaissJNI.index_factory__SWIG_0(d, description, metric.swigValue());
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static Index index_factory(int d, String description) {
+ long cPtr = swigfaissJNI.index_factory__SWIG_1(d, description);
+ return (cPtr == 0) ? null : new Index(cPtr, true);
+ }
+
+ public static void setIndex_factory_verbose(int value) {
+ swigfaissJNI.index_factory_verbose_set(value);
+ }
+
+ public static int getIndex_factory_verbose() {
+ return swigfaissJNI.index_factory_verbose_get();
+ }
+
+ public static IndexBinary index_binary_factory(int d, String description) {
+ long cPtr = swigfaissJNI.index_binary_factory(d, description);
+ return (cPtr == 0) ? null : new IndexBinary(cPtr, true);
+ }
+
+ public static void simd_histogram_8(SWIGTYPE_p_uint16_t data, int n, SWIGTYPE_p_uint16_t min, int shift, SWIGTYPE_p_int hist) {
+ swigfaissJNI.simd_histogram_8(SWIGTYPE_p_uint16_t.getCPtr(data), n, SWIGTYPE_p_uint16_t.getCPtr(min), shift, SWIGTYPE_p_int.getCPtr(hist));
+ }
+
+ public static void simd_histogram_16(SWIGTYPE_p_uint16_t data, int n, SWIGTYPE_p_uint16_t min, int shift, SWIGTYPE_p_int hist) {
+ swigfaissJNI.simd_histogram_16(SWIGTYPE_p_uint16_t.getCPtr(data), n, SWIGTYPE_p_uint16_t.getCPtr(min), shift, SWIGTYPE_p_int.getCPtr(hist));
+ }
+
+ public static void setPartition_stats(PartitionStats value) {
+ swigfaissJNI.partition_stats_set(PartitionStats.getCPtr(value), value);
+ }
+
+ public static PartitionStats getPartition_stats() {
+ long cPtr = swigfaissJNI.partition_stats_get();
+ return (cPtr == 0) ? null : new PartitionStats(cPtr, false);
+ }
+
+ public static float CMin_float_partition_fuzzy(SWIGTYPE_p_float vals, LongVector ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return swigfaissJNI.CMin_float_partition_fuzzy(SWIGTYPE_p_float.getCPtr(vals), SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out));
+ }
+
+ public static float CMax_float_partition_fuzzy(SWIGTYPE_p_float vals, LongVector ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return swigfaissJNI.CMax_float_partition_fuzzy(SWIGTYPE_p_float.getCPtr(vals), SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out));
+ }
+
+ public static SWIGTYPE_p_uint16_t CMax_uint16_partition_fuzzy(SWIGTYPE_p_uint16_t vals, LongVector ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return new SWIGTYPE_p_uint16_t(swigfaissJNI.CMax_uint16_partition_fuzzy__SWIG_0(SWIGTYPE_p_uint16_t.getCPtr(vals), SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out)), true);
+ }
+
+ public static SWIGTYPE_p_uint16_t CMin_uint16_partition_fuzzy(SWIGTYPE_p_uint16_t vals, LongVector ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return new SWIGTYPE_p_uint16_t(swigfaissJNI.CMin_uint16_partition_fuzzy__SWIG_0(SWIGTYPE_p_uint16_t.getCPtr(vals), SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out)), true);
+ }
+
+ public static SWIGTYPE_p_uint16_t CMax_uint16_partition_fuzzy(SWIGTYPE_p_uint16_t vals, SWIGTYPE_p_int ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return new SWIGTYPE_p_uint16_t(swigfaissJNI.CMax_uint16_partition_fuzzy__SWIG_1(SWIGTYPE_p_uint16_t.getCPtr(vals), SWIGTYPE_p_int.getCPtr(ids), n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out)), true);
+ }
+
+ public static SWIGTYPE_p_uint16_t CMin_uint16_partition_fuzzy(SWIGTYPE_p_uint16_t vals, SWIGTYPE_p_int ids, long n, long q_min, long q_max, SWIGTYPE_p_unsigned_long q_out) {
+ return new SWIGTYPE_p_uint16_t(swigfaissJNI.CMin_uint16_partition_fuzzy__SWIG_1(SWIGTYPE_p_uint16_t.getCPtr(vals), SWIGTYPE_p_int.getCPtr(ids), n, q_min, q_max, SWIGTYPE_p_unsigned_long.getCPtr(q_out)), true);
+ }
+
+ public static void omp_set_num_threads(int num_threads) {
+ swigfaissJNI.omp_set_num_threads(num_threads);
+ }
+
+ public static int omp_get_max_threads() {
+ return swigfaissJNI.omp_get_max_threads();
+ }
+
+ public static SWIGTYPE_p_void memcpy(SWIGTYPE_p_void dest, SWIGTYPE_p_void src, long n) {
+ long cPtr = swigfaissJNI.memcpy(SWIGTYPE_p_void.getCPtr(dest), SWIGTYPE_p_void.getCPtr(src), n);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
+ }
+
+ public static SWIGTYPE_p_float cast_integer_to_float_ptr(int x) {
+ long cPtr = swigfaissJNI.cast_integer_to_float_ptr(x);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
+ }
+
+ public static SWIGTYPE_p_long cast_integer_to_long_ptr(int x) {
+ long cPtr = swigfaissJNI.cast_integer_to_long_ptr(x);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_long(cPtr, false);
+ }
+
+ public static SWIGTYPE_p_int cast_integer_to_int_ptr(int x) {
+ long cPtr = swigfaissJNI.cast_integer_to_int_ptr(x);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
+ }
+
+ public static void ignore_SIGTTIN() {
+ swigfaissJNI.ignore_SIGTTIN();
+ }
+
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissConstants.java b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissConstants.java
new file mode 100644
index 000000000..30ba6abc3
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissConstants.java
@@ -0,0 +1,15 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+
+public interface swigfaissConstants {
+ public final static int FAISS_VERSION_MAJOR = swigfaissJNI.FAISS_VERSION_MAJOR_get();
+ public final static int FAISS_VERSION_MINOR = swigfaissJNI.FAISS_VERSION_MINOR_get();
+ public final static int FAISS_VERSION_PATCH = swigfaissJNI.FAISS_VERSION_PATCH_get();
+}
diff --git a/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissJNI.java b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissJNI.java
new file mode 100644
index 000000000..9a5c19bea
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/faiss/swig/swigfaissJNI.java
@@ -0,0 +1,2147 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 4.0.2
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.twitter.ann.faiss;
+import com.twitter.ann.faiss.NativeUtils;
+public class swigfaissJNI {
+
+ static {
+ try {
+ if (NativeUtils.getOperatingSystemType() == NativeUtils.OSType.MacOS) {
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/swigfaiss.dylib");
+ } else {
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/libstdc++.so.6");
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/libgcc_s.so.1");
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/libgomp.so.1");
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/libquadmath.so.0");
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/libgfortran.so.5");
+ NativeUtils.loadLibraryFromJar("/com/twitter/ann/faiss/swig/resources/swigfaiss.so");
+ }
+ } catch (Exception e) {
+ System.err.println("Native code library failed to load. \n" + e);
+ System.exit(1);
+ }
+ }
+
+ public final static native long new_intArray(int jarg1);
+ public final static native void delete_intArray(long jarg1);
+ public final static native int intArray_getitem(long jarg1, intArray jarg1_, int jarg2);
+ public final static native void intArray_setitem(long jarg1, intArray jarg1_, int jarg2, int jarg3);
+ public final static native long intArray_cast(long jarg1, intArray jarg1_);
+ public final static native long intArray_frompointer(long jarg1);
+ public final static native long new_floatArray(int jarg1);
+ public final static native void delete_floatArray(long jarg1);
+ public final static native float floatArray_getitem(long jarg1, floatArray jarg1_, int jarg2);
+ public final static native void floatArray_setitem(long jarg1, floatArray jarg1_, int jarg2, float jarg3);
+ public final static native long floatArray_cast(long jarg1, floatArray jarg1_);
+ public final static native long floatArray_frompointer(long jarg1);
+ public final static native long new_longArray(int jarg1);
+ public final static native void delete_longArray(long jarg1);
+ public final static native long longArray_getitem(long jarg1, longArray jarg1_, int jarg2);
+ public final static native void longArray_setitem(long jarg1, longArray jarg1_, int jarg2, long jarg3);
+ public final static native long longArray_cast(long jarg1, longArray jarg1_);
+ public final static native long longArray_frompointer(long jarg1);
+ public final static native long new_doubleArray(int jarg1);
+ public final static native void delete_doubleArray(long jarg1);
+ public final static native double doubleArray_getitem(long jarg1, doubleArray jarg1_, int jarg2);
+ public final static native void doubleArray_setitem(long jarg1, doubleArray jarg1_, int jarg2, double jarg3);
+ public final static native long doubleArray_cast(long jarg1, doubleArray jarg1_);
+ public final static native long doubleArray_frompointer(long jarg1);
+ public final static native long new_FloatVector();
+ public final static native void FloatVector_push_back(long jarg1, FloatVector jarg1_, float jarg2);
+ public final static native void FloatVector_clear(long jarg1, FloatVector jarg1_);
+ public final static native long FloatVector_data(long jarg1, FloatVector jarg1_);
+ public final static native long FloatVector_size(long jarg1, FloatVector jarg1_);
+ public final static native float FloatVector_at(long jarg1, FloatVector jarg1_, long jarg2);
+ public final static native void FloatVector_resize(long jarg1, FloatVector jarg1_, long jarg2);
+ public final static native void FloatVector_reserve(long jarg1, FloatVector jarg1_, long jarg2);
+ public final static native void FloatVector_swap(long jarg1, FloatVector jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native void delete_FloatVector(long jarg1);
+ public final static native long new_DoubleVector();
+ public final static native void DoubleVector_push_back(long jarg1, DoubleVector jarg1_, double jarg2);
+ public final static native void DoubleVector_clear(long jarg1, DoubleVector jarg1_);
+ public final static native long DoubleVector_data(long jarg1, DoubleVector jarg1_);
+ public final static native long DoubleVector_size(long jarg1, DoubleVector jarg1_);
+ public final static native double DoubleVector_at(long jarg1, DoubleVector jarg1_, long jarg2);
+ public final static native void DoubleVector_resize(long jarg1, DoubleVector jarg1_, long jarg2);
+ public final static native void DoubleVector_reserve(long jarg1, DoubleVector jarg1_, long jarg2);
+ public final static native void DoubleVector_swap(long jarg1, DoubleVector jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native void delete_DoubleVector(long jarg1);
+ public final static native long new_ByteVector();
+ public final static native void ByteVector_push_back(long jarg1, ByteVector jarg1_, short jarg2);
+ public final static native void ByteVector_clear(long jarg1, ByteVector jarg1_);
+ public final static native long ByteVector_data(long jarg1, ByteVector jarg1_);
+ public final static native long ByteVector_size(long jarg1, ByteVector jarg1_);
+ public final static native short ByteVector_at(long jarg1, ByteVector jarg1_, long jarg2);
+ public final static native void ByteVector_resize(long jarg1, ByteVector jarg1_, long jarg2);
+ public final static native void ByteVector_reserve(long jarg1, ByteVector jarg1_, long jarg2);
+ public final static native void ByteVector_swap(long jarg1, ByteVector jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native void delete_ByteVector(long jarg1);
+ public final static native long new_CharVector();
+ public final static native void CharVector_push_back(long jarg1, CharVector jarg1_, char jarg2);
+ public final static native void CharVector_clear(long jarg1, CharVector jarg1_);
+ public final static native String CharVector_data(long jarg1, CharVector jarg1_);
+ public final static native long CharVector_size(long jarg1, CharVector jarg1_);
+ public final static native char CharVector_at(long jarg1, CharVector jarg1_, long jarg2);
+ public final static native void CharVector_resize(long jarg1, CharVector jarg1_, long jarg2);
+ public final static native void CharVector_reserve(long jarg1, CharVector jarg1_, long jarg2);
+ public final static native void CharVector_swap(long jarg1, CharVector jarg1_, long jarg2, CharVector jarg2_);
+ public final static native void delete_CharVector(long jarg1);
+ public final static native long new_Uint64Vector();
+ public final static native void Uint64Vector_push_back(long jarg1, Uint64Vector jarg1_, long jarg2);
+ public final static native void Uint64Vector_clear(long jarg1, Uint64Vector jarg1_);
+ public final static native long Uint64Vector_data(long jarg1, Uint64Vector jarg1_);
+ public final static native long Uint64Vector_size(long jarg1, Uint64Vector jarg1_);
+ public final static native long Uint64Vector_at(long jarg1, Uint64Vector jarg1_, long jarg2);
+ public final static native void Uint64Vector_resize(long jarg1, Uint64Vector jarg1_, long jarg2);
+ public final static native void Uint64Vector_reserve(long jarg1, Uint64Vector jarg1_, long jarg2);
+ public final static native void Uint64Vector_swap(long jarg1, Uint64Vector jarg1_, long jarg2, Uint64Vector jarg2_);
+ public final static native void delete_Uint64Vector(long jarg1);
+ public final static native long new_LongVector();
+ public final static native void LongVector_push_back(long jarg1, LongVector jarg1_, long jarg2);
+ public final static native void LongVector_clear(long jarg1, LongVector jarg1_);
+ public final static native long LongVector_data(long jarg1, LongVector jarg1_);
+ public final static native long LongVector_size(long jarg1, LongVector jarg1_);
+ public final static native long LongVector_at(long jarg1, LongVector jarg1_, long jarg2);
+ public final static native void LongVector_resize(long jarg1, LongVector jarg1_, long jarg2);
+ public final static native void LongVector_reserve(long jarg1, LongVector jarg1_, long jarg2);
+ public final static native void LongVector_swap(long jarg1, LongVector jarg1_, long jarg2, LongVector jarg2_);
+ public final static native void delete_LongVector(long jarg1);
+ public final static native long new_IntVector();
+ public final static native void IntVector_push_back(long jarg1, IntVector jarg1_, int jarg2);
+ public final static native void IntVector_clear(long jarg1, IntVector jarg1_);
+ public final static native long IntVector_data(long jarg1, IntVector jarg1_);
+ public final static native long IntVector_size(long jarg1, IntVector jarg1_);
+ public final static native int IntVector_at(long jarg1, IntVector jarg1_, long jarg2);
+ public final static native void IntVector_resize(long jarg1, IntVector jarg1_, long jarg2);
+ public final static native void IntVector_reserve(long jarg1, IntVector jarg1_, long jarg2);
+ public final static native void IntVector_swap(long jarg1, IntVector jarg1_, long jarg2, IntVector jarg2_);
+ public final static native void delete_IntVector(long jarg1);
+ public final static native long new_VectorTransformVector();
+ public final static native void VectorTransformVector_push_back(long jarg1, VectorTransformVector jarg1_, long jarg2, VectorTransform jarg2_);
+ public final static native void VectorTransformVector_clear(long jarg1, VectorTransformVector jarg1_);
+ public final static native long VectorTransformVector_data(long jarg1, VectorTransformVector jarg1_);
+ public final static native long VectorTransformVector_size(long jarg1, VectorTransformVector jarg1_);
+ public final static native long VectorTransformVector_at(long jarg1, VectorTransformVector jarg1_, long jarg2);
+ public final static native void VectorTransformVector_resize(long jarg1, VectorTransformVector jarg1_, long jarg2);
+ public final static native void VectorTransformVector_reserve(long jarg1, VectorTransformVector jarg1_, long jarg2);
+ public final static native void VectorTransformVector_swap(long jarg1, VectorTransformVector jarg1_, long jarg2, VectorTransformVector jarg2_);
+ public final static native void delete_VectorTransformVector(long jarg1);
+ public final static native long new_OperatingPointVector();
+ public final static native void OperatingPointVector_push_back(long jarg1, OperatingPointVector jarg1_, long jarg2, OperatingPoint jarg2_);
+ public final static native void OperatingPointVector_clear(long jarg1, OperatingPointVector jarg1_);
+ public final static native long OperatingPointVector_data(long jarg1, OperatingPointVector jarg1_);
+ public final static native long OperatingPointVector_size(long jarg1, OperatingPointVector jarg1_);
+ public final static native long OperatingPointVector_at(long jarg1, OperatingPointVector jarg1_, long jarg2);
+ public final static native void OperatingPointVector_resize(long jarg1, OperatingPointVector jarg1_, long jarg2);
+ public final static native void OperatingPointVector_reserve(long jarg1, OperatingPointVector jarg1_, long jarg2);
+ public final static native void OperatingPointVector_swap(long jarg1, OperatingPointVector jarg1_, long jarg2, OperatingPointVector jarg2_);
+ public final static native void delete_OperatingPointVector(long jarg1);
+ public final static native long new_InvertedListsPtrVector();
+ public final static native void InvertedListsPtrVector_push_back(long jarg1, InvertedListsPtrVector jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native void InvertedListsPtrVector_clear(long jarg1, InvertedListsPtrVector jarg1_);
+ public final static native long InvertedListsPtrVector_data(long jarg1, InvertedListsPtrVector jarg1_);
+ public final static native long InvertedListsPtrVector_size(long jarg1, InvertedListsPtrVector jarg1_);
+ public final static native long InvertedListsPtrVector_at(long jarg1, InvertedListsPtrVector jarg1_, long jarg2);
+ public final static native void InvertedListsPtrVector_resize(long jarg1, InvertedListsPtrVector jarg1_, long jarg2);
+ public final static native void InvertedListsPtrVector_reserve(long jarg1, InvertedListsPtrVector jarg1_, long jarg2);
+ public final static native void InvertedListsPtrVector_swap(long jarg1, InvertedListsPtrVector jarg1_, long jarg2, InvertedListsPtrVector jarg2_);
+ public final static native void delete_InvertedListsPtrVector(long jarg1);
+ public final static native long new_FloatVectorVector();
+ public final static native void FloatVectorVector_push_back(long jarg1, FloatVectorVector jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native void FloatVectorVector_clear(long jarg1, FloatVectorVector jarg1_);
+ public final static native long FloatVectorVector_data(long jarg1, FloatVectorVector jarg1_);
+ public final static native long FloatVectorVector_size(long jarg1, FloatVectorVector jarg1_);
+ public final static native long FloatVectorVector_at(long jarg1, FloatVectorVector jarg1_, long jarg2);
+ public final static native void FloatVectorVector_resize(long jarg1, FloatVectorVector jarg1_, long jarg2);
+ public final static native void FloatVectorVector_reserve(long jarg1, FloatVectorVector jarg1_, long jarg2);
+ public final static native void FloatVectorVector_swap(long jarg1, FloatVectorVector jarg1_, long jarg2, FloatVectorVector jarg2_);
+ public final static native void delete_FloatVectorVector(long jarg1);
+ public final static native long new_ByteVectorVector();
+ public final static native void ByteVectorVector_push_back(long jarg1, ByteVectorVector jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native void ByteVectorVector_clear(long jarg1, ByteVectorVector jarg1_);
+ public final static native long ByteVectorVector_data(long jarg1, ByteVectorVector jarg1_);
+ public final static native long ByteVectorVector_size(long jarg1, ByteVectorVector jarg1_);
+ public final static native long ByteVectorVector_at(long jarg1, ByteVectorVector jarg1_, long jarg2);
+ public final static native void ByteVectorVector_resize(long jarg1, ByteVectorVector jarg1_, long jarg2);
+ public final static native void ByteVectorVector_reserve(long jarg1, ByteVectorVector jarg1_, long jarg2);
+ public final static native void ByteVectorVector_swap(long jarg1, ByteVectorVector jarg1_, long jarg2, ByteVectorVector jarg2_);
+ public final static native void delete_ByteVectorVector(long jarg1);
+ public final static native long new_LongVectorVector();
+ public final static native void LongVectorVector_push_back(long jarg1, LongVectorVector jarg1_, long jarg2);
+ public final static native void LongVectorVector_clear(long jarg1, LongVectorVector jarg1_);
+ public final static native long LongVectorVector_data(long jarg1, LongVectorVector jarg1_);
+ public final static native long LongVectorVector_size(long jarg1, LongVectorVector jarg1_);
+ public final static native long LongVectorVector_at(long jarg1, LongVectorVector jarg1_, long jarg2);
+ public final static native void LongVectorVector_resize(long jarg1, LongVectorVector jarg1_, long jarg2);
+ public final static native void LongVectorVector_reserve(long jarg1, LongVectorVector jarg1_, long jarg2);
+ public final static native void LongVectorVector_swap(long jarg1, LongVectorVector jarg1_, long jarg2, LongVectorVector jarg2_);
+ public final static native void delete_LongVectorVector(long jarg1);
+ public final static native void bitvec_print(long jarg1, long jarg2);
+ public final static native void fvecs2bitvecs(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native void bitvecs2fvecs(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native void fvec2bitvec(long jarg1, long jarg2, long jarg3);
+ public final static native void bitvec_shuffle(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void BitstringWriter_code_set(long jarg1, BitstringWriter jarg1_, long jarg2);
+ public final static native long BitstringWriter_code_get(long jarg1, BitstringWriter jarg1_);
+ public final static native void BitstringWriter_code_size_set(long jarg1, BitstringWriter jarg1_, long jarg2);
+ public final static native long BitstringWriter_code_size_get(long jarg1, BitstringWriter jarg1_);
+ public final static native void BitstringWriter_i_set(long jarg1, BitstringWriter jarg1_, long jarg2);
+ public final static native long BitstringWriter_i_get(long jarg1, BitstringWriter jarg1_);
+ public final static native long new_BitstringWriter(long jarg1, long jarg2);
+ public final static native void BitstringWriter_write(long jarg1, BitstringWriter jarg1_, long jarg2, int jarg3);
+ public final static native void delete_BitstringWriter(long jarg1);
+ public final static native void BitstringReader_code_set(long jarg1, BitstringReader jarg1_, long jarg2);
+ public final static native long BitstringReader_code_get(long jarg1, BitstringReader jarg1_);
+ public final static native void BitstringReader_code_size_set(long jarg1, BitstringReader jarg1_, long jarg2);
+ public final static native long BitstringReader_code_size_get(long jarg1, BitstringReader jarg1_);
+ public final static native void BitstringReader_i_set(long jarg1, BitstringReader jarg1_, long jarg2);
+ public final static native long BitstringReader_i_get(long jarg1, BitstringReader jarg1_);
+ public final static native long new_BitstringReader(long jarg1, long jarg2);
+ public final static native long BitstringReader_read(long jarg1, BitstringReader jarg1_, int jarg2);
+ public final static native void delete_BitstringReader(long jarg1);
+ public final static native void hamming_batch_size_set(long jarg1);
+ public final static native long hamming_batch_size_get();
+ public final static native int popcount64(long jarg1);
+ public final static native void hammings(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void hammings_knn_hc(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, int jarg6);
+ public final static native void hammings_knn(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, int jarg6);
+ public final static native void hammings_knn_mc(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7, long jarg8, LongVector jarg8_);
+ public final static native void hamming_range_search(long jarg1, long jarg2, long jarg3, long jarg4, int jarg5, long jarg6, long jarg7, RangeSearchResult jarg7_);
+ public final static native void hamming_count_thres(long jarg1, long jarg2, long jarg3, long jarg4, int jarg5, long jarg6, long jarg7);
+ public final static native long match_hamming_thres(long jarg1, long jarg2, long jarg3, long jarg4, int jarg5, long jarg6, long jarg7, LongVector jarg7_, long jarg8);
+ public final static native void crosshamming_count_thres(long jarg1, long jarg2, int jarg3, long jarg4, long jarg5);
+ public final static native int get_num_gpus();
+ public final static native int METRIC_INNER_PRODUCT_get();
+ public final static native int METRIC_L2_get();
+ public final static native int METRIC_Canberra_get();
+ public final static native String get_compile_options();
+ public final static native double getmillisecs();
+ public final static native long get_mem_usage_kb();
+ public final static native long get_cycles();
+ public final static native void fvec_madd(long jarg1, long jarg2, float jarg3, long jarg4, long jarg5);
+ public final static native int fvec_madd_and_argmin(long jarg1, long jarg2, float jarg3, long jarg4, long jarg5);
+ public final static native void reflection(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void matrix_qr(int jarg1, int jarg2, long jarg3);
+ public final static native void ranklist_handle_ties(int jarg1, long jarg2, LongVector jarg2_, long jarg3);
+ public final static native long ranklist_intersection_size(long jarg1, long jarg2, LongVector jarg2_, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native long merge_result_table_with__SWIG_0(long jarg1, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5, LongVector jarg5_, long jarg6, boolean jarg7, long jarg8);
+ public final static native long merge_result_table_with__SWIG_1(long jarg1, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5, LongVector jarg5_, long jarg6, boolean jarg7);
+ public final static native long merge_result_table_with__SWIG_2(long jarg1, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5, LongVector jarg5_, long jarg6);
+ public final static native double imbalance_factor__SWIG_0(int jarg1, int jarg2, long jarg3, LongVector jarg3_);
+ public final static native double imbalance_factor__SWIG_1(int jarg1, long jarg2);
+ public final static native void fvec_argsort(long jarg1, long jarg2, long jarg3);
+ public final static native void fvec_argsort_parallel(long jarg1, long jarg2, long jarg3);
+ public final static native int ivec_hist(long jarg1, long jarg2, int jarg3, long jarg4);
+ public final static native void bincode_hist(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native long ivec_checksum(long jarg1, long jarg2);
+ public final static native long fvecs_maybe_subsample__SWIG_0(long jarg1, long jarg2, long jarg3, long jarg4, boolean jarg5, long jarg6);
+ public final static native long fvecs_maybe_subsample__SWIG_1(long jarg1, long jarg2, long jarg3, long jarg4, boolean jarg5);
+ public final static native long fvecs_maybe_subsample__SWIG_2(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native void binary_to_real(long jarg1, long jarg2, long jarg3);
+ public final static native void real_to_binary(long jarg1, long jarg2, long jarg3);
+ public final static native long hash_bytes(long jarg1, long jarg2);
+ public final static native boolean check_openmp();
+ public final static native int FAISS_VERSION_MAJOR_get();
+ public final static native int FAISS_VERSION_MINOR_get();
+ public final static native int FAISS_VERSION_PATCH_get();
+ public final static native void Index_d_set(long jarg1, Index jarg1_, int jarg2);
+ public final static native int Index_d_get(long jarg1, Index jarg1_);
+ public final static native void Index_ntotal_set(long jarg1, Index jarg1_, long jarg2);
+ public final static native long Index_ntotal_get(long jarg1, Index jarg1_);
+ public final static native void Index_verbose_set(long jarg1, Index jarg1_, boolean jarg2);
+ public final static native boolean Index_verbose_get(long jarg1, Index jarg1_);
+ public final static native void Index_is_trained_set(long jarg1, Index jarg1_, boolean jarg2);
+ public final static native boolean Index_is_trained_get(long jarg1, Index jarg1_);
+ public final static native void Index_metric_type_set(long jarg1, Index jarg1_, int jarg2);
+ public final static native int Index_metric_type_get(long jarg1, Index jarg1_);
+ public final static native void Index_metric_arg_set(long jarg1, Index jarg1_, float jarg2);
+ public final static native float Index_metric_arg_get(long jarg1, Index jarg1_);
+ public final static native void delete_Index(long jarg1);
+ public final static native void Index_train(long jarg1, Index jarg1_, long jarg2, long jarg3);
+ public final static native void Index_add(long jarg1, Index jarg1_, long jarg2, long jarg3);
+ public final static native void Index_add_with_ids(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void Index_search(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void Index_range_search(long jarg1, Index jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void Index_assign__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void Index_assign__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void Index_reset(long jarg1, Index jarg1_);
+ public final static native long Index_remove_ids(long jarg1, Index jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void Index_reconstruct(long jarg1, Index jarg1_, long jarg2, long jarg3);
+ public final static native void Index_reconstruct_n(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void Index_search_and_reconstruct(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7);
+ public final static native void Index_compute_residual(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void Index_compute_residual_n(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_);
+ public final static native long Index_get_distance_computer(long jarg1, Index jarg1_);
+ public final static native long Index_sa_code_size(long jarg1, Index jarg1_);
+ public final static native void Index_sa_encode(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void Index_sa_decode(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long Index_toIVF(long jarg1, Index jarg1_);
+ public final static native void ClusteringParameters_niter_set(long jarg1, ClusteringParameters jarg1_, int jarg2);
+ public final static native int ClusteringParameters_niter_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_nredo_set(long jarg1, ClusteringParameters jarg1_, int jarg2);
+ public final static native int ClusteringParameters_nredo_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_verbose_set(long jarg1, ClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ClusteringParameters_verbose_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_spherical_set(long jarg1, ClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ClusteringParameters_spherical_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_int_centroids_set(long jarg1, ClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ClusteringParameters_int_centroids_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_update_index_set(long jarg1, ClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ClusteringParameters_update_index_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_frozen_centroids_set(long jarg1, ClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ClusteringParameters_frozen_centroids_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_min_points_per_centroid_set(long jarg1, ClusteringParameters jarg1_, int jarg2);
+ public final static native int ClusteringParameters_min_points_per_centroid_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_max_points_per_centroid_set(long jarg1, ClusteringParameters jarg1_, int jarg2);
+ public final static native int ClusteringParameters_max_points_per_centroid_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_seed_set(long jarg1, ClusteringParameters jarg1_, int jarg2);
+ public final static native int ClusteringParameters_seed_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native void ClusteringParameters_decode_block_size_set(long jarg1, ClusteringParameters jarg1_, long jarg2);
+ public final static native long ClusteringParameters_decode_block_size_get(long jarg1, ClusteringParameters jarg1_);
+ public final static native long new_ClusteringParameters();
+ public final static native void delete_ClusteringParameters(long jarg1);
+ public final static native void ClusteringIterationStats_obj_set(long jarg1, ClusteringIterationStats jarg1_, float jarg2);
+ public final static native float ClusteringIterationStats_obj_get(long jarg1, ClusteringIterationStats jarg1_);
+ public final static native void ClusteringIterationStats_time_set(long jarg1, ClusteringIterationStats jarg1_, double jarg2);
+ public final static native double ClusteringIterationStats_time_get(long jarg1, ClusteringIterationStats jarg1_);
+ public final static native void ClusteringIterationStats_time_search_set(long jarg1, ClusteringIterationStats jarg1_, double jarg2);
+ public final static native double ClusteringIterationStats_time_search_get(long jarg1, ClusteringIterationStats jarg1_);
+ public final static native void ClusteringIterationStats_imbalance_factor_set(long jarg1, ClusteringIterationStats jarg1_, double jarg2);
+ public final static native double ClusteringIterationStats_imbalance_factor_get(long jarg1, ClusteringIterationStats jarg1_);
+ public final static native void ClusteringIterationStats_nsplit_set(long jarg1, ClusteringIterationStats jarg1_, int jarg2);
+ public final static native int ClusteringIterationStats_nsplit_get(long jarg1, ClusteringIterationStats jarg1_);
+ public final static native long new_ClusteringIterationStats();
+ public final static native void delete_ClusteringIterationStats(long jarg1);
+ public final static native void Clustering_d_set(long jarg1, Clustering jarg1_, long jarg2);
+ public final static native long Clustering_d_get(long jarg1, Clustering jarg1_);
+ public final static native void Clustering_k_set(long jarg1, Clustering jarg1_, long jarg2);
+ public final static native long Clustering_k_get(long jarg1, Clustering jarg1_);
+ public final static native void Clustering_centroids_set(long jarg1, Clustering jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long Clustering_centroids_get(long jarg1, Clustering jarg1_);
+ public final static native void Clustering_iteration_stats_set(long jarg1, Clustering jarg1_, long jarg2);
+ public final static native long Clustering_iteration_stats_get(long jarg1, Clustering jarg1_);
+ public final static native long new_Clustering__SWIG_0(int jarg1, int jarg2);
+ public final static native long new_Clustering__SWIG_1(int jarg1, int jarg2, long jarg3, ClusteringParameters jarg3_);
+ public final static native void Clustering_train__SWIG_0(long jarg1, Clustering jarg1_, long jarg2, long jarg3, long jarg4, Index jarg4_, long jarg5);
+ public final static native void Clustering_train__SWIG_1(long jarg1, Clustering jarg1_, long jarg2, long jarg3, long jarg4, Index jarg4_);
+ public final static native void Clustering_train_encoded__SWIG_0(long jarg1, Clustering jarg1_, long jarg2, long jarg3, long jarg4, Index jarg4_, long jarg5, Index jarg5_, long jarg6);
+ public final static native void Clustering_train_encoded__SWIG_1(long jarg1, Clustering jarg1_, long jarg2, long jarg3, long jarg4, Index jarg4_, long jarg5, Index jarg5_);
+ public final static native void Clustering_post_process_centroids(long jarg1, Clustering jarg1_);
+ public final static native void delete_Clustering(long jarg1);
+ public final static native long new_Clustering1D__SWIG_0(int jarg1);
+ public final static native long new_Clustering1D__SWIG_1(int jarg1, long jarg2, ClusteringParameters jarg2_);
+ public final static native void Clustering1D_train_exact(long jarg1, Clustering1D jarg1_, long jarg2, long jarg3);
+ public final static native void delete_Clustering1D(long jarg1);
+ public final static native void ProgressiveDimClusteringParameters_progressive_dim_steps_set(long jarg1, ProgressiveDimClusteringParameters jarg1_, int jarg2);
+ public final static native int ProgressiveDimClusteringParameters_progressive_dim_steps_get(long jarg1, ProgressiveDimClusteringParameters jarg1_);
+ public final static native void ProgressiveDimClusteringParameters_apply_pca_set(long jarg1, ProgressiveDimClusteringParameters jarg1_, boolean jarg2);
+ public final static native boolean ProgressiveDimClusteringParameters_apply_pca_get(long jarg1, ProgressiveDimClusteringParameters jarg1_);
+ public final static native long new_ProgressiveDimClusteringParameters();
+ public final static native void delete_ProgressiveDimClusteringParameters(long jarg1);
+ public final static native void delete_ProgressiveDimIndexFactory(long jarg1);
+ public final static native long new_ProgressiveDimIndexFactory();
+ public final static native void ProgressiveDimClustering_d_set(long jarg1, ProgressiveDimClustering jarg1_, long jarg2);
+ public final static native long ProgressiveDimClustering_d_get(long jarg1, ProgressiveDimClustering jarg1_);
+ public final static native void ProgressiveDimClustering_k_set(long jarg1, ProgressiveDimClustering jarg1_, long jarg2);
+ public final static native long ProgressiveDimClustering_k_get(long jarg1, ProgressiveDimClustering jarg1_);
+ public final static native void ProgressiveDimClustering_centroids_set(long jarg1, ProgressiveDimClustering jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long ProgressiveDimClustering_centroids_get(long jarg1, ProgressiveDimClustering jarg1_);
+ public final static native void ProgressiveDimClustering_iteration_stats_set(long jarg1, ProgressiveDimClustering jarg1_, long jarg2);
+ public final static native long ProgressiveDimClustering_iteration_stats_get(long jarg1, ProgressiveDimClustering jarg1_);
+ public final static native long new_ProgressiveDimClustering__SWIG_0(int jarg1, int jarg2);
+ public final static native long new_ProgressiveDimClustering__SWIG_1(int jarg1, int jarg2, long jarg3, ProgressiveDimClusteringParameters jarg3_);
+ public final static native void ProgressiveDimClustering_train(long jarg1, ProgressiveDimClustering jarg1_, long jarg2, long jarg3, long jarg4, ProgressiveDimIndexFactory jarg4_);
+ public final static native void delete_ProgressiveDimClustering(long jarg1);
+ public final static native float kmeans_clustering(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void ProductQuantizer_d_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_d_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_M_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_M_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_nbits_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_nbits_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_dsub_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_dsub_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_code_size_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_code_size_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_ksub_set(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native long ProductQuantizer_ksub_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_verbose_set(long jarg1, ProductQuantizer jarg1_, boolean jarg2);
+ public final static native boolean ProductQuantizer_verbose_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_train_type_set(long jarg1, ProductQuantizer jarg1_, int jarg2);
+ public final static native int ProductQuantizer_train_type_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_cp_set(long jarg1, ProductQuantizer jarg1_, long jarg2, ClusteringParameters jarg2_);
+ public final static native long ProductQuantizer_cp_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_assign_index_set(long jarg1, ProductQuantizer jarg1_, long jarg2, Index jarg2_);
+ public final static native long ProductQuantizer_assign_index_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_centroids_set(long jarg1, ProductQuantizer jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long ProductQuantizer_centroids_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native long ProductQuantizer_get_centroids(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_train(long jarg1, ProductQuantizer jarg1_, int jarg2, long jarg3);
+ public final static native long new_ProductQuantizer__SWIG_0(long jarg1, long jarg2, long jarg3);
+ public final static native long new_ProductQuantizer__SWIG_1();
+ public final static native void ProductQuantizer_set_derived_values(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_set_params(long jarg1, ProductQuantizer jarg1_, long jarg2, int jarg3);
+ public final static native void ProductQuantizer_compute_code(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_compute_codes(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void ProductQuantizer_compute_codes_with_assign_index(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void ProductQuantizer_decode__SWIG_0(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_decode__SWIG_1(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void ProductQuantizer_compute_code_from_distance_table(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_compute_distance_table(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_compute_inner_prod_table(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void ProductQuantizer_compute_distance_tables(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void ProductQuantizer_compute_inner_prod_tables(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void ProductQuantizer_search__SWIG_0(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, boolean jarg7);
+ public final static native void ProductQuantizer_search__SWIG_1(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void ProductQuantizer_search_ip__SWIG_0(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, boolean jarg7);
+ public final static native void ProductQuantizer_search_ip__SWIG_1(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void ProductQuantizer_sdc_table_set(long jarg1, ProductQuantizer jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long ProductQuantizer_sdc_table_get(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_compute_sdc_table(long jarg1, ProductQuantizer jarg1_);
+ public final static native void ProductQuantizer_search_sdc__SWIG_0(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, boolean jarg7);
+ public final static native void ProductQuantizer_search_sdc__SWIG_1(long jarg1, ProductQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void delete_ProductQuantizer(long jarg1);
+ public final static native void PQEncoderGeneric_code_set(long jarg1, PQEncoderGeneric jarg1_, long jarg2);
+ public final static native long PQEncoderGeneric_code_get(long jarg1, PQEncoderGeneric jarg1_);
+ public final static native void PQEncoderGeneric_offset_set(long jarg1, PQEncoderGeneric jarg1_, short jarg2);
+ public final static native short PQEncoderGeneric_offset_get(long jarg1, PQEncoderGeneric jarg1_);
+ public final static native int PQEncoderGeneric_nbits_get(long jarg1, PQEncoderGeneric jarg1_);
+ public final static native void PQEncoderGeneric_reg_set(long jarg1, PQEncoderGeneric jarg1_, short jarg2);
+ public final static native short PQEncoderGeneric_reg_get(long jarg1, PQEncoderGeneric jarg1_);
+ public final static native long new_PQEncoderGeneric__SWIG_0(long jarg1, int jarg2, short jarg3);
+ public final static native long new_PQEncoderGeneric__SWIG_1(long jarg1, int jarg2);
+ public final static native void PQEncoderGeneric_encode(long jarg1, PQEncoderGeneric jarg1_, long jarg2);
+ public final static native void delete_PQEncoderGeneric(long jarg1);
+ public final static native void PQEncoder8_code_set(long jarg1, PQEncoder8 jarg1_, long jarg2);
+ public final static native long PQEncoder8_code_get(long jarg1, PQEncoder8 jarg1_);
+ public final static native long new_PQEncoder8(long jarg1, int jarg2);
+ public final static native void PQEncoder8_encode(long jarg1, PQEncoder8 jarg1_, long jarg2);
+ public final static native void delete_PQEncoder8(long jarg1);
+ public final static native void PQEncoder16_code_set(long jarg1, PQEncoder16 jarg1_, long jarg2);
+ public final static native long PQEncoder16_code_get(long jarg1, PQEncoder16 jarg1_);
+ public final static native long new_PQEncoder16(long jarg1, int jarg2);
+ public final static native void PQEncoder16_encode(long jarg1, PQEncoder16 jarg1_, long jarg2);
+ public final static native void delete_PQEncoder16(long jarg1);
+ public final static native void PQDecoderGeneric_code_set(long jarg1, PQDecoderGeneric jarg1_, long jarg2);
+ public final static native long PQDecoderGeneric_code_get(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native void PQDecoderGeneric_offset_set(long jarg1, PQDecoderGeneric jarg1_, short jarg2);
+ public final static native short PQDecoderGeneric_offset_get(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native int PQDecoderGeneric_nbits_get(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native long PQDecoderGeneric_mask_get(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native void PQDecoderGeneric_reg_set(long jarg1, PQDecoderGeneric jarg1_, short jarg2);
+ public final static native short PQDecoderGeneric_reg_get(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native long new_PQDecoderGeneric(long jarg1, int jarg2);
+ public final static native long PQDecoderGeneric_decode(long jarg1, PQDecoderGeneric jarg1_);
+ public final static native void delete_PQDecoderGeneric(long jarg1);
+ public final static native int PQDecoder8_nbits_get();
+ public final static native void PQDecoder8_code_set(long jarg1, PQDecoder8 jarg1_, long jarg2);
+ public final static native long PQDecoder8_code_get(long jarg1, PQDecoder8 jarg1_);
+ public final static native long new_PQDecoder8(long jarg1, int jarg2);
+ public final static native long PQDecoder8_decode(long jarg1, PQDecoder8 jarg1_);
+ public final static native void delete_PQDecoder8(long jarg1);
+ public final static native int PQDecoder16_nbits_get();
+ public final static native void PQDecoder16_code_set(long jarg1, PQDecoder16 jarg1_, long jarg2);
+ public final static native long PQDecoder16_code_get(long jarg1, PQDecoder16 jarg1_);
+ public final static native long new_PQDecoder16(long jarg1, int jarg2);
+ public final static native long PQDecoder16_decode(long jarg1, PQDecoder16 jarg1_);
+ public final static native void delete_PQDecoder16(long jarg1);
+ public final static native void VectorTransform_d_in_set(long jarg1, VectorTransform jarg1_, int jarg2);
+ public final static native int VectorTransform_d_in_get(long jarg1, VectorTransform jarg1_);
+ public final static native void VectorTransform_d_out_set(long jarg1, VectorTransform jarg1_, int jarg2);
+ public final static native int VectorTransform_d_out_get(long jarg1, VectorTransform jarg1_);
+ public final static native void VectorTransform_is_trained_set(long jarg1, VectorTransform jarg1_, boolean jarg2);
+ public final static native boolean VectorTransform_is_trained_get(long jarg1, VectorTransform jarg1_);
+ public final static native void VectorTransform_train(long jarg1, VectorTransform jarg1_, long jarg2, long jarg3);
+ public final static native long VectorTransform_apply(long jarg1, VectorTransform jarg1_, long jarg2, long jarg3);
+ public final static native void VectorTransform_apply_noalloc(long jarg1, VectorTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void VectorTransform_reverse_transform(long jarg1, VectorTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_VectorTransform(long jarg1);
+ public final static native void LinearTransform_have_bias_set(long jarg1, LinearTransform jarg1_, boolean jarg2);
+ public final static native boolean LinearTransform_have_bias_get(long jarg1, LinearTransform jarg1_);
+ public final static native void LinearTransform_is_orthonormal_set(long jarg1, LinearTransform jarg1_, boolean jarg2);
+ public final static native boolean LinearTransform_is_orthonormal_get(long jarg1, LinearTransform jarg1_);
+ public final static native void LinearTransform_A_set(long jarg1, LinearTransform jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long LinearTransform_A_get(long jarg1, LinearTransform jarg1_);
+ public final static native void LinearTransform_b_set(long jarg1, LinearTransform jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long LinearTransform_b_get(long jarg1, LinearTransform jarg1_);
+ public final static native long new_LinearTransform__SWIG_0(int jarg1, int jarg2, boolean jarg3);
+ public final static native long new_LinearTransform__SWIG_1(int jarg1, int jarg2);
+ public final static native long new_LinearTransform__SWIG_2(int jarg1);
+ public final static native long new_LinearTransform__SWIG_3();
+ public final static native void LinearTransform_apply_noalloc(long jarg1, LinearTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void LinearTransform_transform_transpose(long jarg1, LinearTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void LinearTransform_reverse_transform(long jarg1, LinearTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void LinearTransform_set_is_orthonormal(long jarg1, LinearTransform jarg1_);
+ public final static native void LinearTransform_verbose_set(long jarg1, LinearTransform jarg1_, boolean jarg2);
+ public final static native boolean LinearTransform_verbose_get(long jarg1, LinearTransform jarg1_);
+ public final static native void LinearTransform_print_if_verbose(long jarg1, LinearTransform jarg1_, String jarg2, long jarg3, DoubleVector jarg3_, int jarg4, int jarg5);
+ public final static native void delete_LinearTransform(long jarg1);
+ public final static native long new_RandomRotationMatrix__SWIG_0(int jarg1, int jarg2);
+ public final static native void RandomRotationMatrix_init(long jarg1, RandomRotationMatrix jarg1_, int jarg2);
+ public final static native void RandomRotationMatrix_train(long jarg1, RandomRotationMatrix jarg1_, long jarg2, long jarg3);
+ public final static native long new_RandomRotationMatrix__SWIG_1();
+ public final static native void delete_RandomRotationMatrix(long jarg1);
+ public final static native void PCAMatrix_eigen_power_set(long jarg1, PCAMatrix jarg1_, float jarg2);
+ public final static native float PCAMatrix_eigen_power_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_epsilon_set(long jarg1, PCAMatrix jarg1_, float jarg2);
+ public final static native float PCAMatrix_epsilon_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_random_rotation_set(long jarg1, PCAMatrix jarg1_, boolean jarg2);
+ public final static native boolean PCAMatrix_random_rotation_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_max_points_per_d_set(long jarg1, PCAMatrix jarg1_, long jarg2);
+ public final static native long PCAMatrix_max_points_per_d_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_balanced_bins_set(long jarg1, PCAMatrix jarg1_, int jarg2);
+ public final static native int PCAMatrix_balanced_bins_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_mean_set(long jarg1, PCAMatrix jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long PCAMatrix_mean_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_eigenvalues_set(long jarg1, PCAMatrix jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long PCAMatrix_eigenvalues_get(long jarg1, PCAMatrix jarg1_);
+ public final static native void PCAMatrix_PCAMat_set(long jarg1, PCAMatrix jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long PCAMatrix_PCAMat_get(long jarg1, PCAMatrix jarg1_);
+ public final static native long new_PCAMatrix__SWIG_0(int jarg1, int jarg2, float jarg3, boolean jarg4);
+ public final static native long new_PCAMatrix__SWIG_1(int jarg1, int jarg2, float jarg3);
+ public final static native long new_PCAMatrix__SWIG_2(int jarg1, int jarg2);
+ public final static native long new_PCAMatrix__SWIG_3(int jarg1);
+ public final static native long new_PCAMatrix__SWIG_4();
+ public final static native void PCAMatrix_train(long jarg1, PCAMatrix jarg1_, long jarg2, long jarg3);
+ public final static native void PCAMatrix_copy_from(long jarg1, PCAMatrix jarg1_, long jarg2, PCAMatrix jarg2_);
+ public final static native void PCAMatrix_prepare_Ab(long jarg1, PCAMatrix jarg1_);
+ public final static native void delete_PCAMatrix(long jarg1);
+ public final static native void ITQMatrix_max_iter_set(long jarg1, ITQMatrix jarg1_, int jarg2);
+ public final static native int ITQMatrix_max_iter_get(long jarg1, ITQMatrix jarg1_);
+ public final static native void ITQMatrix_seed_set(long jarg1, ITQMatrix jarg1_, int jarg2);
+ public final static native int ITQMatrix_seed_get(long jarg1, ITQMatrix jarg1_);
+ public final static native void ITQMatrix_init_rotation_set(long jarg1, ITQMatrix jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native long ITQMatrix_init_rotation_get(long jarg1, ITQMatrix jarg1_);
+ public final static native long new_ITQMatrix__SWIG_0(int jarg1);
+ public final static native long new_ITQMatrix__SWIG_1();
+ public final static native void ITQMatrix_train(long jarg1, ITQMatrix jarg1_, long jarg2, long jarg3);
+ public final static native void delete_ITQMatrix(long jarg1);
+ public final static native void ITQTransform_mean_set(long jarg1, ITQTransform jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long ITQTransform_mean_get(long jarg1, ITQTransform jarg1_);
+ public final static native void ITQTransform_do_pca_set(long jarg1, ITQTransform jarg1_, boolean jarg2);
+ public final static native boolean ITQTransform_do_pca_get(long jarg1, ITQTransform jarg1_);
+ public final static native void ITQTransform_itq_set(long jarg1, ITQTransform jarg1_, long jarg2, ITQMatrix jarg2_);
+ public final static native long ITQTransform_itq_get(long jarg1, ITQTransform jarg1_);
+ public final static native void ITQTransform_max_train_per_dim_set(long jarg1, ITQTransform jarg1_, int jarg2);
+ public final static native int ITQTransform_max_train_per_dim_get(long jarg1, ITQTransform jarg1_);
+ public final static native void ITQTransform_pca_then_itq_set(long jarg1, ITQTransform jarg1_, long jarg2, LinearTransform jarg2_);
+ public final static native long ITQTransform_pca_then_itq_get(long jarg1, ITQTransform jarg1_);
+ public final static native long new_ITQTransform__SWIG_0(int jarg1, int jarg2, boolean jarg3);
+ public final static native long new_ITQTransform__SWIG_1(int jarg1, int jarg2);
+ public final static native long new_ITQTransform__SWIG_2(int jarg1);
+ public final static native long new_ITQTransform__SWIG_3();
+ public final static native void ITQTransform_train(long jarg1, ITQTransform jarg1_, long jarg2, long jarg3);
+ public final static native void ITQTransform_apply_noalloc(long jarg1, ITQTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_ITQTransform(long jarg1);
+ public final static native void OPQMatrix_M_set(long jarg1, OPQMatrix jarg1_, int jarg2);
+ public final static native int OPQMatrix_M_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_niter_set(long jarg1, OPQMatrix jarg1_, int jarg2);
+ public final static native int OPQMatrix_niter_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_niter_pq_set(long jarg1, OPQMatrix jarg1_, int jarg2);
+ public final static native int OPQMatrix_niter_pq_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_niter_pq_0_set(long jarg1, OPQMatrix jarg1_, int jarg2);
+ public final static native int OPQMatrix_niter_pq_0_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_max_train_points_set(long jarg1, OPQMatrix jarg1_, long jarg2);
+ public final static native long OPQMatrix_max_train_points_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_verbose_set(long jarg1, OPQMatrix jarg1_, boolean jarg2);
+ public final static native boolean OPQMatrix_verbose_get(long jarg1, OPQMatrix jarg1_);
+ public final static native void OPQMatrix_pq_set(long jarg1, OPQMatrix jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long OPQMatrix_pq_get(long jarg1, OPQMatrix jarg1_);
+ public final static native long new_OPQMatrix__SWIG_0(int jarg1, int jarg2, int jarg3);
+ public final static native long new_OPQMatrix__SWIG_1(int jarg1, int jarg2);
+ public final static native long new_OPQMatrix__SWIG_2(int jarg1);
+ public final static native long new_OPQMatrix__SWIG_3();
+ public final static native void OPQMatrix_train(long jarg1, OPQMatrix jarg1_, long jarg2, long jarg3);
+ public final static native void delete_OPQMatrix(long jarg1);
+ public final static native void RemapDimensionsTransform_map_set(long jarg1, RemapDimensionsTransform jarg1_, long jarg2, IntVector jarg2_);
+ public final static native long RemapDimensionsTransform_map_get(long jarg1, RemapDimensionsTransform jarg1_);
+ public final static native long new_RemapDimensionsTransform__SWIG_0(int jarg1, int jarg2, long jarg3);
+ public final static native long new_RemapDimensionsTransform__SWIG_1(int jarg1, int jarg2, boolean jarg3);
+ public final static native long new_RemapDimensionsTransform__SWIG_2(int jarg1, int jarg2);
+ public final static native void RemapDimensionsTransform_apply_noalloc(long jarg1, RemapDimensionsTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void RemapDimensionsTransform_reverse_transform(long jarg1, RemapDimensionsTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long new_RemapDimensionsTransform__SWIG_3();
+ public final static native void delete_RemapDimensionsTransform(long jarg1);
+ public final static native void NormalizationTransform_norm_set(long jarg1, NormalizationTransform jarg1_, float jarg2);
+ public final static native float NormalizationTransform_norm_get(long jarg1, NormalizationTransform jarg1_);
+ public final static native long new_NormalizationTransform__SWIG_0(int jarg1, float jarg2);
+ public final static native long new_NormalizationTransform__SWIG_1(int jarg1);
+ public final static native long new_NormalizationTransform__SWIG_2();
+ public final static native void NormalizationTransform_apply_noalloc(long jarg1, NormalizationTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void NormalizationTransform_reverse_transform(long jarg1, NormalizationTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_NormalizationTransform(long jarg1);
+ public final static native void CenteringTransform_mean_set(long jarg1, CenteringTransform jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long CenteringTransform_mean_get(long jarg1, CenteringTransform jarg1_);
+ public final static native long new_CenteringTransform__SWIG_0(int jarg1);
+ public final static native long new_CenteringTransform__SWIG_1();
+ public final static native void CenteringTransform_train(long jarg1, CenteringTransform jarg1_, long jarg2, long jarg3);
+ public final static native void CenteringTransform_apply_noalloc(long jarg1, CenteringTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void CenteringTransform_reverse_transform(long jarg1, CenteringTransform jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_CenteringTransform(long jarg1);
+ public final static native void IndexFlatCodes_code_size_set(long jarg1, IndexFlatCodes jarg1_, long jarg2);
+ public final static native long IndexFlatCodes_code_size_get(long jarg1, IndexFlatCodes jarg1_);
+ public final static native void IndexFlatCodes_codes_set(long jarg1, IndexFlatCodes jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native long IndexFlatCodes_codes_get(long jarg1, IndexFlatCodes jarg1_);
+ public final static native void IndexFlatCodes_add(long jarg1, IndexFlatCodes jarg1_, long jarg2, long jarg3);
+ public final static native void IndexFlatCodes_reset(long jarg1, IndexFlatCodes jarg1_);
+ public final static native void IndexFlatCodes_reconstruct_n(long jarg1, IndexFlatCodes jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexFlatCodes_reconstruct(long jarg1, IndexFlatCodes jarg1_, long jarg2, long jarg3);
+ public final static native long IndexFlatCodes_sa_code_size(long jarg1, IndexFlatCodes jarg1_);
+ public final static native long IndexFlatCodes_remove_ids(long jarg1, IndexFlatCodes jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void delete_IndexFlatCodes(long jarg1);
+ public final static native long new_IndexFlat__SWIG_0(long jarg1, int jarg2);
+ public final static native long new_IndexFlat__SWIG_1(long jarg1);
+ public final static native void IndexFlat_search(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexFlat_range_search(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexFlat_reconstruct(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3);
+ public final static native void IndexFlat_compute_distance_subset(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native long IndexFlat_get_xb__SWIG_0(long jarg1, IndexFlat jarg1_);
+ public final static native long new_IndexFlat__SWIG_2();
+ public final static native long IndexFlat_get_distance_computer(long jarg1, IndexFlat jarg1_);
+ public final static native void IndexFlat_sa_encode(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexFlat_sa_decode(long jarg1, IndexFlat jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_IndexFlat(long jarg1);
+ public final static native long new_IndexFlatIP__SWIG_0(long jarg1);
+ public final static native long new_IndexFlatIP__SWIG_1();
+ public final static native void delete_IndexFlatIP(long jarg1);
+ public final static native long new_IndexFlatL2__SWIG_0(long jarg1);
+ public final static native long new_IndexFlatL2__SWIG_1();
+ public final static native void delete_IndexFlatL2(long jarg1);
+ public final static native void IndexFlat1D_continuous_update_set(long jarg1, IndexFlat1D jarg1_, boolean jarg2);
+ public final static native boolean IndexFlat1D_continuous_update_get(long jarg1, IndexFlat1D jarg1_);
+ public final static native void IndexFlat1D_perm_set(long jarg1, IndexFlat1D jarg1_, long jarg2);
+ public final static native long IndexFlat1D_perm_get(long jarg1, IndexFlat1D jarg1_);
+ public final static native long new_IndexFlat1D__SWIG_0(boolean jarg1);
+ public final static native long new_IndexFlat1D__SWIG_1();
+ public final static native void IndexFlat1D_update_permutation(long jarg1, IndexFlat1D jarg1_);
+ public final static native void IndexFlat1D_add(long jarg1, IndexFlat1D jarg1_, long jarg2, long jarg3);
+ public final static native void IndexFlat1D_reset(long jarg1, IndexFlat1D jarg1_);
+ public final static native void IndexFlat1D_search(long jarg1, IndexFlat1D jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void delete_IndexFlat1D(long jarg1);
+ public final static native void IndexLSH_nbits_set(long jarg1, IndexLSH jarg1_, int jarg2);
+ public final static native int IndexLSH_nbits_get(long jarg1, IndexLSH jarg1_);
+ public final static native void IndexLSH_rotate_data_set(long jarg1, IndexLSH jarg1_, boolean jarg2);
+ public final static native boolean IndexLSH_rotate_data_get(long jarg1, IndexLSH jarg1_);
+ public final static native void IndexLSH_train_thresholds_set(long jarg1, IndexLSH jarg1_, boolean jarg2);
+ public final static native boolean IndexLSH_train_thresholds_get(long jarg1, IndexLSH jarg1_);
+ public final static native void IndexLSH_rrot_set(long jarg1, IndexLSH jarg1_, long jarg2, RandomRotationMatrix jarg2_);
+ public final static native long IndexLSH_rrot_get(long jarg1, IndexLSH jarg1_);
+ public final static native void IndexLSH_thresholds_set(long jarg1, IndexLSH jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long IndexLSH_thresholds_get(long jarg1, IndexLSH jarg1_);
+ public final static native long new_IndexLSH__SWIG_0(long jarg1, int jarg2, boolean jarg3, boolean jarg4);
+ public final static native long new_IndexLSH__SWIG_1(long jarg1, int jarg2, boolean jarg3);
+ public final static native long new_IndexLSH__SWIG_2(long jarg1, int jarg2);
+ public final static native long IndexLSH_apply_preprocess(long jarg1, IndexLSH jarg1_, long jarg2, long jarg3);
+ public final static native void IndexLSH_train(long jarg1, IndexLSH jarg1_, long jarg2, long jarg3);
+ public final static native void IndexLSH_search(long jarg1, IndexLSH jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexLSH_transfer_thresholds(long jarg1, IndexLSH jarg1_, long jarg2, LinearTransform jarg2_);
+ public final static native void delete_IndexLSH(long jarg1);
+ public final static native long new_IndexLSH__SWIG_3();
+ public final static native void IndexLSH_sa_encode(long jarg1, IndexLSH jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexLSH_sa_decode(long jarg1, IndexLSH jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void SimulatedAnnealingParameters_init_temperature_set(long jarg1, SimulatedAnnealingParameters jarg1_, double jarg2);
+ public final static native double SimulatedAnnealingParameters_init_temperature_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_temperature_decay_set(long jarg1, SimulatedAnnealingParameters jarg1_, double jarg2);
+ public final static native double SimulatedAnnealingParameters_temperature_decay_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_n_iter_set(long jarg1, SimulatedAnnealingParameters jarg1_, int jarg2);
+ public final static native int SimulatedAnnealingParameters_n_iter_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_n_redo_set(long jarg1, SimulatedAnnealingParameters jarg1_, int jarg2);
+ public final static native int SimulatedAnnealingParameters_n_redo_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_seed_set(long jarg1, SimulatedAnnealingParameters jarg1_, int jarg2);
+ public final static native int SimulatedAnnealingParameters_seed_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_verbose_set(long jarg1, SimulatedAnnealingParameters jarg1_, int jarg2);
+ public final static native int SimulatedAnnealingParameters_verbose_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_only_bit_flips_set(long jarg1, SimulatedAnnealingParameters jarg1_, boolean jarg2);
+ public final static native boolean SimulatedAnnealingParameters_only_bit_flips_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native void SimulatedAnnealingParameters_init_random_set(long jarg1, SimulatedAnnealingParameters jarg1_, boolean jarg2);
+ public final static native boolean SimulatedAnnealingParameters_init_random_get(long jarg1, SimulatedAnnealingParameters jarg1_);
+ public final static native long new_SimulatedAnnealingParameters();
+ public final static native void delete_SimulatedAnnealingParameters(long jarg1);
+ public final static native void PermutationObjective_n_set(long jarg1, PermutationObjective jarg1_, int jarg2);
+ public final static native int PermutationObjective_n_get(long jarg1, PermutationObjective jarg1_);
+ public final static native double PermutationObjective_compute_cost(long jarg1, PermutationObjective jarg1_, long jarg2);
+ public final static native double PermutationObjective_cost_update(long jarg1, PermutationObjective jarg1_, long jarg2, int jarg3, int jarg4);
+ public final static native void delete_PermutationObjective(long jarg1);
+ public final static native void ReproduceDistancesObjective_dis_weight_factor_set(long jarg1, ReproduceDistancesObjective jarg1_, double jarg2);
+ public final static native double ReproduceDistancesObjective_dis_weight_factor_get(long jarg1, ReproduceDistancesObjective jarg1_);
+ public final static native double ReproduceDistancesObjective_sqr(double jarg1);
+ public final static native double ReproduceDistancesObjective_dis_weight(long jarg1, ReproduceDistancesObjective jarg1_, double jarg2);
+ public final static native void ReproduceDistancesObjective_source_dis_set(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native long ReproduceDistancesObjective_source_dis_get(long jarg1, ReproduceDistancesObjective jarg1_);
+ public final static native void ReproduceDistancesObjective_target_dis_set(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2);
+ public final static native long ReproduceDistancesObjective_target_dis_get(long jarg1, ReproduceDistancesObjective jarg1_);
+ public final static native void ReproduceDistancesObjective_weights_set(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native long ReproduceDistancesObjective_weights_get(long jarg1, ReproduceDistancesObjective jarg1_);
+ public final static native double ReproduceDistancesObjective_get_source_dis(long jarg1, ReproduceDistancesObjective jarg1_, int jarg2, int jarg3);
+ public final static native double ReproduceDistancesObjective_compute_cost(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2);
+ public final static native double ReproduceDistancesObjective_cost_update(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2, int jarg3, int jarg4);
+ public final static native long new_ReproduceDistancesObjective(int jarg1, long jarg2, long jarg3, double jarg4);
+ public final static native void ReproduceDistancesObjective_compute_mean_stdev(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native void ReproduceDistancesObjective_set_affine_target_dis(long jarg1, ReproduceDistancesObjective jarg1_, long jarg2);
+ public final static native void delete_ReproduceDistancesObjective(long jarg1);
+ public final static native void SimulatedAnnealingOptimizer_obj_set(long jarg1, SimulatedAnnealingOptimizer jarg1_, long jarg2, PermutationObjective jarg2_);
+ public final static native long SimulatedAnnealingOptimizer_obj_get(long jarg1, SimulatedAnnealingOptimizer jarg1_);
+ public final static native void SimulatedAnnealingOptimizer_n_set(long jarg1, SimulatedAnnealingOptimizer jarg1_, int jarg2);
+ public final static native int SimulatedAnnealingOptimizer_n_get(long jarg1, SimulatedAnnealingOptimizer jarg1_);
+ public final static native void SimulatedAnnealingOptimizer_logfile_set(long jarg1, SimulatedAnnealingOptimizer jarg1_, long jarg2);
+ public final static native long SimulatedAnnealingOptimizer_logfile_get(long jarg1, SimulatedAnnealingOptimizer jarg1_);
+ public final static native long new_SimulatedAnnealingOptimizer(long jarg1, PermutationObjective jarg1_, long jarg2, SimulatedAnnealingParameters jarg2_);
+ public final static native void SimulatedAnnealingOptimizer_rnd_set(long jarg1, SimulatedAnnealingOptimizer jarg1_, long jarg2);
+ public final static native long SimulatedAnnealingOptimizer_rnd_get(long jarg1, SimulatedAnnealingOptimizer jarg1_);
+ public final static native void SimulatedAnnealingOptimizer_init_cost_set(long jarg1, SimulatedAnnealingOptimizer jarg1_, double jarg2);
+ public final static native double SimulatedAnnealingOptimizer_init_cost_get(long jarg1, SimulatedAnnealingOptimizer jarg1_);
+ public final static native double SimulatedAnnealingOptimizer_optimize(long jarg1, SimulatedAnnealingOptimizer jarg1_, long jarg2);
+ public final static native double SimulatedAnnealingOptimizer_run_optimization(long jarg1, SimulatedAnnealingOptimizer jarg1_, long jarg2);
+ public final static native void delete_SimulatedAnnealingOptimizer(long jarg1);
+ public final static native void PolysemousTraining_optimization_type_set(long jarg1, PolysemousTraining jarg1_, int jarg2);
+ public final static native int PolysemousTraining_optimization_type_get(long jarg1, PolysemousTraining jarg1_);
+ public final static native void PolysemousTraining_ntrain_permutation_set(long jarg1, PolysemousTraining jarg1_, int jarg2);
+ public final static native int PolysemousTraining_ntrain_permutation_get(long jarg1, PolysemousTraining jarg1_);
+ public final static native void PolysemousTraining_dis_weight_factor_set(long jarg1, PolysemousTraining jarg1_, double jarg2);
+ public final static native double PolysemousTraining_dis_weight_factor_get(long jarg1, PolysemousTraining jarg1_);
+ public final static native void PolysemousTraining_max_memory_set(long jarg1, PolysemousTraining jarg1_, long jarg2);
+ public final static native long PolysemousTraining_max_memory_get(long jarg1, PolysemousTraining jarg1_);
+ public final static native void PolysemousTraining_log_pattern_set(long jarg1, PolysemousTraining jarg1_, String jarg2);
+ public final static native String PolysemousTraining_log_pattern_get(long jarg1, PolysemousTraining jarg1_);
+ public final static native long new_PolysemousTraining();
+ public final static native void PolysemousTraining_optimize_pq_for_hamming(long jarg1, PolysemousTraining jarg1_, long jarg2, ProductQuantizer jarg2_, long jarg3, long jarg4);
+ public final static native void PolysemousTraining_optimize_ranking(long jarg1, PolysemousTraining jarg1_, long jarg2, ProductQuantizer jarg2_, long jarg3, long jarg4);
+ public final static native void PolysemousTraining_optimize_reproduce_distances(long jarg1, PolysemousTraining jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long PolysemousTraining_memory_usage_per_thread(long jarg1, PolysemousTraining jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native void delete_PolysemousTraining(long jarg1);
+ public final static native void IndexPQ_pq_set(long jarg1, IndexPQ jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long IndexPQ_pq_get(long jarg1, IndexPQ jarg1_);
+ public final static native long new_IndexPQ__SWIG_0(int jarg1, long jarg2, long jarg3, int jarg4);
+ public final static native long new_IndexPQ__SWIG_1(int jarg1, long jarg2, long jarg3);
+ public final static native long new_IndexPQ__SWIG_2();
+ public final static native void IndexPQ_train(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3);
+ public final static native void IndexPQ_search(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexPQ_sa_encode(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexPQ_sa_decode(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long IndexPQ_get_distance_computer(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_do_polysemous_training_set(long jarg1, IndexPQ jarg1_, boolean jarg2);
+ public final static native boolean IndexPQ_do_polysemous_training_get(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_polysemous_training_set(long jarg1, IndexPQ jarg1_, long jarg2, PolysemousTraining jarg2_);
+ public final static native long IndexPQ_polysemous_training_get(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_search_type_set(long jarg1, IndexPQ jarg1_, int jarg2);
+ public final static native int IndexPQ_search_type_get(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_encode_signs_set(long jarg1, IndexPQ jarg1_, boolean jarg2);
+ public final static native boolean IndexPQ_encode_signs_get(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_polysemous_ht_set(long jarg1, IndexPQ jarg1_, int jarg2);
+ public final static native int IndexPQ_polysemous_ht_get(long jarg1, IndexPQ jarg1_);
+ public final static native void IndexPQ_search_core_polysemous(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexPQ_hamming_distance_histogram(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexPQ_hamming_distance_table(long jarg1, IndexPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_IndexPQ(long jarg1);
+ public final static native void IndexPQStats_nq_set(long jarg1, IndexPQStats jarg1_, long jarg2);
+ public final static native long IndexPQStats_nq_get(long jarg1, IndexPQStats jarg1_);
+ public final static native void IndexPQStats_ncode_set(long jarg1, IndexPQStats jarg1_, long jarg2);
+ public final static native long IndexPQStats_ncode_get(long jarg1, IndexPQStats jarg1_);
+ public final static native void IndexPQStats_n_hamming_pass_set(long jarg1, IndexPQStats jarg1_, long jarg2);
+ public final static native long IndexPQStats_n_hamming_pass_get(long jarg1, IndexPQStats jarg1_);
+ public final static native long new_IndexPQStats();
+ public final static native void IndexPQStats_reset(long jarg1, IndexPQStats jarg1_);
+ public final static native void delete_IndexPQStats(long jarg1);
+ public final static native void indexPQ_stats_set(long jarg1, IndexPQStats jarg1_);
+ public final static native long indexPQ_stats_get();
+ public final static native void MultiIndexQuantizer_pq_set(long jarg1, MultiIndexQuantizer jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long MultiIndexQuantizer_pq_get(long jarg1, MultiIndexQuantizer jarg1_);
+ public final static native long new_MultiIndexQuantizer__SWIG_0(int jarg1, long jarg2, long jarg3);
+ public final static native void MultiIndexQuantizer_train(long jarg1, MultiIndexQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void MultiIndexQuantizer_search(long jarg1, MultiIndexQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void MultiIndexQuantizer_add(long jarg1, MultiIndexQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void MultiIndexQuantizer_reset(long jarg1, MultiIndexQuantizer jarg1_);
+ public final static native long new_MultiIndexQuantizer__SWIG_1();
+ public final static native void MultiIndexQuantizer_reconstruct(long jarg1, MultiIndexQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void delete_MultiIndexQuantizer(long jarg1);
+ public final static native void MultiIndexQuantizer2_assign_indexes_set(long jarg1, MultiIndexQuantizer2 jarg1_, long jarg2);
+ public final static native long MultiIndexQuantizer2_assign_indexes_get(long jarg1, MultiIndexQuantizer2 jarg1_);
+ public final static native void MultiIndexQuantizer2_own_fields_set(long jarg1, MultiIndexQuantizer2 jarg1_, boolean jarg2);
+ public final static native boolean MultiIndexQuantizer2_own_fields_get(long jarg1, MultiIndexQuantizer2 jarg1_);
+ public final static native long new_MultiIndexQuantizer2__SWIG_0(int jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native long new_MultiIndexQuantizer2__SWIG_1(int jarg1, long jarg2, long jarg3, Index jarg3_, long jarg4, Index jarg4_);
+ public final static native void MultiIndexQuantizer2_train(long jarg1, MultiIndexQuantizer2 jarg1_, long jarg2, long jarg3);
+ public final static native void MultiIndexQuantizer2_search(long jarg1, MultiIndexQuantizer2 jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void delete_MultiIndexQuantizer2(long jarg1);
+ public final static native void InvertedLists_nlist_set(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long InvertedLists_nlist_get(long jarg1, InvertedLists jarg1_);
+ public final static native void InvertedLists_code_size_set(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long InvertedLists_code_size_get(long jarg1, InvertedLists jarg1_);
+ public final static native long InvertedLists_INVALID_CODE_SIZE_get();
+ public final static native long InvertedLists_list_size(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long InvertedLists_get_codes(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long InvertedLists_get_ids(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native void InvertedLists_release_codes(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void InvertedLists_release_ids(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long InvertedLists_get_single_id(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long InvertedLists_get_single_code(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void InvertedLists_prefetch_lists(long jarg1, InvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native long InvertedLists_add_entry(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long InvertedLists_add_entries(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void InvertedLists_update_entry(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void InvertedLists_update_entries(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6);
+ public final static native void InvertedLists_resize(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void InvertedLists_reset(long jarg1, InvertedLists jarg1_);
+ public final static native void InvertedLists_merge_from(long jarg1, InvertedLists jarg1_, long jarg2, InvertedLists jarg2_, long jarg3);
+ public final static native void delete_InvertedLists(long jarg1);
+ public final static native double InvertedLists_imbalance_factor(long jarg1, InvertedLists jarg1_);
+ public final static native void InvertedLists_print_stats(long jarg1, InvertedLists jarg1_);
+ public final static native long InvertedLists_compute_ntotal(long jarg1, InvertedLists jarg1_);
+ public final static native void InvertedLists_ScopedIds_il_set(long jarg1, InvertedLists.ScopedIds jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long InvertedLists_ScopedIds_il_get(long jarg1, InvertedLists.ScopedIds jarg1_);
+ public final static native void InvertedLists_ScopedIds_ids_set(long jarg1, InvertedLists.ScopedIds jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long InvertedLists_ScopedIds_ids_get(long jarg1, InvertedLists.ScopedIds jarg1_);
+ public final static native void InvertedLists_ScopedIds_list_no_set(long jarg1, InvertedLists.ScopedIds jarg1_, long jarg2);
+ public final static native long InvertedLists_ScopedIds_list_no_get(long jarg1, InvertedLists.ScopedIds jarg1_);
+ public final static native long new_InvertedLists_ScopedIds(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long InvertedLists_ScopedIds_get(long jarg1, InvertedLists.ScopedIds jarg1_);
+ public final static native void delete_InvertedLists_ScopedIds(long jarg1);
+ public final static native void InvertedLists_ScopedCodes_il_set(long jarg1, InvertedLists.ScopedCodes jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long InvertedLists_ScopedCodes_il_get(long jarg1, InvertedLists.ScopedCodes jarg1_);
+ public final static native void InvertedLists_ScopedCodes_codes_set(long jarg1, InvertedLists.ScopedCodes jarg1_, long jarg2);
+ public final static native long InvertedLists_ScopedCodes_codes_get(long jarg1, InvertedLists.ScopedCodes jarg1_);
+ public final static native void InvertedLists_ScopedCodes_list_no_set(long jarg1, InvertedLists.ScopedCodes jarg1_, long jarg2);
+ public final static native long InvertedLists_ScopedCodes_list_no_get(long jarg1, InvertedLists.ScopedCodes jarg1_);
+ public final static native long new_InvertedLists_ScopedCodes__SWIG_0(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long new_InvertedLists_ScopedCodes__SWIG_1(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long InvertedLists_ScopedCodes_get(long jarg1, InvertedLists.ScopedCodes jarg1_);
+ public final static native void delete_InvertedLists_ScopedCodes(long jarg1);
+ public final static native void ArrayInvertedLists_codes_set(long jarg1, ArrayInvertedLists jarg1_, long jarg2, ByteVectorVector jarg2_);
+ public final static native long ArrayInvertedLists_codes_get(long jarg1, ArrayInvertedLists jarg1_);
+ public final static native void ArrayInvertedLists_ids_set(long jarg1, ArrayInvertedLists jarg1_, long jarg2);
+ public final static native long ArrayInvertedLists_ids_get(long jarg1, ArrayInvertedLists jarg1_);
+ public final static native long new_ArrayInvertedLists(long jarg1, long jarg2);
+ public final static native long ArrayInvertedLists_list_size(long jarg1, ArrayInvertedLists jarg1_, long jarg2);
+ public final static native long ArrayInvertedLists_get_codes(long jarg1, ArrayInvertedLists jarg1_, long jarg2);
+ public final static native long ArrayInvertedLists_get_ids(long jarg1, ArrayInvertedLists jarg1_, long jarg2);
+ public final static native long ArrayInvertedLists_add_entries(long jarg1, ArrayInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void ArrayInvertedLists_update_entries(long jarg1, ArrayInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6);
+ public final static native void ArrayInvertedLists_resize(long jarg1, ArrayInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void delete_ArrayInvertedLists(long jarg1);
+ public final static native long ReadOnlyInvertedLists_add_entries(long jarg1, ReadOnlyInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void ReadOnlyInvertedLists_update_entries(long jarg1, ReadOnlyInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6);
+ public final static native void ReadOnlyInvertedLists_resize(long jarg1, ReadOnlyInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void delete_ReadOnlyInvertedLists(long jarg1);
+ public final static native void HStackInvertedLists_ils_set(long jarg1, HStackInvertedLists jarg1_, long jarg2);
+ public final static native long HStackInvertedLists_ils_get(long jarg1, HStackInvertedLists jarg1_);
+ public final static native long new_HStackInvertedLists(int jarg1, long jarg2);
+ public final static native long HStackInvertedLists_list_size(long jarg1, HStackInvertedLists jarg1_, long jarg2);
+ public final static native long HStackInvertedLists_get_codes(long jarg1, HStackInvertedLists jarg1_, long jarg2);
+ public final static native long HStackInvertedLists_get_ids(long jarg1, HStackInvertedLists jarg1_, long jarg2);
+ public final static native void HStackInvertedLists_prefetch_lists(long jarg1, HStackInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void HStackInvertedLists_release_codes(long jarg1, HStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void HStackInvertedLists_release_ids(long jarg1, HStackInvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long HStackInvertedLists_get_single_id(long jarg1, HStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long HStackInvertedLists_get_single_code(long jarg1, HStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void delete_HStackInvertedLists(long jarg1);
+ public final static native void SliceInvertedLists_il_set(long jarg1, SliceInvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long SliceInvertedLists_il_get(long jarg1, SliceInvertedLists jarg1_);
+ public final static native void SliceInvertedLists_i0_set(long jarg1, SliceInvertedLists jarg1_, long jarg2);
+ public final static native long SliceInvertedLists_i0_get(long jarg1, SliceInvertedLists jarg1_);
+ public final static native void SliceInvertedLists_i1_set(long jarg1, SliceInvertedLists jarg1_, long jarg2);
+ public final static native long SliceInvertedLists_i1_get(long jarg1, SliceInvertedLists jarg1_);
+ public final static native long new_SliceInvertedLists(long jarg1, InvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long SliceInvertedLists_list_size(long jarg1, SliceInvertedLists jarg1_, long jarg2);
+ public final static native long SliceInvertedLists_get_codes(long jarg1, SliceInvertedLists jarg1_, long jarg2);
+ public final static native long SliceInvertedLists_get_ids(long jarg1, SliceInvertedLists jarg1_, long jarg2);
+ public final static native void SliceInvertedLists_release_codes(long jarg1, SliceInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void SliceInvertedLists_release_ids(long jarg1, SliceInvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long SliceInvertedLists_get_single_id(long jarg1, SliceInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long SliceInvertedLists_get_single_code(long jarg1, SliceInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void SliceInvertedLists_prefetch_lists(long jarg1, SliceInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void delete_SliceInvertedLists(long jarg1);
+ public final static native void VStackInvertedLists_ils_set(long jarg1, VStackInvertedLists jarg1_, long jarg2);
+ public final static native long VStackInvertedLists_ils_get(long jarg1, VStackInvertedLists jarg1_);
+ public final static native void VStackInvertedLists_cumsz_set(long jarg1, VStackInvertedLists jarg1_, long jarg2);
+ public final static native long VStackInvertedLists_cumsz_get(long jarg1, VStackInvertedLists jarg1_);
+ public final static native long new_VStackInvertedLists(int jarg1, long jarg2);
+ public final static native long VStackInvertedLists_list_size(long jarg1, VStackInvertedLists jarg1_, long jarg2);
+ public final static native long VStackInvertedLists_get_codes(long jarg1, VStackInvertedLists jarg1_, long jarg2);
+ public final static native long VStackInvertedLists_get_ids(long jarg1, VStackInvertedLists jarg1_, long jarg2);
+ public final static native void VStackInvertedLists_release_codes(long jarg1, VStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void VStackInvertedLists_release_ids(long jarg1, VStackInvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long VStackInvertedLists_get_single_id(long jarg1, VStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long VStackInvertedLists_get_single_code(long jarg1, VStackInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void VStackInvertedLists_prefetch_lists(long jarg1, VStackInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void delete_VStackInvertedLists(long jarg1);
+ public final static native void MaskedInvertedLists_il0_set(long jarg1, MaskedInvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long MaskedInvertedLists_il0_get(long jarg1, MaskedInvertedLists jarg1_);
+ public final static native void MaskedInvertedLists_il1_set(long jarg1, MaskedInvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long MaskedInvertedLists_il1_get(long jarg1, MaskedInvertedLists jarg1_);
+ public final static native long new_MaskedInvertedLists(long jarg1, InvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long MaskedInvertedLists_list_size(long jarg1, MaskedInvertedLists jarg1_, long jarg2);
+ public final static native long MaskedInvertedLists_get_codes(long jarg1, MaskedInvertedLists jarg1_, long jarg2);
+ public final static native long MaskedInvertedLists_get_ids(long jarg1, MaskedInvertedLists jarg1_, long jarg2);
+ public final static native void MaskedInvertedLists_release_codes(long jarg1, MaskedInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void MaskedInvertedLists_release_ids(long jarg1, MaskedInvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long MaskedInvertedLists_get_single_id(long jarg1, MaskedInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long MaskedInvertedLists_get_single_code(long jarg1, MaskedInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void MaskedInvertedLists_prefetch_lists(long jarg1, MaskedInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void delete_MaskedInvertedLists(long jarg1);
+ public final static native void StopWordsInvertedLists_il0_set(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long StopWordsInvertedLists_il0_get(long jarg1, StopWordsInvertedLists jarg1_);
+ public final static native void StopWordsInvertedLists_maxsize_set(long jarg1, StopWordsInvertedLists jarg1_, long jarg2);
+ public final static native long StopWordsInvertedLists_maxsize_get(long jarg1, StopWordsInvertedLists jarg1_);
+ public final static native long new_StopWordsInvertedLists(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long StopWordsInvertedLists_list_size(long jarg1, StopWordsInvertedLists jarg1_, long jarg2);
+ public final static native long StopWordsInvertedLists_get_codes(long jarg1, StopWordsInvertedLists jarg1_, long jarg2);
+ public final static native long StopWordsInvertedLists_get_ids(long jarg1, StopWordsInvertedLists jarg1_, long jarg2);
+ public final static native void StopWordsInvertedLists_release_codes(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void StopWordsInvertedLists_release_ids(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long StopWordsInvertedLists_get_single_id(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long StopWordsInvertedLists_get_single_code(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void StopWordsInvertedLists_prefetch_lists(long jarg1, StopWordsInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void delete_StopWordsInvertedLists(long jarg1);
+ public final static native void Level1Quantizer_quantizer_set(long jarg1, Level1Quantizer jarg1_, long jarg2, Index jarg2_);
+ public final static native long Level1Quantizer_quantizer_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_nlist_set(long jarg1, Level1Quantizer jarg1_, long jarg2);
+ public final static native long Level1Quantizer_nlist_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_quantizer_trains_alone_set(long jarg1, Level1Quantizer jarg1_, char jarg2);
+ public final static native char Level1Quantizer_quantizer_trains_alone_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_own_fields_set(long jarg1, Level1Quantizer jarg1_, boolean jarg2);
+ public final static native boolean Level1Quantizer_own_fields_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_cp_set(long jarg1, Level1Quantizer jarg1_, long jarg2, ClusteringParameters jarg2_);
+ public final static native long Level1Quantizer_cp_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_clustering_index_set(long jarg1, Level1Quantizer jarg1_, long jarg2, Index jarg2_);
+ public final static native long Level1Quantizer_clustering_index_get(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_train_q1(long jarg1, Level1Quantizer jarg1_, long jarg2, long jarg3, boolean jarg4, int jarg5);
+ public final static native long Level1Quantizer_coarse_code_size(long jarg1, Level1Quantizer jarg1_);
+ public final static native void Level1Quantizer_encode_listno(long jarg1, Level1Quantizer jarg1_, long jarg2, long jarg3);
+ public final static native long Level1Quantizer_decode_listno(long jarg1, Level1Quantizer jarg1_, long jarg2);
+ public final static native long new_Level1Quantizer__SWIG_0(long jarg1, Index jarg1_, long jarg2);
+ public final static native long new_Level1Quantizer__SWIG_1();
+ public final static native void delete_Level1Quantizer(long jarg1);
+ public final static native void IVFSearchParameters_nprobe_set(long jarg1, IVFSearchParameters jarg1_, long jarg2);
+ public final static native long IVFSearchParameters_nprobe_get(long jarg1, IVFSearchParameters jarg1_);
+ public final static native void IVFSearchParameters_max_codes_set(long jarg1, IVFSearchParameters jarg1_, long jarg2);
+ public final static native long IVFSearchParameters_max_codes_get(long jarg1, IVFSearchParameters jarg1_);
+ public final static native long new_IVFSearchParameters();
+ public final static native void delete_IVFSearchParameters(long jarg1);
+ public final static native void IndexIVF_invlists_set(long jarg1, IndexIVF jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long IndexIVF_invlists_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_own_invlists_set(long jarg1, IndexIVF jarg1_, boolean jarg2);
+ public final static native boolean IndexIVF_own_invlists_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_code_size_set(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native long IndexIVF_code_size_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_nprobe_set(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native long IndexIVF_nprobe_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_max_codes_set(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native long IndexIVF_max_codes_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_parallel_mode_set(long jarg1, IndexIVF jarg1_, int jarg2);
+ public final static native int IndexIVF_parallel_mode_get(long jarg1, IndexIVF jarg1_);
+ public final static native int IndexIVF_PARALLEL_MODE_NO_HEAP_INIT_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_direct_map_set(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native long IndexIVF_direct_map_get(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_reset(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_train(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVF_add(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVF_add_with_ids(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexIVF_add_core(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, LongVector jarg5_);
+ public final static native void IndexIVF_encode_vectors__SWIG_0(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, boolean jarg6);
+ public final static native void IndexIVF_encode_vectors__SWIG_1(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void IndexIVF_add_sa_codes(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexIVF_train_residual(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVF_search_preassigned__SWIG_0(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9, long jarg10, IVFSearchParameters jarg10_, long jarg11, IndexIVFStats jarg11_);
+ public final static native void IndexIVF_search_preassigned__SWIG_1(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9, long jarg10, IVFSearchParameters jarg10_);
+ public final static native void IndexIVF_search_preassigned__SWIG_2(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9);
+ public final static native void IndexIVF_search(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexIVF_range_search(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexIVF_range_search_preassigned__SWIG_0(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, RangeSearchResult jarg7_, boolean jarg8, long jarg9, IVFSearchParameters jarg9_, long jarg10, IndexIVFStats jarg10_);
+ public final static native void IndexIVF_range_search_preassigned__SWIG_1(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, RangeSearchResult jarg7_, boolean jarg8, long jarg9, IVFSearchParameters jarg9_);
+ public final static native void IndexIVF_range_search_preassigned__SWIG_2(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, RangeSearchResult jarg7_, boolean jarg8);
+ public final static native void IndexIVF_range_search_preassigned__SWIG_3(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, RangeSearchResult jarg7_);
+ public final static native long IndexIVF_get_InvertedListScanner__SWIG_0(long jarg1, IndexIVF jarg1_, boolean jarg2);
+ public final static native long IndexIVF_get_InvertedListScanner__SWIG_1(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_reconstruct(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVF_update_vectors(long jarg1, IndexIVF jarg1_, int jarg2, long jarg3, LongVector jarg3_, long jarg4);
+ public final static native void IndexIVF_reconstruct_n(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVF_search_and_reconstruct(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7);
+ public final static native void IndexIVF_reconstruct_from_offset(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long IndexIVF_remove_ids(long jarg1, IndexIVF jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void IndexIVF_check_compatible_for_merge(long jarg1, IndexIVF jarg1_, long jarg2, IndexIVF jarg2_);
+ public final static native void IndexIVF_merge_from(long jarg1, IndexIVF jarg1_, long jarg2, IndexIVF jarg2_, long jarg3);
+ public final static native void IndexIVF_copy_subset_to(long jarg1, IndexIVF jarg1_, long jarg2, IndexIVF jarg2_, int jarg3, long jarg4, long jarg5);
+ public final static native void delete_IndexIVF(long jarg1);
+ public final static native long IndexIVF_get_list_size(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native void IndexIVF_make_direct_map__SWIG_0(long jarg1, IndexIVF jarg1_, boolean jarg2);
+ public final static native void IndexIVF_make_direct_map__SWIG_1(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_set_direct_map_type(long jarg1, IndexIVF jarg1_, long jarg2);
+ public final static native void IndexIVF_replace_invlists__SWIG_0(long jarg1, IndexIVF jarg1_, long jarg2, InvertedLists jarg2_, boolean jarg3);
+ public final static native void IndexIVF_replace_invlists__SWIG_1(long jarg1, IndexIVF jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long IndexIVF_sa_code_size(long jarg1, IndexIVF jarg1_);
+ public final static native void IndexIVF_sa_encode(long jarg1, IndexIVF jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFStats_nq_set(long jarg1, IndexIVFStats jarg1_, long jarg2);
+ public final static native long IndexIVFStats_nq_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_nlist_set(long jarg1, IndexIVFStats jarg1_, long jarg2);
+ public final static native long IndexIVFStats_nlist_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_ndis_set(long jarg1, IndexIVFStats jarg1_, long jarg2);
+ public final static native long IndexIVFStats_ndis_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_nheap_updates_set(long jarg1, IndexIVFStats jarg1_, long jarg2);
+ public final static native long IndexIVFStats_nheap_updates_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_quantization_time_set(long jarg1, IndexIVFStats jarg1_, double jarg2);
+ public final static native double IndexIVFStats_quantization_time_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_search_time_set(long jarg1, IndexIVFStats jarg1_, double jarg2);
+ public final static native double IndexIVFStats_search_time_get(long jarg1, IndexIVFStats jarg1_);
+ public final static native long new_IndexIVFStats();
+ public final static native void IndexIVFStats_reset(long jarg1, IndexIVFStats jarg1_);
+ public final static native void IndexIVFStats_add(long jarg1, IndexIVFStats jarg1_, long jarg2, IndexIVFStats jarg2_);
+ public final static native void delete_IndexIVFStats(long jarg1);
+ public final static native void indexIVF_stats_set(long jarg1, IndexIVFStats jarg1_);
+ public final static native long indexIVF_stats_get();
+ public final static native short[] hamdis_tab_ham_bytes_get();
+ public final static native void HammingComputer4_a0_set(long jarg1, HammingComputer4 jarg1_, long jarg2);
+ public final static native long HammingComputer4_a0_get(long jarg1, HammingComputer4 jarg1_);
+ public final static native long new_HammingComputer4__SWIG_0();
+ public final static native long new_HammingComputer4__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer4_set(long jarg1, HammingComputer4 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer4_hamming(long jarg1, HammingComputer4 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer4(long jarg1);
+ public final static native void HammingComputer8_a0_set(long jarg1, HammingComputer8 jarg1_, long jarg2);
+ public final static native long HammingComputer8_a0_get(long jarg1, HammingComputer8 jarg1_);
+ public final static native long new_HammingComputer8__SWIG_0();
+ public final static native long new_HammingComputer8__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer8_set(long jarg1, HammingComputer8 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer8_hamming(long jarg1, HammingComputer8 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer8(long jarg1);
+ public final static native void HammingComputer16_a0_set(long jarg1, HammingComputer16 jarg1_, long jarg2);
+ public final static native long HammingComputer16_a0_get(long jarg1, HammingComputer16 jarg1_);
+ public final static native void HammingComputer16_a1_set(long jarg1, HammingComputer16 jarg1_, long jarg2);
+ public final static native long HammingComputer16_a1_get(long jarg1, HammingComputer16 jarg1_);
+ public final static native long new_HammingComputer16__SWIG_0();
+ public final static native long new_HammingComputer16__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer16_set(long jarg1, HammingComputer16 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer16_hamming(long jarg1, HammingComputer16 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer16(long jarg1);
+ public final static native void HammingComputer20_a0_set(long jarg1, HammingComputer20 jarg1_, long jarg2);
+ public final static native long HammingComputer20_a0_get(long jarg1, HammingComputer20 jarg1_);
+ public final static native void HammingComputer20_a1_set(long jarg1, HammingComputer20 jarg1_, long jarg2);
+ public final static native long HammingComputer20_a1_get(long jarg1, HammingComputer20 jarg1_);
+ public final static native void HammingComputer20_a2_set(long jarg1, HammingComputer20 jarg1_, long jarg2);
+ public final static native long HammingComputer20_a2_get(long jarg1, HammingComputer20 jarg1_);
+ public final static native long new_HammingComputer20__SWIG_0();
+ public final static native long new_HammingComputer20__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer20_set(long jarg1, HammingComputer20 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer20_hamming(long jarg1, HammingComputer20 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer20(long jarg1);
+ public final static native void HammingComputer32_a0_set(long jarg1, HammingComputer32 jarg1_, long jarg2);
+ public final static native long HammingComputer32_a0_get(long jarg1, HammingComputer32 jarg1_);
+ public final static native void HammingComputer32_a1_set(long jarg1, HammingComputer32 jarg1_, long jarg2);
+ public final static native long HammingComputer32_a1_get(long jarg1, HammingComputer32 jarg1_);
+ public final static native void HammingComputer32_a2_set(long jarg1, HammingComputer32 jarg1_, long jarg2);
+ public final static native long HammingComputer32_a2_get(long jarg1, HammingComputer32 jarg1_);
+ public final static native void HammingComputer32_a3_set(long jarg1, HammingComputer32 jarg1_, long jarg2);
+ public final static native long HammingComputer32_a3_get(long jarg1, HammingComputer32 jarg1_);
+ public final static native long new_HammingComputer32__SWIG_0();
+ public final static native long new_HammingComputer32__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer32_set(long jarg1, HammingComputer32 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer32_hamming(long jarg1, HammingComputer32 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer32(long jarg1);
+ public final static native void HammingComputer64_a0_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a0_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a1_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a1_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a2_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a2_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a3_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a3_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a4_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a4_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a5_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a5_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a6_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a6_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native void HammingComputer64_a7_set(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native long HammingComputer64_a7_get(long jarg1, HammingComputer64 jarg1_);
+ public final static native long new_HammingComputer64__SWIG_0();
+ public final static native long new_HammingComputer64__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputer64_set(long jarg1, HammingComputer64 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputer64_hamming(long jarg1, HammingComputer64 jarg1_, long jarg2);
+ public final static native void delete_HammingComputer64(long jarg1);
+ public final static native void HammingComputerDefault_a8_set(long jarg1, HammingComputerDefault jarg1_, long jarg2);
+ public final static native long HammingComputerDefault_a8_get(long jarg1, HammingComputerDefault jarg1_);
+ public final static native void HammingComputerDefault_quotient8_set(long jarg1, HammingComputerDefault jarg1_, int jarg2);
+ public final static native int HammingComputerDefault_quotient8_get(long jarg1, HammingComputerDefault jarg1_);
+ public final static native void HammingComputerDefault_remainder8_set(long jarg1, HammingComputerDefault jarg1_, int jarg2);
+ public final static native int HammingComputerDefault_remainder8_get(long jarg1, HammingComputerDefault jarg1_);
+ public final static native long new_HammingComputerDefault__SWIG_0();
+ public final static native long new_HammingComputerDefault__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputerDefault_set(long jarg1, HammingComputerDefault jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputerDefault_hamming(long jarg1, HammingComputerDefault jarg1_, long jarg2);
+ public final static native void delete_HammingComputerDefault(long jarg1);
+ public final static native void HammingComputerM8_a_set(long jarg1, HammingComputerM8 jarg1_, long jarg2);
+ public final static native long HammingComputerM8_a_get(long jarg1, HammingComputerM8 jarg1_);
+ public final static native void HammingComputerM8_n_set(long jarg1, HammingComputerM8 jarg1_, int jarg2);
+ public final static native int HammingComputerM8_n_get(long jarg1, HammingComputerM8 jarg1_);
+ public final static native long new_HammingComputerM8__SWIG_0();
+ public final static native long new_HammingComputerM8__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputerM8_set(long jarg1, HammingComputerM8 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputerM8_hamming(long jarg1, HammingComputerM8 jarg1_, long jarg2);
+ public final static native void delete_HammingComputerM8(long jarg1);
+ public final static native void HammingComputerM4_a_set(long jarg1, HammingComputerM4 jarg1_, long jarg2);
+ public final static native long HammingComputerM4_a_get(long jarg1, HammingComputerM4 jarg1_);
+ public final static native void HammingComputerM4_n_set(long jarg1, HammingComputerM4 jarg1_, int jarg2);
+ public final static native int HammingComputerM4_n_get(long jarg1, HammingComputerM4 jarg1_);
+ public final static native long new_HammingComputerM4__SWIG_0();
+ public final static native long new_HammingComputerM4__SWIG_1(long jarg1, int jarg2);
+ public final static native void HammingComputerM4_set(long jarg1, HammingComputerM4 jarg1_, long jarg2, int jarg3);
+ public final static native int HammingComputerM4_hamming(long jarg1, HammingComputerM4 jarg1_, long jarg2);
+ public final static native void delete_HammingComputerM4(long jarg1);
+ public final static native int generalized_hamming_64(long jarg1);
+ public final static native void GenHammingComputer8_a0_set(long jarg1, GenHammingComputer8 jarg1_, long jarg2);
+ public final static native long GenHammingComputer8_a0_get(long jarg1, GenHammingComputer8 jarg1_);
+ public final static native long new_GenHammingComputer8(long jarg1, int jarg2);
+ public final static native int GenHammingComputer8_hamming(long jarg1, GenHammingComputer8 jarg1_, long jarg2);
+ public final static native void delete_GenHammingComputer8(long jarg1);
+ public final static native void GenHammingComputer16_a0_set(long jarg1, GenHammingComputer16 jarg1_, long jarg2);
+ public final static native long GenHammingComputer16_a0_get(long jarg1, GenHammingComputer16 jarg1_);
+ public final static native void GenHammingComputer16_a1_set(long jarg1, GenHammingComputer16 jarg1_, long jarg2);
+ public final static native long GenHammingComputer16_a1_get(long jarg1, GenHammingComputer16 jarg1_);
+ public final static native long new_GenHammingComputer16(long jarg1, int jarg2);
+ public final static native int GenHammingComputer16_hamming(long jarg1, GenHammingComputer16 jarg1_, long jarg2);
+ public final static native void delete_GenHammingComputer16(long jarg1);
+ public final static native void GenHammingComputer32_a0_set(long jarg1, GenHammingComputer32 jarg1_, long jarg2);
+ public final static native long GenHammingComputer32_a0_get(long jarg1, GenHammingComputer32 jarg1_);
+ public final static native void GenHammingComputer32_a1_set(long jarg1, GenHammingComputer32 jarg1_, long jarg2);
+ public final static native long GenHammingComputer32_a1_get(long jarg1, GenHammingComputer32 jarg1_);
+ public final static native void GenHammingComputer32_a2_set(long jarg1, GenHammingComputer32 jarg1_, long jarg2);
+ public final static native long GenHammingComputer32_a2_get(long jarg1, GenHammingComputer32 jarg1_);
+ public final static native void GenHammingComputer32_a3_set(long jarg1, GenHammingComputer32 jarg1_, long jarg2);
+ public final static native long GenHammingComputer32_a3_get(long jarg1, GenHammingComputer32 jarg1_);
+ public final static native long new_GenHammingComputer32(long jarg1, int jarg2);
+ public final static native int GenHammingComputer32_hamming(long jarg1, GenHammingComputer32 jarg1_, long jarg2);
+ public final static native void delete_GenHammingComputer32(long jarg1);
+ public final static native void GenHammingComputerM8_a_set(long jarg1, GenHammingComputerM8 jarg1_, long jarg2);
+ public final static native long GenHammingComputerM8_a_get(long jarg1, GenHammingComputerM8 jarg1_);
+ public final static native void GenHammingComputerM8_n_set(long jarg1, GenHammingComputerM8 jarg1_, int jarg2);
+ public final static native int GenHammingComputerM8_n_get(long jarg1, GenHammingComputerM8 jarg1_);
+ public final static native long new_GenHammingComputerM8(long jarg1, int jarg2);
+ public final static native int GenHammingComputerM8_hamming(long jarg1, GenHammingComputerM8 jarg1_, long jarg2);
+ public final static native void delete_GenHammingComputerM8(long jarg1);
+ public final static native void generalized_hammings_knn_hc__SWIG_0(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, int jarg6);
+ public final static native void generalized_hammings_knn_hc__SWIG_1(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void check_compatible_for_merge(long jarg1, Index jarg1_, long jarg2, Index jarg2_);
+ public final static native long extract_index_ivf__SWIG_0(long jarg1, Index jarg1_);
+ public final static native long try_extract_index_ivf__SWIG_0(long jarg1, Index jarg1_);
+ public final static native void merge_into(long jarg1, Index jarg1_, long jarg2, Index jarg2_, boolean jarg3);
+ public final static native void search_centroid(long jarg1, Index jarg1_, long jarg2, int jarg3, long jarg4, LongVector jarg4_);
+ public final static native void search_and_return_centroids(long jarg1, Index jarg1_, long jarg2, long jarg3, int jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7, LongVector jarg7_, long jarg8, LongVector jarg8_);
+ public final static native void SlidingIndexWindow_index_set(long jarg1, SlidingIndexWindow jarg1_, long jarg2, Index jarg2_);
+ public final static native long SlidingIndexWindow_index_get(long jarg1, SlidingIndexWindow jarg1_);
+ public final static native void SlidingIndexWindow_ils_set(long jarg1, SlidingIndexWindow jarg1_, long jarg2, ArrayInvertedLists jarg2_);
+ public final static native long SlidingIndexWindow_ils_get(long jarg1, SlidingIndexWindow jarg1_);
+ public final static native void SlidingIndexWindow_n_slice_set(long jarg1, SlidingIndexWindow jarg1_, int jarg2);
+ public final static native int SlidingIndexWindow_n_slice_get(long jarg1, SlidingIndexWindow jarg1_);
+ public final static native void SlidingIndexWindow_nlist_set(long jarg1, SlidingIndexWindow jarg1_, long jarg2);
+ public final static native long SlidingIndexWindow_nlist_get(long jarg1, SlidingIndexWindow jarg1_);
+ public final static native void SlidingIndexWindow_sizes_set(long jarg1, SlidingIndexWindow jarg1_, long jarg2);
+ public final static native long SlidingIndexWindow_sizes_get(long jarg1, SlidingIndexWindow jarg1_);
+ public final static native long new_SlidingIndexWindow(long jarg1, Index jarg1_);
+ public final static native void SlidingIndexWindow_step(long jarg1, SlidingIndexWindow jarg1_, long jarg2, Index jarg2_, boolean jarg3);
+ public final static native void delete_SlidingIndexWindow(long jarg1);
+ public final static native long get_invlist_range(long jarg1, Index jarg1_, int jarg2, int jarg3);
+ public final static native void set_invlist_range(long jarg1, Index jarg1_, int jarg2, int jarg3, long jarg4, ArrayInvertedLists jarg4_);
+ public final static native void search_with_parameters__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7, IVFSearchParameters jarg7_, long jarg8, long jarg9);
+ public final static native void search_with_parameters__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7, IVFSearchParameters jarg7_, long jarg8);
+ public final static native void search_with_parameters__SWIG_2(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7, IVFSearchParameters jarg7_);
+ public final static native void range_search_with_parameters__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_, long jarg6, IVFSearchParameters jarg6_, long jarg7, long jarg8);
+ public final static native void range_search_with_parameters__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_, long jarg6, IVFSearchParameters jarg6_, long jarg7);
+ public final static native void range_search_with_parameters__SWIG_2(long jarg1, Index jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_, long jarg6, IVFSearchParameters jarg6_);
+ public final static native void IndexScalarQuantizer_sq_set(long jarg1, IndexScalarQuantizer jarg1_, long jarg2);
+ public final static native long IndexScalarQuantizer_sq_get(long jarg1, IndexScalarQuantizer jarg1_);
+ public final static native long new_IndexScalarQuantizer__SWIG_0(int jarg1, long jarg2, int jarg3);
+ public final static native long new_IndexScalarQuantizer__SWIG_1(int jarg1, long jarg2);
+ public final static native long new_IndexScalarQuantizer__SWIG_2();
+ public final static native void IndexScalarQuantizer_train(long jarg1, IndexScalarQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void IndexScalarQuantizer_search(long jarg1, IndexScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native long IndexScalarQuantizer_get_distance_computer(long jarg1, IndexScalarQuantizer jarg1_);
+ public final static native void IndexScalarQuantizer_sa_encode(long jarg1, IndexScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexScalarQuantizer_sa_decode(long jarg1, IndexScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_IndexScalarQuantizer(long jarg1);
+ public final static native void IndexIVFScalarQuantizer_sq_set(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2);
+ public final static native long IndexIVFScalarQuantizer_sq_get(long jarg1, IndexIVFScalarQuantizer jarg1_);
+ public final static native void IndexIVFScalarQuantizer_by_residual_set(long jarg1, IndexIVFScalarQuantizer jarg1_, boolean jarg2);
+ public final static native boolean IndexIVFScalarQuantizer_by_residual_get(long jarg1, IndexIVFScalarQuantizer jarg1_);
+ public final static native long new_IndexIVFScalarQuantizer__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, int jarg5, boolean jarg6);
+ public final static native long new_IndexIVFScalarQuantizer__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, int jarg5);
+ public final static native long new_IndexIVFScalarQuantizer__SWIG_2(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long new_IndexIVFScalarQuantizer__SWIG_3();
+ public final static native void IndexIVFScalarQuantizer_train_residual(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVFScalarQuantizer_encode_vectors__SWIG_0(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, boolean jarg6);
+ public final static native void IndexIVFScalarQuantizer_encode_vectors__SWIG_1(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void IndexIVFScalarQuantizer_add_core(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, LongVector jarg5_);
+ public final static native long IndexIVFScalarQuantizer_get_InvertedListScanner(long jarg1, IndexIVFScalarQuantizer jarg1_, boolean jarg2);
+ public final static native void IndexIVFScalarQuantizer_reconstruct_from_offset(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFScalarQuantizer_sa_decode(long jarg1, IndexIVFScalarQuantizer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_IndexIVFScalarQuantizer(long jarg1);
+ public final static native void HNSW_MinimaxHeap_n_set(long jarg1, HNSW.MinimaxHeap jarg1_, int jarg2);
+ public final static native int HNSW_MinimaxHeap_n_get(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native void HNSW_MinimaxHeap_k_set(long jarg1, HNSW.MinimaxHeap jarg1_, int jarg2);
+ public final static native int HNSW_MinimaxHeap_k_get(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native void HNSW_MinimaxHeap_nvalid_set(long jarg1, HNSW.MinimaxHeap jarg1_, int jarg2);
+ public final static native int HNSW_MinimaxHeap_nvalid_get(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native void HNSW_MinimaxHeap_ids_set(long jarg1, HNSW.MinimaxHeap jarg1_, long jarg2, IntVector jarg2_);
+ public final static native long HNSW_MinimaxHeap_ids_get(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native void HNSW_MinimaxHeap_dis_set(long jarg1, HNSW.MinimaxHeap jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long HNSW_MinimaxHeap_dis_get(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native long new_HNSW_MinimaxHeap(int jarg1);
+ public final static native void HNSW_MinimaxHeap_push(long jarg1, HNSW.MinimaxHeap jarg1_, int jarg2, float jarg3);
+ public final static native float HNSW_MinimaxHeap_max(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native int HNSW_MinimaxHeap_size(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native void HNSW_MinimaxHeap_clear(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native int HNSW_MinimaxHeap_pop_min__SWIG_0(long jarg1, HNSW.MinimaxHeap jarg1_, long jarg2);
+ public final static native int HNSW_MinimaxHeap_pop_min__SWIG_1(long jarg1, HNSW.MinimaxHeap jarg1_);
+ public final static native int HNSW_MinimaxHeap_count_below(long jarg1, HNSW.MinimaxHeap jarg1_, float jarg2);
+ public final static native void delete_HNSW_MinimaxHeap(long jarg1);
+ public final static native void HNSW_NodeDistCloser_d_set(long jarg1, HNSW.NodeDistCloser jarg1_, float jarg2);
+ public final static native float HNSW_NodeDistCloser_d_get(long jarg1, HNSW.NodeDistCloser jarg1_);
+ public final static native void HNSW_NodeDistCloser_id_set(long jarg1, HNSW.NodeDistCloser jarg1_, int jarg2);
+ public final static native int HNSW_NodeDistCloser_id_get(long jarg1, HNSW.NodeDistCloser jarg1_);
+ public final static native long new_HNSW_NodeDistCloser(float jarg1, int jarg2);
+ public final static native void delete_HNSW_NodeDistCloser(long jarg1);
+ public final static native void HNSW_NodeDistFarther_d_set(long jarg1, HNSW.NodeDistFarther jarg1_, float jarg2);
+ public final static native float HNSW_NodeDistFarther_d_get(long jarg1, HNSW.NodeDistFarther jarg1_);
+ public final static native void HNSW_NodeDistFarther_id_set(long jarg1, HNSW.NodeDistFarther jarg1_, int jarg2);
+ public final static native int HNSW_NodeDistFarther_id_get(long jarg1, HNSW.NodeDistFarther jarg1_);
+ public final static native long new_HNSW_NodeDistFarther(float jarg1, int jarg2);
+ public final static native void delete_HNSW_NodeDistFarther(long jarg1);
+ public final static native void HNSW_assign_probas_set(long jarg1, HNSW jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native long HNSW_assign_probas_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_cum_nneighbor_per_level_set(long jarg1, HNSW jarg1_, long jarg2, IntVector jarg2_);
+ public final static native long HNSW_cum_nneighbor_per_level_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_levels_set(long jarg1, HNSW jarg1_, long jarg2, IntVector jarg2_);
+ public final static native long HNSW_levels_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_offsets_set(long jarg1, HNSW jarg1_, long jarg2, Uint64Vector jarg2_);
+ public final static native long HNSW_offsets_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_neighbors_set(long jarg1, HNSW jarg1_, long jarg2, IntVector jarg2_);
+ public final static native long HNSW_neighbors_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_entry_point_set(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_entry_point_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_rng_set(long jarg1, HNSW jarg1_, long jarg2);
+ public final static native long HNSW_rng_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_max_level_set(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_max_level_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_efConstruction_set(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_efConstruction_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_efSearch_set(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_efSearch_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_check_relative_distance_set(long jarg1, HNSW jarg1_, boolean jarg2);
+ public final static native boolean HNSW_check_relative_distance_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_upper_beam_set(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_upper_beam_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_search_bounded_queue_set(long jarg1, HNSW jarg1_, boolean jarg2);
+ public final static native boolean HNSW_search_bounded_queue_get(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_set_default_probas(long jarg1, HNSW jarg1_, int jarg2, float jarg3);
+ public final static native void HNSW_set_nb_neighbors(long jarg1, HNSW jarg1_, int jarg2, int jarg3);
+ public final static native int HNSW_nb_neighbors(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_cum_nb_neighbors(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native void HNSW_neighbor_range(long jarg1, HNSW jarg1_, long jarg2, int jarg3, long jarg4, long jarg5);
+ public final static native long new_HNSW__SWIG_0(int jarg1);
+ public final static native long new_HNSW__SWIG_1();
+ public final static native int HNSW_random_level(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_fill_with_random_links(long jarg1, HNSW jarg1_, long jarg2);
+ public final static native void HNSW_add_links_starting_from(long jarg1, HNSW jarg1_, long jarg2, DistanceComputer jarg2_, int jarg3, int jarg4, float jarg5, int jarg6, long jarg7, long jarg8, VisitedTable jarg8_);
+ public final static native void HNSW_add_with_locks(long jarg1, HNSW jarg1_, long jarg2, DistanceComputer jarg2_, int jarg3, int jarg4, long jarg5, long jarg6, VisitedTable jarg6_);
+ public final static native int HNSW_search_from_candidates__SWIG_0(long jarg1, HNSW jarg1_, long jarg2, DistanceComputer jarg2_, int jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, HNSW.MinimaxHeap jarg6_, long jarg7, VisitedTable jarg7_, long jarg8, HNSWStats jarg8_, int jarg9, int jarg10);
+ public final static native int HNSW_search_from_candidates__SWIG_1(long jarg1, HNSW jarg1_, long jarg2, DistanceComputer jarg2_, int jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, HNSW.MinimaxHeap jarg6_, long jarg7, VisitedTable jarg7_, long jarg8, HNSWStats jarg8_, int jarg9);
+ public final static native long HNSW_search_from_candidate_unbounded(long jarg1, HNSW jarg1_, long jarg2, long jarg3, DistanceComputer jarg3_, int jarg4, long jarg5, VisitedTable jarg5_, long jarg6, HNSWStats jarg6_);
+ public final static native long HNSW_search(long jarg1, HNSW jarg1_, long jarg2, DistanceComputer jarg2_, int jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, VisitedTable jarg6_);
+ public final static native void HNSW_reset(long jarg1, HNSW jarg1_);
+ public final static native void HNSW_clear_neighbor_tables(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native void HNSW_print_neighbor_stats(long jarg1, HNSW jarg1_, int jarg2);
+ public final static native int HNSW_prepare_level_tab__SWIG_0(long jarg1, HNSW jarg1_, long jarg2, boolean jarg3);
+ public final static native int HNSW_prepare_level_tab__SWIG_1(long jarg1, HNSW jarg1_, long jarg2);
+ public final static native void HNSW_shrink_neighbor_list(long jarg1, DistanceComputer jarg1_, long jarg2, long jarg3, int jarg4);
+ public final static native void delete_HNSW(long jarg1);
+ public final static native void HNSWStats_n1_set(long jarg1, HNSWStats jarg1_, long jarg2);
+ public final static native long HNSWStats_n1_get(long jarg1, HNSWStats jarg1_);
+ public final static native void HNSWStats_n2_set(long jarg1, HNSWStats jarg1_, long jarg2);
+ public final static native long HNSWStats_n2_get(long jarg1, HNSWStats jarg1_);
+ public final static native void HNSWStats_n3_set(long jarg1, HNSWStats jarg1_, long jarg2);
+ public final static native long HNSWStats_n3_get(long jarg1, HNSWStats jarg1_);
+ public final static native void HNSWStats_ndis_set(long jarg1, HNSWStats jarg1_, long jarg2);
+ public final static native long HNSWStats_ndis_get(long jarg1, HNSWStats jarg1_);
+ public final static native void HNSWStats_nreorder_set(long jarg1, HNSWStats jarg1_, long jarg2);
+ public final static native long HNSWStats_nreorder_get(long jarg1, HNSWStats jarg1_);
+ public final static native long new_HNSWStats__SWIG_0(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native long new_HNSWStats__SWIG_1(long jarg1, long jarg2, long jarg3, long jarg4);
+ public final static native long new_HNSWStats__SWIG_2(long jarg1, long jarg2, long jarg3);
+ public final static native long new_HNSWStats__SWIG_3(long jarg1, long jarg2);
+ public final static native long new_HNSWStats__SWIG_4(long jarg1);
+ public final static native long new_HNSWStats__SWIG_5();
+ public final static native void HNSWStats_reset(long jarg1, HNSWStats jarg1_);
+ public final static native void HNSWStats_combine(long jarg1, HNSWStats jarg1_, long jarg2, HNSWStats jarg2_);
+ public final static native void delete_HNSWStats(long jarg1);
+ public final static native void hnsw_stats_set(long jarg1, HNSWStats jarg1_);
+ public final static native long hnsw_stats_get();
+ public final static native long ReconstructFromNeighbors_index_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_M_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_M_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_k_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_k_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_nsq_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_nsq_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_code_size_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_code_size_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_k_reorder_set(long jarg1, ReconstructFromNeighbors jarg1_, int jarg2);
+ public final static native int ReconstructFromNeighbors_k_reorder_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_codebook_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long ReconstructFromNeighbors_codebook_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_codes_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native long ReconstructFromNeighbors_codes_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_ntotal_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_ntotal_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_d_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_d_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native void ReconstructFromNeighbors_dsub_set(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2);
+ public final static native long ReconstructFromNeighbors_dsub_get(long jarg1, ReconstructFromNeighbors jarg1_);
+ public final static native long new_ReconstructFromNeighbors__SWIG_0(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3);
+ public final static native long new_ReconstructFromNeighbors__SWIG_1(long jarg1, IndexHNSW jarg1_, long jarg2);
+ public final static native long new_ReconstructFromNeighbors__SWIG_2(long jarg1, IndexHNSW jarg1_);
+ public final static native void ReconstructFromNeighbors_add_codes(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2, long jarg3);
+ public final static native long ReconstructFromNeighbors_compute_distances(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5);
+ public final static native void ReconstructFromNeighbors_estimate_code(long jarg1, ReconstructFromNeighbors jarg1_, long jarg2, int jarg3, long jarg4);
+ public final static native void ReconstructFromNeighbors_reconstruct(long jarg1, ReconstructFromNeighbors jarg1_, int jarg2, long jarg3, long jarg4);
+ public final static native void ReconstructFromNeighbors_reconstruct_n(long jarg1, ReconstructFromNeighbors jarg1_, int jarg2, int jarg3, long jarg4);
+ public final static native void ReconstructFromNeighbors_get_neighbor_table(long jarg1, ReconstructFromNeighbors jarg1_, int jarg2, long jarg3);
+ public final static native void delete_ReconstructFromNeighbors(long jarg1);
+ public final static native void IndexHNSW_hnsw_set(long jarg1, IndexHNSW jarg1_, long jarg2, HNSW jarg2_);
+ public final static native long IndexHNSW_hnsw_get(long jarg1, IndexHNSW jarg1_);
+ public final static native void IndexHNSW_own_fields_set(long jarg1, IndexHNSW jarg1_, boolean jarg2);
+ public final static native boolean IndexHNSW_own_fields_get(long jarg1, IndexHNSW jarg1_);
+ public final static native void IndexHNSW_storage_set(long jarg1, IndexHNSW jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexHNSW_storage_get(long jarg1, IndexHNSW jarg1_);
+ public final static native void IndexHNSW_reconstruct_from_neighbors_set(long jarg1, IndexHNSW jarg1_, long jarg2, ReconstructFromNeighbors jarg2_);
+ public final static native long IndexHNSW_reconstruct_from_neighbors_get(long jarg1, IndexHNSW jarg1_);
+ public final static native long new_IndexHNSW__SWIG_0(int jarg1, int jarg2, int jarg3);
+ public final static native long new_IndexHNSW__SWIG_1(int jarg1, int jarg2);
+ public final static native long new_IndexHNSW__SWIG_2(int jarg1);
+ public final static native long new_IndexHNSW__SWIG_3();
+ public final static native long new_IndexHNSW__SWIG_4(long jarg1, Index jarg1_, int jarg2);
+ public final static native long new_IndexHNSW__SWIG_5(long jarg1, Index jarg1_);
+ public final static native void delete_IndexHNSW(long jarg1);
+ public final static native void IndexHNSW_add(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexHNSW_train(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexHNSW_search(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexHNSW_reconstruct(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexHNSW_reset(long jarg1, IndexHNSW jarg1_);
+ public final static native void IndexHNSW_shrink_level_0_neighbors(long jarg1, IndexHNSW jarg1_, int jarg2);
+ public final static native void IndexHNSW_search_level_0__SWIG_0(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7, long jarg8, LongVector jarg8_, int jarg9, int jarg10);
+ public final static native void IndexHNSW_search_level_0__SWIG_1(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7, long jarg8, LongVector jarg8_, int jarg9);
+ public final static native void IndexHNSW_search_level_0__SWIG_2(long jarg1, IndexHNSW jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, long jarg7, long jarg8, LongVector jarg8_);
+ public final static native void IndexHNSW_init_level_0_from_knngraph(long jarg1, IndexHNSW jarg1_, int jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexHNSW_init_level_0_from_entry_points(long jarg1, IndexHNSW jarg1_, int jarg2, long jarg3, long jarg4);
+ public final static native void IndexHNSW_reorder_links(long jarg1, IndexHNSW jarg1_);
+ public final static native void IndexHNSW_link_singletons(long jarg1, IndexHNSW jarg1_);
+ public final static native long new_IndexHNSWFlat__SWIG_0();
+ public final static native long new_IndexHNSWFlat__SWIG_1(int jarg1, int jarg2, int jarg3);
+ public final static native long new_IndexHNSWFlat__SWIG_2(int jarg1, int jarg2);
+ public final static native void delete_IndexHNSWFlat(long jarg1);
+ public final static native long new_IndexHNSWPQ__SWIG_0();
+ public final static native long new_IndexHNSWPQ__SWIG_1(int jarg1, int jarg2, int jarg3);
+ public final static native void IndexHNSWPQ_train(long jarg1, IndexHNSWPQ jarg1_, long jarg2, long jarg3);
+ public final static native void delete_IndexHNSWPQ(long jarg1);
+ public final static native long new_IndexHNSWSQ__SWIG_0();
+ public final static native long new_IndexHNSWSQ__SWIG_1(int jarg1, long jarg2, int jarg3, int jarg4);
+ public final static native long new_IndexHNSWSQ__SWIG_2(int jarg1, long jarg2, int jarg3);
+ public final static native void delete_IndexHNSWSQ(long jarg1);
+ public final static native long new_IndexHNSW2Level__SWIG_0();
+ public final static native long new_IndexHNSW2Level__SWIG_1(long jarg1, Index jarg1_, long jarg2, int jarg3, int jarg4);
+ public final static native void IndexHNSW2Level_flip_to_ivf(long jarg1, IndexHNSW2Level jarg1_);
+ public final static native void IndexHNSW2Level_search(long jarg1, IndexHNSW2Level jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void delete_IndexHNSW2Level(long jarg1);
+ public final static native long new_IndexIVFFlat__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, int jarg4);
+ public final static native long new_IndexIVFFlat__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVFFlat_add_core(long jarg1, IndexIVFFlat jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, LongVector jarg5_);
+ public final static native void IndexIVFFlat_encode_vectors__SWIG_0(long jarg1, IndexIVFFlat jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, boolean jarg6);
+ public final static native void IndexIVFFlat_encode_vectors__SWIG_1(long jarg1, IndexIVFFlat jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native long IndexIVFFlat_get_InvertedListScanner(long jarg1, IndexIVFFlat jarg1_, boolean jarg2);
+ public final static native void IndexIVFFlat_reconstruct_from_offset(long jarg1, IndexIVFFlat jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFFlat_sa_decode(long jarg1, IndexIVFFlat jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long new_IndexIVFFlat__SWIG_2();
+ public final static native void delete_IndexIVFFlat(long jarg1);
+ public final static native void IndexIVFFlatDedup_instances_set(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2);
+ public final static native long IndexIVFFlatDedup_instances_get(long jarg1, IndexIVFFlatDedup jarg1_);
+ public final static native long new_IndexIVFFlatDedup__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, int jarg4);
+ public final static native long new_IndexIVFFlatDedup__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVFFlatDedup_train(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVFFlatDedup_add_with_ids(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexIVFFlatDedup_search_preassigned__SWIG_0(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9, long jarg10, IVFSearchParameters jarg10_, long jarg11, IndexIVFStats jarg11_);
+ public final static native void IndexIVFFlatDedup_search_preassigned__SWIG_1(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9, long jarg10, IVFSearchParameters jarg10_);
+ public final static native void IndexIVFFlatDedup_search_preassigned__SWIG_2(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9);
+ public final static native long IndexIVFFlatDedup_remove_ids(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void IndexIVFFlatDedup_range_search(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexIVFFlatDedup_update_vectors(long jarg1, IndexIVFFlatDedup jarg1_, int jarg2, long jarg3, LongVector jarg3_, long jarg4);
+ public final static native void IndexIVFFlatDedup_reconstruct_from_offset(long jarg1, IndexIVFFlatDedup jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long new_IndexIVFFlatDedup__SWIG_2();
+ public final static native void delete_IndexIVFFlatDedup(long jarg1);
+ public final static native void OnDiskOneList_size_set(long jarg1, OnDiskOneList jarg1_, long jarg2);
+ public final static native long OnDiskOneList_size_get(long jarg1, OnDiskOneList jarg1_);
+ public final static native void OnDiskOneList_capacity_set(long jarg1, OnDiskOneList jarg1_, long jarg2);
+ public final static native long OnDiskOneList_capacity_get(long jarg1, OnDiskOneList jarg1_);
+ public final static native void OnDiskOneList_offset_set(long jarg1, OnDiskOneList jarg1_, long jarg2);
+ public final static native long OnDiskOneList_offset_get(long jarg1, OnDiskOneList jarg1_);
+ public final static native long new_OnDiskOneList();
+ public final static native void delete_OnDiskOneList(long jarg1);
+ public final static native void OnDiskInvertedLists_lists_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_lists_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_Slot_offset_set(long jarg1, OnDiskInvertedLists.Slot jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_Slot_offset_get(long jarg1, OnDiskInvertedLists.Slot jarg1_);
+ public final static native void OnDiskInvertedLists_Slot_capacity_set(long jarg1, OnDiskInvertedLists.Slot jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_Slot_capacity_get(long jarg1, OnDiskInvertedLists.Slot jarg1_);
+ public final static native long new_OnDiskInvertedLists_Slot__SWIG_0(long jarg1, long jarg2);
+ public final static native long new_OnDiskInvertedLists_Slot__SWIG_1();
+ public final static native void delete_OnDiskInvertedLists_Slot(long jarg1);
+ public final static native void OnDiskInvertedLists_slots_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_slots_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_filename_set(long jarg1, OnDiskInvertedLists jarg1_, String jarg2);
+ public final static native String OnDiskInvertedLists_filename_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_totsize_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_totsize_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_ptr_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_ptr_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_read_only_set(long jarg1, OnDiskInvertedLists jarg1_, boolean jarg2);
+ public final static native boolean OnDiskInvertedLists_read_only_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native long new_OnDiskInvertedLists__SWIG_0(long jarg1, long jarg2, String jarg3);
+ public final static native long OnDiskInvertedLists_list_size(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_get_codes(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_get_ids(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_add_entries(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void OnDiskInvertedLists_update_entries(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6);
+ public final static native void OnDiskInvertedLists_resize(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long OnDiskInvertedLists_merge_from__SWIG_0(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, int jarg3, boolean jarg4);
+ public final static native long OnDiskInvertedLists_merge_from__SWIG_1(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, int jarg3);
+ public final static native long OnDiskInvertedLists_merge_from_1__SWIG_0(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, InvertedLists jarg2_, boolean jarg3);
+ public final static native long OnDiskInvertedLists_merge_from_1__SWIG_1(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native void OnDiskInvertedLists_crop_invlists(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void OnDiskInvertedLists_prefetch_lists(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, LongVector jarg2_, int jarg3);
+ public final static native void delete_OnDiskInvertedLists(long jarg1);
+ public final static native void OnDiskInvertedLists_locks_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_locks_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_pf_set(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long OnDiskInvertedLists_pf_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_prefetch_nthread_set(long jarg1, OnDiskInvertedLists jarg1_, int jarg2);
+ public final static native int OnDiskInvertedLists_prefetch_nthread_get(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_do_mmap(long jarg1, OnDiskInvertedLists jarg1_);
+ public final static native void OnDiskInvertedLists_update_totsize(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native void OnDiskInvertedLists_resize_locked(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native long OnDiskInvertedLists_allocate_slot(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native void OnDiskInvertedLists_free_slot(long jarg1, OnDiskInvertedLists jarg1_, long jarg2, long jarg3);
+ public final static native void OnDiskInvertedLists_set_all_lists_sizes(long jarg1, OnDiskInvertedLists jarg1_, long jarg2);
+ public final static native long new_OnDiskInvertedLists__SWIG_1();
+ public final static native long new_OnDiskInvertedListsIOHook();
+ public final static native void OnDiskInvertedListsIOHook_write(long jarg1, OnDiskInvertedListsIOHook jarg1_, long jarg2, InvertedLists jarg2_, long jarg3);
+ public final static native long OnDiskInvertedListsIOHook_read(long jarg1, OnDiskInvertedListsIOHook jarg1_, long jarg2, int jarg3);
+ public final static native long OnDiskInvertedListsIOHook_read_ArrayInvertedLists(long jarg1, OnDiskInvertedListsIOHook jarg1_, long jarg2, int jarg3, long jarg4, long jarg5, long jarg6, Uint64Vector jarg6_);
+ public final static native void delete_OnDiskInvertedListsIOHook(long jarg1);
+ public final static native void IVFPQSearchParameters_scan_table_threshold_set(long jarg1, IVFPQSearchParameters jarg1_, long jarg2);
+ public final static native long IVFPQSearchParameters_scan_table_threshold_get(long jarg1, IVFPQSearchParameters jarg1_);
+ public final static native void IVFPQSearchParameters_polysemous_ht_set(long jarg1, IVFPQSearchParameters jarg1_, int jarg2);
+ public final static native int IVFPQSearchParameters_polysemous_ht_get(long jarg1, IVFPQSearchParameters jarg1_);
+ public final static native long new_IVFPQSearchParameters();
+ public final static native void delete_IVFPQSearchParameters(long jarg1);
+ public final static native void precomputed_table_max_bytes_set(long jarg1);
+ public final static native long precomputed_table_max_bytes_get();
+ public final static native void IndexIVFPQ_by_residual_set(long jarg1, IndexIVFPQ jarg1_, boolean jarg2);
+ public final static native boolean IndexIVFPQ_by_residual_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_pq_set(long jarg1, IndexIVFPQ jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long IndexIVFPQ_pq_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_do_polysemous_training_set(long jarg1, IndexIVFPQ jarg1_, boolean jarg2);
+ public final static native boolean IndexIVFPQ_do_polysemous_training_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_polysemous_training_set(long jarg1, IndexIVFPQ jarg1_, long jarg2, PolysemousTraining jarg2_);
+ public final static native long IndexIVFPQ_polysemous_training_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_scan_table_threshold_set(long jarg1, IndexIVFPQ jarg1_, long jarg2);
+ public final static native long IndexIVFPQ_scan_table_threshold_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_polysemous_ht_set(long jarg1, IndexIVFPQ jarg1_, int jarg2);
+ public final static native int IndexIVFPQ_polysemous_ht_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_use_precomputed_table_set(long jarg1, IndexIVFPQ jarg1_, int jarg2);
+ public final static native int IndexIVFPQ_use_precomputed_table_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native void IndexIVFPQ_precomputed_table_set(long jarg1, IndexIVFPQ jarg1_, long jarg2);
+ public final static native long IndexIVFPQ_precomputed_table_get(long jarg1, IndexIVFPQ jarg1_);
+ public final static native long new_IndexIVFPQ__SWIG_0(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, int jarg6);
+ public final static native long new_IndexIVFPQ__SWIG_1(long jarg1, Index jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void IndexIVFPQ_encode_vectors__SWIG_0(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, boolean jarg6);
+ public final static native void IndexIVFPQ_encode_vectors__SWIG_1(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void IndexIVFPQ_sa_decode(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFPQ_add_core(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, LongVector jarg5_);
+ public final static native void IndexIVFPQ_add_core_o__SWIG_0(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexIVFPQ_add_core_o__SWIG_1(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void IndexIVFPQ_train_residual(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIVFPQ_train_residual_o(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFPQ_reconstruct_from_offset(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long IndexIVFPQ_find_duplicates(long jarg1, IndexIVFPQ jarg1_, long jarg2, LongVector jarg2_, long jarg3);
+ public final static native void IndexIVFPQ_encode(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexIVFPQ_encode_multiple__SWIG_0(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5, boolean jarg6);
+ public final static native void IndexIVFPQ_encode_multiple__SWIG_1(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5);
+ public final static native void IndexIVFPQ_decode_multiple(long jarg1, IndexIVFPQ jarg1_, long jarg2, long jarg3, LongVector jarg3_, long jarg4, long jarg5);
+ public final static native long IndexIVFPQ_get_InvertedListScanner(long jarg1, IndexIVFPQ jarg1_, boolean jarg2);
+ public final static native void IndexIVFPQ_precompute_table(long jarg1, IndexIVFPQ jarg1_);
+ public final static native long new_IndexIVFPQ__SWIG_2();
+ public final static native void delete_IndexIVFPQ(long jarg1);
+ public final static native void initialize_IVFPQ_precomputed_table(long jarg1, long jarg2, Index jarg2_, long jarg3, ProductQuantizer jarg3_, long jarg4, boolean jarg5);
+ public final static native void IndexIVFPQStats_nrefine_set(long jarg1, IndexIVFPQStats jarg1_, long jarg2);
+ public final static native long IndexIVFPQStats_nrefine_get(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native void IndexIVFPQStats_n_hamming_pass_set(long jarg1, IndexIVFPQStats jarg1_, long jarg2);
+ public final static native long IndexIVFPQStats_n_hamming_pass_get(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native void IndexIVFPQStats_search_cycles_set(long jarg1, IndexIVFPQStats jarg1_, long jarg2);
+ public final static native long IndexIVFPQStats_search_cycles_get(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native void IndexIVFPQStats_refine_cycles_set(long jarg1, IndexIVFPQStats jarg1_, long jarg2);
+ public final static native long IndexIVFPQStats_refine_cycles_get(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native long new_IndexIVFPQStats();
+ public final static native void IndexIVFPQStats_reset(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native void delete_IndexIVFPQStats(long jarg1);
+ public final static native void indexIVFPQ_stats_set(long jarg1, IndexIVFPQStats jarg1_);
+ public final static native long indexIVFPQ_stats_get();
+ public final static native void IndexBinary_d_set(long jarg1, IndexBinary jarg1_, int jarg2);
+ public final static native int IndexBinary_d_get(long jarg1, IndexBinary jarg1_);
+ public final static native void IndexBinary_code_size_set(long jarg1, IndexBinary jarg1_, int jarg2);
+ public final static native int IndexBinary_code_size_get(long jarg1, IndexBinary jarg1_);
+ public final static native void IndexBinary_ntotal_set(long jarg1, IndexBinary jarg1_, long jarg2);
+ public final static native long IndexBinary_ntotal_get(long jarg1, IndexBinary jarg1_);
+ public final static native void IndexBinary_verbose_set(long jarg1, IndexBinary jarg1_, boolean jarg2);
+ public final static native boolean IndexBinary_verbose_get(long jarg1, IndexBinary jarg1_);
+ public final static native void IndexBinary_is_trained_set(long jarg1, IndexBinary jarg1_, boolean jarg2);
+ public final static native boolean IndexBinary_is_trained_get(long jarg1, IndexBinary jarg1_);
+ public final static native void IndexBinary_metric_type_set(long jarg1, IndexBinary jarg1_, int jarg2);
+ public final static native int IndexBinary_metric_type_get(long jarg1, IndexBinary jarg1_);
+ public final static native void delete_IndexBinary(long jarg1);
+ public final static native void IndexBinary_train(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinary_add(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinary_add_with_ids(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexBinary_search(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexBinary_range_search(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, int jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexBinary_assign__SWIG_0(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void IndexBinary_assign__SWIG_1(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexBinary_reset(long jarg1, IndexBinary jarg1_);
+ public final static native long IndexBinary_remove_ids(long jarg1, IndexBinary jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void IndexBinary_reconstruct(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinary_reconstruct_n(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexBinary_search_and_reconstruct(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7);
+ public final static native void IndexBinary_display(long jarg1, IndexBinary jarg1_);
+ public final static native void Index2Layer_q1_set(long jarg1, Index2Layer jarg1_, long jarg2, Level1Quantizer jarg2_);
+ public final static native long Index2Layer_q1_get(long jarg1, Index2Layer jarg1_);
+ public final static native void Index2Layer_pq_set(long jarg1, Index2Layer jarg1_, long jarg2, ProductQuantizer jarg2_);
+ public final static native long Index2Layer_pq_get(long jarg1, Index2Layer jarg1_);
+ public final static native void Index2Layer_code_size_1_set(long jarg1, Index2Layer jarg1_, long jarg2);
+ public final static native long Index2Layer_code_size_1_get(long jarg1, Index2Layer jarg1_);
+ public final static native void Index2Layer_code_size_2_set(long jarg1, Index2Layer jarg1_, long jarg2);
+ public final static native long Index2Layer_code_size_2_get(long jarg1, Index2Layer jarg1_);
+ public final static native long new_Index2Layer__SWIG_0(long jarg1, Index jarg1_, long jarg2, int jarg3, int jarg4, int jarg5);
+ public final static native long new_Index2Layer__SWIG_1(long jarg1, Index jarg1_, long jarg2, int jarg3, int jarg4);
+ public final static native long new_Index2Layer__SWIG_2(long jarg1, Index jarg1_, long jarg2, int jarg3);
+ public final static native long new_Index2Layer__SWIG_3();
+ public final static native void delete_Index2Layer(long jarg1);
+ public final static native void Index2Layer_train(long jarg1, Index2Layer jarg1_, long jarg2, long jarg3);
+ public final static native void Index2Layer_search(long jarg1, Index2Layer jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native long Index2Layer_get_distance_computer(long jarg1, Index2Layer jarg1_);
+ public final static native void Index2Layer_transfer_to_IVFPQ(long jarg1, Index2Layer jarg1_, long jarg2, IndexIVFPQ jarg2_);
+ public final static native void Index2Layer_sa_encode(long jarg1, Index2Layer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void Index2Layer_sa_decode(long jarg1, Index2Layer jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexBinaryFlat_xb_set(long jarg1, IndexBinaryFlat jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native long IndexBinaryFlat_xb_get(long jarg1, IndexBinaryFlat jarg1_);
+ public final static native void IndexBinaryFlat_use_heap_set(long jarg1, IndexBinaryFlat jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryFlat_use_heap_get(long jarg1, IndexBinaryFlat jarg1_);
+ public final static native void IndexBinaryFlat_query_batch_size_set(long jarg1, IndexBinaryFlat jarg1_, long jarg2);
+ public final static native long IndexBinaryFlat_query_batch_size_get(long jarg1, IndexBinaryFlat jarg1_);
+ public final static native long new_IndexBinaryFlat__SWIG_0(long jarg1);
+ public final static native void IndexBinaryFlat_add(long jarg1, IndexBinaryFlat jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryFlat_reset(long jarg1, IndexBinaryFlat jarg1_);
+ public final static native void IndexBinaryFlat_search(long jarg1, IndexBinaryFlat jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexBinaryFlat_range_search(long jarg1, IndexBinaryFlat jarg1_, long jarg2, long jarg3, int jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexBinaryFlat_reconstruct(long jarg1, IndexBinaryFlat jarg1_, long jarg2, long jarg3);
+ public final static native long IndexBinaryFlat_remove_ids(long jarg1, IndexBinaryFlat jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native long new_IndexBinaryFlat__SWIG_1();
+ public final static native void delete_IndexBinaryFlat(long jarg1);
+ public final static native void IndexBinaryIVF_invlists_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native long IndexBinaryIVF_invlists_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_own_invlists_set(long jarg1, IndexBinaryIVF jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryIVF_own_invlists_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_nprobe_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native long IndexBinaryIVF_nprobe_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_max_codes_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native long IndexBinaryIVF_max_codes_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_use_heap_set(long jarg1, IndexBinaryIVF jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryIVF_use_heap_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_direct_map_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native long IndexBinaryIVF_direct_map_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_quantizer_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2, IndexBinary jarg2_);
+ public final static native long IndexBinaryIVF_quantizer_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_nlist_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native long IndexBinaryIVF_nlist_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_own_fields_set(long jarg1, IndexBinaryIVF jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryIVF_own_fields_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_cp_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2, ClusteringParameters jarg2_);
+ public final static native long IndexBinaryIVF_cp_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_clustering_index_set(long jarg1, IndexBinaryIVF jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexBinaryIVF_clustering_index_get(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native long new_IndexBinaryIVF__SWIG_0(long jarg1, IndexBinary jarg1_, long jarg2, long jarg3);
+ public final static native long new_IndexBinaryIVF__SWIG_1();
+ public final static native void delete_IndexBinaryIVF(long jarg1);
+ public final static native void IndexBinaryIVF_reset(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_train(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryIVF_add(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryIVF_add_with_ids(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexBinaryIVF_add_core(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, LongVector jarg5_);
+ public final static native void IndexBinaryIVF_search_preassigned__SWIG_0(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9, long jarg10, IVFSearchParameters jarg10_);
+ public final static native void IndexBinaryIVF_search_preassigned__SWIG_1(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, long jarg8, LongVector jarg8_, boolean jarg9);
+ public final static native long IndexBinaryIVF_get_InvertedListScanner__SWIG_0(long jarg1, IndexBinaryIVF jarg1_, boolean jarg2);
+ public final static native long IndexBinaryIVF_get_InvertedListScanner__SWIG_1(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_search(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexBinaryIVF_range_search(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, int jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void IndexBinaryIVF_range_search_preassigned(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, int jarg4, long jarg5, LongVector jarg5_, long jarg6, long jarg7, RangeSearchResult jarg7_);
+ public final static native void IndexBinaryIVF_reconstruct(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryIVF_reconstruct_n(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexBinaryIVF_search_and_reconstruct(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_, long jarg7);
+ public final static native void IndexBinaryIVF_reconstruct_from_offset(long jarg1, IndexBinaryIVF jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long IndexBinaryIVF_remove_ids(long jarg1, IndexBinaryIVF jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void IndexBinaryIVF_merge_from(long jarg1, IndexBinaryIVF jarg1_, long jarg2, IndexBinaryIVF jarg2_, long jarg3);
+ public final static native long IndexBinaryIVF_get_list_size(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native void IndexBinaryIVF_make_direct_map__SWIG_0(long jarg1, IndexBinaryIVF jarg1_, boolean jarg2);
+ public final static native void IndexBinaryIVF_make_direct_map__SWIG_1(long jarg1, IndexBinaryIVF jarg1_);
+ public final static native void IndexBinaryIVF_set_direct_map_type(long jarg1, IndexBinaryIVF jarg1_, long jarg2);
+ public final static native void IndexBinaryIVF_replace_invlists__SWIG_0(long jarg1, IndexBinaryIVF jarg1_, long jarg2, InvertedLists jarg2_, boolean jarg3);
+ public final static native void IndexBinaryIVF_replace_invlists__SWIG_1(long jarg1, IndexBinaryIVF jarg1_, long jarg2, InvertedLists jarg2_);
+ public final static native void IndexBinaryFromFloat_index_set(long jarg1, IndexBinaryFromFloat jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexBinaryFromFloat_index_get(long jarg1, IndexBinaryFromFloat jarg1_);
+ public final static native void IndexBinaryFromFloat_own_fields_set(long jarg1, IndexBinaryFromFloat jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryFromFloat_own_fields_get(long jarg1, IndexBinaryFromFloat jarg1_);
+ public final static native long new_IndexBinaryFromFloat__SWIG_0();
+ public final static native long new_IndexBinaryFromFloat__SWIG_1(long jarg1, Index jarg1_);
+ public final static native void delete_IndexBinaryFromFloat(long jarg1);
+ public final static native void IndexBinaryFromFloat_add(long jarg1, IndexBinaryFromFloat jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryFromFloat_reset(long jarg1, IndexBinaryFromFloat jarg1_);
+ public final static native void IndexBinaryFromFloat_search(long jarg1, IndexBinaryFromFloat jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexBinaryFromFloat_train(long jarg1, IndexBinaryFromFloat jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryHNSW_hnsw_set(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, HNSW jarg2_);
+ public final static native long IndexBinaryHNSW_hnsw_get(long jarg1, IndexBinaryHNSW jarg1_);
+ public final static native void IndexBinaryHNSW_own_fields_set(long jarg1, IndexBinaryHNSW jarg1_, boolean jarg2);
+ public final static native boolean IndexBinaryHNSW_own_fields_get(long jarg1, IndexBinaryHNSW jarg1_);
+ public final static native void IndexBinaryHNSW_storage_set(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, IndexBinary jarg2_);
+ public final static native long IndexBinaryHNSW_storage_get(long jarg1, IndexBinaryHNSW jarg1_);
+ public final static native long new_IndexBinaryHNSW__SWIG_0();
+ public final static native long new_IndexBinaryHNSW__SWIG_1(int jarg1, int jarg2);
+ public final static native long new_IndexBinaryHNSW__SWIG_2(int jarg1);
+ public final static native long new_IndexBinaryHNSW__SWIG_3(long jarg1, IndexBinary jarg1_, int jarg2);
+ public final static native long new_IndexBinaryHNSW__SWIG_4(long jarg1, IndexBinary jarg1_);
+ public final static native void delete_IndexBinaryHNSW(long jarg1);
+ public final static native long IndexBinaryHNSW_get_distance_computer(long jarg1, IndexBinaryHNSW jarg1_);
+ public final static native void IndexBinaryHNSW_add(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryHNSW_train(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryHNSW_search(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexBinaryHNSW_reconstruct(long jarg1, IndexBinaryHNSW jarg1_, long jarg2, long jarg3);
+ public final static native void IndexBinaryHNSW_reset(long jarg1, IndexBinaryHNSW jarg1_);
+ public final static native void IndexRefine_base_index_set(long jarg1, IndexRefine jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexRefine_base_index_get(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_refine_index_set(long jarg1, IndexRefine jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexRefine_refine_index_get(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_own_fields_set(long jarg1, IndexRefine jarg1_, boolean jarg2);
+ public final static native boolean IndexRefine_own_fields_get(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_own_refine_index_set(long jarg1, IndexRefine jarg1_, boolean jarg2);
+ public final static native boolean IndexRefine_own_refine_index_get(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_k_factor_set(long jarg1, IndexRefine jarg1_, float jarg2);
+ public final static native float IndexRefine_k_factor_get(long jarg1, IndexRefine jarg1_);
+ public final static native long new_IndexRefine__SWIG_0(long jarg1, Index jarg1_, long jarg2, Index jarg2_);
+ public final static native long new_IndexRefine__SWIG_1();
+ public final static native void IndexRefine_train(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3);
+ public final static native void IndexRefine_add(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3);
+ public final static native void IndexRefine_reset(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_search(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexRefine_reconstruct(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3);
+ public final static native long IndexRefine_sa_code_size(long jarg1, IndexRefine jarg1_);
+ public final static native void IndexRefine_sa_encode(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void IndexRefine_sa_decode(long jarg1, IndexRefine jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void delete_IndexRefine(long jarg1);
+ public final static native long new_IndexRefineFlat__SWIG_0(long jarg1, Index jarg1_);
+ public final static native long new_IndexRefineFlat__SWIG_1(long jarg1, Index jarg1_, long jarg2);
+ public final static native long new_IndexRefineFlat__SWIG_2();
+ public final static native void IndexRefineFlat_search(long jarg1, IndexRefineFlat jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void delete_IndexRefineFlat(long jarg1);
+ public final static native void IndexSplitVectors_own_fields_set(long jarg1, IndexSplitVectors jarg1_, boolean jarg2);
+ public final static native boolean IndexSplitVectors_own_fields_get(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void IndexSplitVectors_threaded_set(long jarg1, IndexSplitVectors jarg1_, boolean jarg2);
+ public final static native boolean IndexSplitVectors_threaded_get(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void IndexSplitVectors_sub_indexes_set(long jarg1, IndexSplitVectors jarg1_, long jarg2);
+ public final static native long IndexSplitVectors_sub_indexes_get(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void IndexSplitVectors_sum_d_set(long jarg1, IndexSplitVectors jarg1_, long jarg2);
+ public final static native long IndexSplitVectors_sum_d_get(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void IndexSplitVectors_add_sub_index(long jarg1, IndexSplitVectors jarg1_, long jarg2, Index jarg2_);
+ public final static native void IndexSplitVectors_sync_with_sub_indexes(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void IndexSplitVectors_add(long jarg1, IndexSplitVectors jarg1_, long jarg2, long jarg3);
+ public final static native void IndexSplitVectors_search(long jarg1, IndexSplitVectors jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexSplitVectors_train(long jarg1, IndexSplitVectors jarg1_, long jarg2, long jarg3);
+ public final static native void IndexSplitVectors_reset(long jarg1, IndexSplitVectors jarg1_);
+ public final static native void delete_IndexSplitVectors(long jarg1);
+ public final static native void IndexIDMap_index_set(long jarg1, IndexIDMap jarg1_, long jarg2, Index jarg2_);
+ public final static native long IndexIDMap_index_get(long jarg1, IndexIDMap jarg1_);
+ public final static native void IndexIDMap_own_fields_set(long jarg1, IndexIDMap jarg1_, boolean jarg2);
+ public final static native boolean IndexIDMap_own_fields_get(long jarg1, IndexIDMap jarg1_);
+ public final static native void IndexIDMap_id_map_set(long jarg1, IndexIDMap jarg1_, long jarg2);
+ public final static native long IndexIDMap_id_map_get(long jarg1, IndexIDMap jarg1_);
+ public final static native long new_IndexIDMap__SWIG_0(long jarg1, Index jarg1_);
+ public final static native void IndexIDMap_add_with_ids(long jarg1, IndexIDMap jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexIDMap_add(long jarg1, IndexIDMap jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIDMap_search(long jarg1, IndexIDMap jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexIDMap_train(long jarg1, IndexIDMap jarg1_, long jarg2, long jarg3);
+ public final static native void IndexIDMap_reset(long jarg1, IndexIDMap jarg1_);
+ public final static native long IndexIDMap_remove_ids(long jarg1, IndexIDMap jarg1_, long jarg2, IDSelector jarg2_);
+ public final static native void IndexIDMap_range_search(long jarg1, IndexIDMap jarg1_, long jarg2, long jarg3, float jarg4, long jarg5, RangeSearchResult jarg5_);
+ public final static native void delete_IndexIDMap(long jarg1);
+ public final static native long new_IndexIDMap__SWIG_1();
+ public final static native long new_IndexShards__SWIG_0(boolean jarg1, boolean jarg2);
+ public final static native long new_IndexShards__SWIG_1(boolean jarg1);
+ public final static native long new_IndexShards__SWIG_2();
+ public final static native long new_IndexShards__SWIG_3(int jarg1, boolean jarg2, boolean jarg3);
+ public final static native long new_IndexShards__SWIG_4(int jarg1, boolean jarg2);
+ public final static native long new_IndexShards__SWIG_5(int jarg1);
+ public final static native void IndexShards_add_shard(long jarg1, IndexShards jarg1_, long jarg2, Index jarg2_);
+ public final static native void IndexShards_remove_shard(long jarg1, IndexShards jarg1_, long jarg2, Index jarg2_);
+ public final static native void IndexShards_add(long jarg1, IndexShards jarg1_, long jarg2, long jarg3);
+ public final static native void IndexShards_add_with_ids(long jarg1, IndexShards jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void IndexShards_search(long jarg1, IndexShards jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6, LongVector jarg6_);
+ public final static native void IndexShards_train(long jarg1, IndexShards jarg1_, long jarg2, long jarg3);
+ public final static native void IndexShards_successive_ids_set(long jarg1, IndexShards jarg1_, boolean jarg2);
+ public final static native boolean IndexShards_successive_ids_get(long jarg1, IndexShards jarg1_);
+ public final static native void IndexShards_syncWithSubIndexes(long jarg1, IndexShards jarg1_);
+ public final static native void delete_IndexShards(long jarg1);
+ public final static native long downcast_index(long jarg1, Index jarg1_);
+ public final static native long downcast_VectorTransform(long jarg1, VectorTransform jarg1_);
+ public final static native long downcast_IndexBinary(long jarg1, IndexBinary jarg1_);
+ public final static native long upcast_IndexShards(long jarg1, IndexShards jarg1_);
+ public final static native void write_index__SWIG_0(long jarg1, Index jarg1_, String jarg2);
+ public final static native void write_index__SWIG_1(long jarg1, Index jarg1_, long jarg2);
+ public final static native void write_index__SWIG_2(long jarg1, Index jarg1_, long jarg2);
+ public final static native void write_index_binary__SWIG_0(long jarg1, IndexBinary jarg1_, String jarg2);
+ public final static native void write_index_binary__SWIG_1(long jarg1, IndexBinary jarg1_, long jarg2);
+ public final static native void write_index_binary__SWIG_2(long jarg1, IndexBinary jarg1_, long jarg2);
+ public final static native int IO_FLAG_READ_ONLY_get();
+ public final static native int IO_FLAG_ONDISK_SAME_DIR_get();
+ public final static native int IO_FLAG_SKIP_IVF_DATA_get();
+ public final static native int IO_FLAG_MMAP_get();
+ public final static native long read_index__SWIG_0(String jarg1, int jarg2);
+ public final static native long read_index__SWIG_1(String jarg1);
+ public final static native long read_index__SWIG_2(long jarg1, int jarg2);
+ public final static native long read_index__SWIG_3(long jarg1);
+ public final static native long read_index__SWIG_4(long jarg1, int jarg2);
+ public final static native long read_index__SWIG_5(long jarg1);
+ public final static native long read_index_binary__SWIG_0(String jarg1, int jarg2);
+ public final static native long read_index_binary__SWIG_1(String jarg1);
+ public final static native long read_index_binary__SWIG_2(long jarg1, int jarg2);
+ public final static native long read_index_binary__SWIG_3(long jarg1);
+ public final static native long read_index_binary__SWIG_4(long jarg1, int jarg2);
+ public final static native long read_index_binary__SWIG_5(long jarg1);
+ public final static native void write_VectorTransform(long jarg1, VectorTransform jarg1_, String jarg2);
+ public final static native long read_VectorTransform(String jarg1);
+ public final static native long read_ProductQuantizer__SWIG_0(String jarg1);
+ public final static native long read_ProductQuantizer__SWIG_1(long jarg1);
+ public final static native void write_ProductQuantizer__SWIG_0(long jarg1, ProductQuantizer jarg1_, String jarg2);
+ public final static native void write_ProductQuantizer__SWIG_1(long jarg1, ProductQuantizer jarg1_, long jarg2);
+ public final static native void write_InvertedLists(long jarg1, InvertedLists jarg1_, long jarg2);
+ public final static native long read_InvertedLists__SWIG_0(long jarg1, int jarg2);
+ public final static native long read_InvertedLists__SWIG_1(long jarg1);
+ public final static native void AutoTuneCriterion_nq_set(long jarg1, AutoTuneCriterion jarg1_, long jarg2);
+ public final static native long AutoTuneCriterion_nq_get(long jarg1, AutoTuneCriterion jarg1_);
+ public final static native void AutoTuneCriterion_nnn_set(long jarg1, AutoTuneCriterion jarg1_, long jarg2);
+ public final static native long AutoTuneCriterion_nnn_get(long jarg1, AutoTuneCriterion jarg1_);
+ public final static native void AutoTuneCriterion_gt_nnn_set(long jarg1, AutoTuneCriterion jarg1_, long jarg2);
+ public final static native long AutoTuneCriterion_gt_nnn_get(long jarg1, AutoTuneCriterion jarg1_);
+ public final static native void AutoTuneCriterion_gt_D_set(long jarg1, AutoTuneCriterion jarg1_, long jarg2, FloatVector jarg2_);
+ public final static native long AutoTuneCriterion_gt_D_get(long jarg1, AutoTuneCriterion jarg1_);
+ public final static native void AutoTuneCriterion_gt_I_set(long jarg1, AutoTuneCriterion jarg1_, long jarg2);
+ public final static native long AutoTuneCriterion_gt_I_get(long jarg1, AutoTuneCriterion jarg1_);
+ public final static native void AutoTuneCriterion_set_groundtruth(long jarg1, AutoTuneCriterion jarg1_, int jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native double AutoTuneCriterion_evaluate(long jarg1, AutoTuneCriterion jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native void delete_AutoTuneCriterion(long jarg1);
+ public final static native void OneRecallAtRCriterion_R_set(long jarg1, OneRecallAtRCriterion jarg1_, long jarg2);
+ public final static native long OneRecallAtRCriterion_R_get(long jarg1, OneRecallAtRCriterion jarg1_);
+ public final static native long new_OneRecallAtRCriterion(long jarg1, long jarg2);
+ public final static native double OneRecallAtRCriterion_evaluate(long jarg1, OneRecallAtRCriterion jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native void delete_OneRecallAtRCriterion(long jarg1);
+ public final static native void IntersectionCriterion_R_set(long jarg1, IntersectionCriterion jarg1_, long jarg2);
+ public final static native long IntersectionCriterion_R_get(long jarg1, IntersectionCriterion jarg1_);
+ public final static native long new_IntersectionCriterion(long jarg1, long jarg2);
+ public final static native double IntersectionCriterion_evaluate(long jarg1, IntersectionCriterion jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native void delete_IntersectionCriterion(long jarg1);
+ public final static native void OperatingPoint_perf_set(long jarg1, OperatingPoint jarg1_, double jarg2);
+ public final static native double OperatingPoint_perf_get(long jarg1, OperatingPoint jarg1_);
+ public final static native void OperatingPoint_t_set(long jarg1, OperatingPoint jarg1_, double jarg2);
+ public final static native double OperatingPoint_t_get(long jarg1, OperatingPoint jarg1_);
+ public final static native void OperatingPoint_key_set(long jarg1, OperatingPoint jarg1_, String jarg2);
+ public final static native String OperatingPoint_key_get(long jarg1, OperatingPoint jarg1_);
+ public final static native void OperatingPoint_cno_set(long jarg1, OperatingPoint jarg1_, long jarg2);
+ public final static native long OperatingPoint_cno_get(long jarg1, OperatingPoint jarg1_);
+ public final static native long new_OperatingPoint();
+ public final static native void delete_OperatingPoint(long jarg1);
+ public final static native void OperatingPoints_all_pts_set(long jarg1, OperatingPoints jarg1_, long jarg2, OperatingPointVector jarg2_);
+ public final static native long OperatingPoints_all_pts_get(long jarg1, OperatingPoints jarg1_);
+ public final static native void OperatingPoints_optimal_pts_set(long jarg1, OperatingPoints jarg1_, long jarg2, OperatingPointVector jarg2_);
+ public final static native long OperatingPoints_optimal_pts_get(long jarg1, OperatingPoints jarg1_);
+ public final static native long new_OperatingPoints();
+ public final static native int OperatingPoints_merge_with__SWIG_0(long jarg1, OperatingPoints jarg1_, long jarg2, OperatingPoints jarg2_, String jarg3);
+ public final static native int OperatingPoints_merge_with__SWIG_1(long jarg1, OperatingPoints jarg1_, long jarg2, OperatingPoints jarg2_);
+ public final static native void OperatingPoints_clear(long jarg1, OperatingPoints jarg1_);
+ public final static native boolean OperatingPoints_add__SWIG_0(long jarg1, OperatingPoints jarg1_, double jarg2, double jarg3, String jarg4, long jarg5);
+ public final static native boolean OperatingPoints_add__SWIG_1(long jarg1, OperatingPoints jarg1_, double jarg2, double jarg3, String jarg4);
+ public final static native double OperatingPoints_t_for_perf(long jarg1, OperatingPoints jarg1_, double jarg2);
+ public final static native void OperatingPoints_display__SWIG_0(long jarg1, OperatingPoints jarg1_, boolean jarg2);
+ public final static native void OperatingPoints_display__SWIG_1(long jarg1, OperatingPoints jarg1_);
+ public final static native void OperatingPoints_all_to_gnuplot(long jarg1, OperatingPoints jarg1_, String jarg2);
+ public final static native void OperatingPoints_optimal_to_gnuplot(long jarg1, OperatingPoints jarg1_, String jarg2);
+ public final static native void delete_OperatingPoints(long jarg1);
+ public final static native void ParameterRange_name_set(long jarg1, ParameterRange jarg1_, String jarg2);
+ public final static native String ParameterRange_name_get(long jarg1, ParameterRange jarg1_);
+ public final static native void ParameterRange_values_set(long jarg1, ParameterRange jarg1_, long jarg2, DoubleVector jarg2_);
+ public final static native long ParameterRange_values_get(long jarg1, ParameterRange jarg1_);
+ public final static native long new_ParameterRange();
+ public final static native void delete_ParameterRange(long jarg1);
+ public final static native void ParameterSpace_parameter_ranges_set(long jarg1, ParameterSpace jarg1_, long jarg2);
+ public final static native long ParameterSpace_parameter_ranges_get(long jarg1, ParameterSpace jarg1_);
+ public final static native void ParameterSpace_verbose_set(long jarg1, ParameterSpace jarg1_, int jarg2);
+ public final static native int ParameterSpace_verbose_get(long jarg1, ParameterSpace jarg1_);
+ public final static native void ParameterSpace_n_experiments_set(long jarg1, ParameterSpace jarg1_, int jarg2);
+ public final static native int ParameterSpace_n_experiments_get(long jarg1, ParameterSpace jarg1_);
+ public final static native void ParameterSpace_batchsize_set(long jarg1, ParameterSpace jarg1_, long jarg2);
+ public final static native long ParameterSpace_batchsize_get(long jarg1, ParameterSpace jarg1_);
+ public final static native void ParameterSpace_thread_over_batches_set(long jarg1, ParameterSpace jarg1_, boolean jarg2);
+ public final static native boolean ParameterSpace_thread_over_batches_get(long jarg1, ParameterSpace jarg1_);
+ public final static native void ParameterSpace_min_test_duration_set(long jarg1, ParameterSpace jarg1_, double jarg2);
+ public final static native double ParameterSpace_min_test_duration_get(long jarg1, ParameterSpace jarg1_);
+ public final static native long new_ParameterSpace();
+ public final static native long ParameterSpace_n_combinations(long jarg1, ParameterSpace jarg1_);
+ public final static native boolean ParameterSpace_combination_ge(long jarg1, ParameterSpace jarg1_, long jarg2, long jarg3);
+ public final static native String ParameterSpace_combination_name(long jarg1, ParameterSpace jarg1_, long jarg2);
+ public final static native void ParameterSpace_display(long jarg1, ParameterSpace jarg1_);
+ public final static native long ParameterSpace_add_range(long jarg1, ParameterSpace jarg1_, String jarg2);
+ public final static native void ParameterSpace_initialize(long jarg1, ParameterSpace jarg1_, long jarg2, Index jarg2_);
+ public final static native void ParameterSpace_set_index_parameters__SWIG_0(long jarg1, ParameterSpace jarg1_, long jarg2, Index jarg2_, long jarg3);
+ public final static native void ParameterSpace_set_index_parameters__SWIG_1(long jarg1, ParameterSpace jarg1_, long jarg2, Index jarg2_, String jarg3);
+ public final static native void ParameterSpace_set_index_parameter(long jarg1, ParameterSpace jarg1_, long jarg2, Index jarg2_, String jarg3, double jarg4);
+ public final static native void ParameterSpace_update_bounds(long jarg1, ParameterSpace jarg1_, long jarg2, long jarg3, OperatingPoint jarg3_, long jarg4, long jarg5);
+ public final static native void ParameterSpace_explore(long jarg1, ParameterSpace jarg1_, long jarg2, Index jarg2_, long jarg3, long jarg4, long jarg5, AutoTuneCriterion jarg5_, long jarg6, OperatingPoints jarg6_);
+ public final static native void delete_ParameterSpace(long jarg1);
+ public final static native long index_factory__SWIG_0(int jarg1, String jarg2, int jarg3);
+ public final static native long index_factory__SWIG_1(int jarg1, String jarg2);
+ public final static native void index_factory_verbose_set(int jarg1);
+ public final static native int index_factory_verbose_get();
+ public final static native long index_binary_factory(int jarg1, String jarg2);
+ public final static native void simd_histogram_8(long jarg1, int jarg2, long jarg3, int jarg4, long jarg5);
+ public final static native void simd_histogram_16(long jarg1, int jarg2, long jarg3, int jarg4, long jarg5);
+ public final static native void PartitionStats_bissect_cycles_set(long jarg1, PartitionStats jarg1_, long jarg2);
+ public final static native long PartitionStats_bissect_cycles_get(long jarg1, PartitionStats jarg1_);
+ public final static native void PartitionStats_compress_cycles_set(long jarg1, PartitionStats jarg1_, long jarg2);
+ public final static native long PartitionStats_compress_cycles_get(long jarg1, PartitionStats jarg1_);
+ public final static native long new_PartitionStats();
+ public final static native void PartitionStats_reset(long jarg1, PartitionStats jarg1_);
+ public final static native void delete_PartitionStats(long jarg1);
+ public final static native void partition_stats_set(long jarg1, PartitionStats jarg1_);
+ public final static native long partition_stats_get();
+ public final static native void float_minheap_array_t_nh_set(long jarg1, float_minheap_array_t jarg1_, long jarg2);
+ public final static native long float_minheap_array_t_nh_get(long jarg1, float_minheap_array_t jarg1_);
+ public final static native void float_minheap_array_t_k_set(long jarg1, float_minheap_array_t jarg1_, long jarg2);
+ public final static native long float_minheap_array_t_k_get(long jarg1, float_minheap_array_t jarg1_);
+ public final static native void float_minheap_array_t_ids_set(long jarg1, float_minheap_array_t jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long float_minheap_array_t_ids_get(long jarg1, float_minheap_array_t jarg1_);
+ public final static native void float_minheap_array_t_val_set(long jarg1, float_minheap_array_t jarg1_, long jarg2);
+ public final static native long float_minheap_array_t_val_get(long jarg1, float_minheap_array_t jarg1_);
+ public final static native long float_minheap_array_t_get_val(long jarg1, float_minheap_array_t jarg1_, long jarg2);
+ public final static native long float_minheap_array_t_get_ids(long jarg1, float_minheap_array_t jarg1_, long jarg2);
+ public final static native void float_minheap_array_t_heapify(long jarg1, float_minheap_array_t jarg1_);
+ public final static native void float_minheap_array_t_addn__SWIG_0(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void float_minheap_array_t_addn__SWIG_1(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void float_minheap_array_t_addn__SWIG_2(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void float_minheap_array_t_addn__SWIG_3(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void float_minheap_array_t_addn_with_ids__SWIG_0(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, long jarg7);
+ public final static native void float_minheap_array_t_addn_with_ids__SWIG_1(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6);
+ public final static native void float_minheap_array_t_addn_with_ids__SWIG_2(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void float_minheap_array_t_addn_with_ids__SWIG_3(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void float_minheap_array_t_addn_with_ids__SWIG_4(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void float_minheap_array_t_reorder(long jarg1, float_minheap_array_t jarg1_);
+ public final static native void float_minheap_array_t_per_line_extrema(long jarg1, float_minheap_array_t jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long new_float_minheap_array_t();
+ public final static native void delete_float_minheap_array_t(long jarg1);
+ public final static native void int_minheap_array_t_nh_set(long jarg1, int_minheap_array_t jarg1_, long jarg2);
+ public final static native long int_minheap_array_t_nh_get(long jarg1, int_minheap_array_t jarg1_);
+ public final static native void int_minheap_array_t_k_set(long jarg1, int_minheap_array_t jarg1_, long jarg2);
+ public final static native long int_minheap_array_t_k_get(long jarg1, int_minheap_array_t jarg1_);
+ public final static native void int_minheap_array_t_ids_set(long jarg1, int_minheap_array_t jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long int_minheap_array_t_ids_get(long jarg1, int_minheap_array_t jarg1_);
+ public final static native void int_minheap_array_t_val_set(long jarg1, int_minheap_array_t jarg1_, long jarg2);
+ public final static native long int_minheap_array_t_val_get(long jarg1, int_minheap_array_t jarg1_);
+ public final static native long int_minheap_array_t_get_val(long jarg1, int_minheap_array_t jarg1_, long jarg2);
+ public final static native long int_minheap_array_t_get_ids(long jarg1, int_minheap_array_t jarg1_, long jarg2);
+ public final static native void int_minheap_array_t_heapify(long jarg1, int_minheap_array_t jarg1_);
+ public final static native void int_minheap_array_t_addn__SWIG_0(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void int_minheap_array_t_addn__SWIG_1(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void int_minheap_array_t_addn__SWIG_2(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void int_minheap_array_t_addn__SWIG_3(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void int_minheap_array_t_addn_with_ids__SWIG_0(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, long jarg7);
+ public final static native void int_minheap_array_t_addn_with_ids__SWIG_1(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6);
+ public final static native void int_minheap_array_t_addn_with_ids__SWIG_2(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void int_minheap_array_t_addn_with_ids__SWIG_3(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void int_minheap_array_t_addn_with_ids__SWIG_4(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void int_minheap_array_t_reorder(long jarg1, int_minheap_array_t jarg1_);
+ public final static native void int_minheap_array_t_per_line_extrema(long jarg1, int_minheap_array_t jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long new_int_minheap_array_t();
+ public final static native void delete_int_minheap_array_t(long jarg1);
+ public final static native void float_maxheap_array_t_nh_set(long jarg1, float_maxheap_array_t jarg1_, long jarg2);
+ public final static native long float_maxheap_array_t_nh_get(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native void float_maxheap_array_t_k_set(long jarg1, float_maxheap_array_t jarg1_, long jarg2);
+ public final static native long float_maxheap_array_t_k_get(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native void float_maxheap_array_t_ids_set(long jarg1, float_maxheap_array_t jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long float_maxheap_array_t_ids_get(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native void float_maxheap_array_t_val_set(long jarg1, float_maxheap_array_t jarg1_, long jarg2);
+ public final static native long float_maxheap_array_t_val_get(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native long float_maxheap_array_t_get_val(long jarg1, float_maxheap_array_t jarg1_, long jarg2);
+ public final static native long float_maxheap_array_t_get_ids(long jarg1, float_maxheap_array_t jarg1_, long jarg2);
+ public final static native void float_maxheap_array_t_heapify(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native void float_maxheap_array_t_addn__SWIG_0(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void float_maxheap_array_t_addn__SWIG_1(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void float_maxheap_array_t_addn__SWIG_2(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void float_maxheap_array_t_addn__SWIG_3(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void float_maxheap_array_t_addn_with_ids__SWIG_0(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, long jarg7);
+ public final static native void float_maxheap_array_t_addn_with_ids__SWIG_1(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6);
+ public final static native void float_maxheap_array_t_addn_with_ids__SWIG_2(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void float_maxheap_array_t_addn_with_ids__SWIG_3(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void float_maxheap_array_t_addn_with_ids__SWIG_4(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void float_maxheap_array_t_reorder(long jarg1, float_maxheap_array_t jarg1_);
+ public final static native void float_maxheap_array_t_per_line_extrema(long jarg1, float_maxheap_array_t jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long new_float_maxheap_array_t();
+ public final static native void delete_float_maxheap_array_t(long jarg1);
+ public final static native void int_maxheap_array_t_nh_set(long jarg1, int_maxheap_array_t jarg1_, long jarg2);
+ public final static native long int_maxheap_array_t_nh_get(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native void int_maxheap_array_t_k_set(long jarg1, int_maxheap_array_t jarg1_, long jarg2);
+ public final static native long int_maxheap_array_t_k_get(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native void int_maxheap_array_t_ids_set(long jarg1, int_maxheap_array_t jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long int_maxheap_array_t_ids_get(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native void int_maxheap_array_t_val_set(long jarg1, int_maxheap_array_t jarg1_, long jarg2);
+ public final static native long int_maxheap_array_t_val_get(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native long int_maxheap_array_t_get_val(long jarg1, int_maxheap_array_t jarg1_, long jarg2);
+ public final static native long int_maxheap_array_t_get_ids(long jarg1, int_maxheap_array_t jarg1_, long jarg2);
+ public final static native void int_maxheap_array_t_heapify(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native void int_maxheap_array_t_addn__SWIG_0(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void int_maxheap_array_t_addn__SWIG_1(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void int_maxheap_array_t_addn__SWIG_2(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native void int_maxheap_array_t_addn__SWIG_3(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void int_maxheap_array_t_addn_with_ids__SWIG_0(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6, long jarg7);
+ public final static native void int_maxheap_array_t_addn_with_ids__SWIG_1(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5, long jarg6);
+ public final static native void int_maxheap_array_t_addn_with_ids__SWIG_2(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void int_maxheap_array_t_addn_with_ids__SWIG_3(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_);
+ public final static native void int_maxheap_array_t_addn_with_ids__SWIG_4(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3);
+ public final static native void int_maxheap_array_t_reorder(long jarg1, int_maxheap_array_t jarg1_);
+ public final static native void int_maxheap_array_t_per_line_extrema(long jarg1, int_maxheap_array_t jarg1_, long jarg2, long jarg3, LongVector jarg3_);
+ public final static native long new_int_maxheap_array_t();
+ public final static native void delete_int_maxheap_array_t(long jarg1);
+ public final static native float CMin_float_partition_fuzzy(long jarg1, long jarg2, LongVector jarg2_, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native float CMax_float_partition_fuzzy(long jarg1, long jarg2, LongVector jarg2_, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void AlignedTableUint8_tab_set(long jarg1, AlignedTableUint8 jarg1_, long jarg2);
+ public final static native long AlignedTableUint8_tab_get(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native void AlignedTableUint8_numel_set(long jarg1, AlignedTableUint8 jarg1_, long jarg2);
+ public final static native long AlignedTableUint8_numel_get(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native long AlignedTableUint8_round_capacity(long jarg1);
+ public final static native long new_AlignedTableUint8__SWIG_0();
+ public final static native long new_AlignedTableUint8__SWIG_1(long jarg1);
+ public final static native long AlignedTableUint8_itemsize(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native void AlignedTableUint8_resize(long jarg1, AlignedTableUint8 jarg1_, long jarg2);
+ public final static native void AlignedTableUint8_clear(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native long AlignedTableUint8_size(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native long AlignedTableUint8_nbytes(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native long AlignedTableUint8_get__SWIG_0(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native long AlignedTableUint8_data__SWIG_0(long jarg1, AlignedTableUint8 jarg1_);
+ public final static native void delete_AlignedTableUint8(long jarg1);
+ public final static native void AlignedTableUint16_tab_set(long jarg1, AlignedTableUint16 jarg1_, long jarg2);
+ public final static native long AlignedTableUint16_tab_get(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native void AlignedTableUint16_numel_set(long jarg1, AlignedTableUint16 jarg1_, long jarg2);
+ public final static native long AlignedTableUint16_numel_get(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native long AlignedTableUint16_round_capacity(long jarg1);
+ public final static native long new_AlignedTableUint16__SWIG_0();
+ public final static native long new_AlignedTableUint16__SWIG_1(long jarg1);
+ public final static native long AlignedTableUint16_itemsize(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native void AlignedTableUint16_resize(long jarg1, AlignedTableUint16 jarg1_, long jarg2);
+ public final static native void AlignedTableUint16_clear(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native long AlignedTableUint16_size(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native long AlignedTableUint16_nbytes(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native long AlignedTableUint16_get__SWIG_0(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native long AlignedTableUint16_data__SWIG_0(long jarg1, AlignedTableUint16 jarg1_);
+ public final static native void delete_AlignedTableUint16(long jarg1);
+ public final static native void AlignedTableFloat32_tab_set(long jarg1, AlignedTableFloat32 jarg1_, long jarg2);
+ public final static native long AlignedTableFloat32_tab_get(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native void AlignedTableFloat32_numel_set(long jarg1, AlignedTableFloat32 jarg1_, long jarg2);
+ public final static native long AlignedTableFloat32_numel_get(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native long AlignedTableFloat32_round_capacity(long jarg1);
+ public final static native long new_AlignedTableFloat32__SWIG_0();
+ public final static native long new_AlignedTableFloat32__SWIG_1(long jarg1);
+ public final static native long AlignedTableFloat32_itemsize(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native void AlignedTableFloat32_resize(long jarg1, AlignedTableFloat32 jarg1_, long jarg2);
+ public final static native void AlignedTableFloat32_clear(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native long AlignedTableFloat32_size(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native long AlignedTableFloat32_nbytes(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native long AlignedTableFloat32_get__SWIG_0(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native long AlignedTableFloat32_data__SWIG_0(long jarg1, AlignedTableFloat32 jarg1_);
+ public final static native void delete_AlignedTableFloat32(long jarg1);
+ public final static native long CMax_uint16_partition_fuzzy__SWIG_0(long jarg1, long jarg2, LongVector jarg2_, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native long CMin_uint16_partition_fuzzy__SWIG_0(long jarg1, long jarg2, LongVector jarg2_, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native long CMax_uint16_partition_fuzzy__SWIG_1(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native long CMin_uint16_partition_fuzzy__SWIG_1(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5, long jarg6);
+ public final static native void omp_set_num_threads(int jarg1);
+ public final static native int omp_get_max_threads();
+ public final static native long memcpy(long jarg1, long jarg2, long jarg3);
+ public final static native long cast_integer_to_float_ptr(int jarg1);
+ public final static native long cast_integer_to_long_ptr(int jarg1);
+ public final static native long cast_integer_to_int_ptr(int jarg1);
+ public final static native void RangeSearchResult_nq_set(long jarg1, RangeSearchResult jarg1_, long jarg2);
+ public final static native long RangeSearchResult_nq_get(long jarg1, RangeSearchResult jarg1_);
+ public final static native void RangeSearchResult_lims_set(long jarg1, RangeSearchResult jarg1_, long jarg2);
+ public final static native long RangeSearchResult_lims_get(long jarg1, RangeSearchResult jarg1_);
+ public final static native void RangeSearchResult_labels_set(long jarg1, RangeSearchResult jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long RangeSearchResult_labels_get(long jarg1, RangeSearchResult jarg1_);
+ public final static native void RangeSearchResult_distances_set(long jarg1, RangeSearchResult jarg1_, long jarg2);
+ public final static native long RangeSearchResult_distances_get(long jarg1, RangeSearchResult jarg1_);
+ public final static native void RangeSearchResult_buffer_size_set(long jarg1, RangeSearchResult jarg1_, long jarg2);
+ public final static native long RangeSearchResult_buffer_size_get(long jarg1, RangeSearchResult jarg1_);
+ public final static native void RangeSearchResult_do_allocation(long jarg1, RangeSearchResult jarg1_);
+ public final static native void delete_RangeSearchResult(long jarg1);
+ public final static native boolean IDSelector_is_member(long jarg1, IDSelector jarg1_, long jarg2);
+ public final static native void delete_IDSelector(long jarg1);
+ public final static native void IDSelectorRange_imin_set(long jarg1, IDSelectorRange jarg1_, long jarg2);
+ public final static native long IDSelectorRange_imin_get(long jarg1, IDSelectorRange jarg1_);
+ public final static native void IDSelectorRange_imax_set(long jarg1, IDSelectorRange jarg1_, long jarg2);
+ public final static native long IDSelectorRange_imax_get(long jarg1, IDSelectorRange jarg1_);
+ public final static native long new_IDSelectorRange(long jarg1, long jarg2);
+ public final static native boolean IDSelectorRange_is_member(long jarg1, IDSelectorRange jarg1_, long jarg2);
+ public final static native void delete_IDSelectorRange(long jarg1);
+ public final static native void IDSelectorArray_n_set(long jarg1, IDSelectorArray jarg1_, long jarg2);
+ public final static native long IDSelectorArray_n_get(long jarg1, IDSelectorArray jarg1_);
+ public final static native void IDSelectorArray_ids_set(long jarg1, IDSelectorArray jarg1_, long jarg2, LongVector jarg2_);
+ public final static native long IDSelectorArray_ids_get(long jarg1, IDSelectorArray jarg1_);
+ public final static native long new_IDSelectorArray(long jarg1, long jarg2, LongVector jarg2_);
+ public final static native boolean IDSelectorArray_is_member(long jarg1, IDSelectorArray jarg1_, long jarg2);
+ public final static native void delete_IDSelectorArray(long jarg1);
+ public final static native void IDSelectorBatch_nbits_set(long jarg1, IDSelectorBatch jarg1_, int jarg2);
+ public final static native int IDSelectorBatch_nbits_get(long jarg1, IDSelectorBatch jarg1_);
+ public final static native void IDSelectorBatch_mask_set(long jarg1, IDSelectorBatch jarg1_, long jarg2);
+ public final static native long IDSelectorBatch_mask_get(long jarg1, IDSelectorBatch jarg1_);
+ public final static native long new_IDSelectorBatch(long jarg1, long jarg2, LongVector jarg2_);
+ public final static native boolean IDSelectorBatch_is_member(long jarg1, IDSelectorBatch jarg1_, long jarg2);
+ public final static native void delete_IDSelectorBatch(long jarg1);
+ public final static native void BufferList_buffer_size_set(long jarg1, BufferList jarg1_, long jarg2);
+ public final static native long BufferList_buffer_size_get(long jarg1, BufferList jarg1_);
+ public final static native void BufferList_buffers_set(long jarg1, BufferList jarg1_, long jarg2);
+ public final static native long BufferList_buffers_get(long jarg1, BufferList jarg1_);
+ public final static native void BufferList_wp_set(long jarg1, BufferList jarg1_, long jarg2);
+ public final static native long BufferList_wp_get(long jarg1, BufferList jarg1_);
+ public final static native long new_BufferList(long jarg1);
+ public final static native void delete_BufferList(long jarg1);
+ public final static native void BufferList_append_buffer(long jarg1, BufferList jarg1_);
+ public final static native void BufferList_add(long jarg1, BufferList jarg1_, long jarg2, float jarg3);
+ public final static native void BufferList_copy_range(long jarg1, BufferList jarg1_, long jarg2, long jarg3, long jarg4, LongVector jarg4_, long jarg5);
+ public final static native void RangeQueryResult_qno_set(long jarg1, RangeQueryResult jarg1_, long jarg2);
+ public final static native long RangeQueryResult_qno_get(long jarg1, RangeQueryResult jarg1_);
+ public final static native void RangeQueryResult_nres_set(long jarg1, RangeQueryResult jarg1_, long jarg2);
+ public final static native long RangeQueryResult_nres_get(long jarg1, RangeQueryResult jarg1_);
+ public final static native void RangeQueryResult_pres_set(long jarg1, RangeQueryResult jarg1_, long jarg2, RangeSearchPartialResult jarg2_);
+ public final static native long RangeQueryResult_pres_get(long jarg1, RangeQueryResult jarg1_);
+ public final static native void RangeQueryResult_add(long jarg1, RangeQueryResult jarg1_, float jarg2, long jarg3);
+ public final static native long new_RangeQueryResult();
+ public final static native void delete_RangeQueryResult(long jarg1);
+ public final static native void RangeSearchPartialResult_res_set(long jarg1, RangeSearchPartialResult jarg1_, long jarg2, RangeSearchResult jarg2_);
+ public final static native long RangeSearchPartialResult_res_get(long jarg1, RangeSearchPartialResult jarg1_);
+ public final static native void RangeSearchPartialResult_queries_set(long jarg1, RangeSearchPartialResult jarg1_, long jarg2);
+ public final static native long RangeSearchPartialResult_queries_get(long jarg1, RangeSearchPartialResult jarg1_);
+ public final static native long RangeSearchPartialResult_new_result(long jarg1, RangeSearchPartialResult jarg1_, long jarg2);
+ public final static native void RangeSearchPartialResult_set_lims(long jarg1, RangeSearchPartialResult jarg1_);
+ public final static native void RangeSearchPartialResult_copy_result__SWIG_0(long jarg1, RangeSearchPartialResult jarg1_, boolean jarg2);
+ public final static native void RangeSearchPartialResult_copy_result__SWIG_1(long jarg1, RangeSearchPartialResult jarg1_);
+ public final static native void RangeSearchPartialResult_merge__SWIG_0(long jarg1, boolean jarg2);
+ public final static native void RangeSearchPartialResult_merge__SWIG_1(long jarg1);
+ public final static native void delete_RangeSearchPartialResult(long jarg1);
+ public final static native void DistanceComputer_set_query(long jarg1, DistanceComputer jarg1_, long jarg2);
+ public final static native float DistanceComputer_symmetric_dis(long jarg1, DistanceComputer jarg1_, long jarg2, long jarg3);
+ public final static native void delete_DistanceComputer(long jarg1);
+ public final static native boolean InterruptCallback_want_interrupt(long jarg1, InterruptCallback jarg1_);
+ public final static native void delete_InterruptCallback(long jarg1);
+ public final static native void InterruptCallback_clear_instance();
+ public final static native void InterruptCallback_check();
+ public final static native boolean InterruptCallback_is_interrupted();
+ public final static native long InterruptCallback_get_period_hint(long jarg1);
+ public final static native void VisitedTable_visited_set(long jarg1, VisitedTable jarg1_, long jarg2, ByteVector jarg2_);
+ public final static native long VisitedTable_visited_get(long jarg1, VisitedTable jarg1_);
+ public final static native void VisitedTable_visno_set(long jarg1, VisitedTable jarg1_, int jarg2);
+ public final static native int VisitedTable_visno_get(long jarg1, VisitedTable jarg1_);
+ public final static native long new_VisitedTable(int jarg1);
+ public final static native void VisitedTable_set(long jarg1, VisitedTable jarg1_, int jarg2);
+ public final static native boolean VisitedTable_get(long jarg1, VisitedTable jarg1_, int jarg2);
+ public final static native void VisitedTable_advance(long jarg1, VisitedTable jarg1_);
+ public final static native void delete_VisitedTable(long jarg1);
+ public final static native void ignore_SIGTTIN();
+ public final static native void MapLong2Long_map_set(long jarg1, MapLong2Long jarg1_, long jarg2);
+ public final static native long MapLong2Long_map_get(long jarg1, MapLong2Long jarg1_);
+ public final static native void MapLong2Long_add(long jarg1, MapLong2Long jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native int MapLong2Long_search(long jarg1, MapLong2Long jarg1_, int jarg2);
+ public final static native void MapLong2Long_search_multiple(long jarg1, MapLong2Long jarg1_, long jarg2, long jarg3, long jarg4);
+ public final static native long new_MapLong2Long();
+ public final static native void delete_MapLong2Long(long jarg1);
+ public final static native long Clustering_SWIGUpcast(long jarg1);
+ public final static native long Clustering1D_SWIGUpcast(long jarg1);
+ public final static native long ProgressiveDimClusteringParameters_SWIGUpcast(long jarg1);
+ public final static native long ProgressiveDimClustering_SWIGUpcast(long jarg1);
+ public final static native long LinearTransform_SWIGUpcast(long jarg1);
+ public final static native long RandomRotationMatrix_SWIGUpcast(long jarg1);
+ public final static native long PCAMatrix_SWIGUpcast(long jarg1);
+ public final static native long ITQMatrix_SWIGUpcast(long jarg1);
+ public final static native long ITQTransform_SWIGUpcast(long jarg1);
+ public final static native long OPQMatrix_SWIGUpcast(long jarg1);
+ public final static native long RemapDimensionsTransform_SWIGUpcast(long jarg1);
+ public final static native long NormalizationTransform_SWIGUpcast(long jarg1);
+ public final static native long CenteringTransform_SWIGUpcast(long jarg1);
+ public final static native long IndexFlatCodes_SWIGUpcast(long jarg1);
+ public final static native long IndexFlat_SWIGUpcast(long jarg1);
+ public final static native long IndexFlatIP_SWIGUpcast(long jarg1);
+ public final static native long IndexFlatL2_SWIGUpcast(long jarg1);
+ public final static native long IndexFlat1D_SWIGUpcast(long jarg1);
+ public final static native long IndexLSH_SWIGUpcast(long jarg1);
+ public final static native long ReproduceDistancesObjective_SWIGUpcast(long jarg1);
+ public final static native long SimulatedAnnealingOptimizer_SWIGUpcast(long jarg1);
+ public final static native long PolysemousTraining_SWIGUpcast(long jarg1);
+ public final static native long IndexPQ_SWIGUpcast(long jarg1);
+ public final static native long MultiIndexQuantizer_SWIGUpcast(long jarg1);
+ public final static native long MultiIndexQuantizer2_SWIGUpcast(long jarg1);
+ public final static native long ArrayInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long ReadOnlyInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long HStackInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long SliceInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long VStackInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long MaskedInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long StopWordsInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long IndexIVF_SWIGUpcast(long jarg1);
+ public final static native long IndexScalarQuantizer_SWIGUpcast(long jarg1);
+ public final static native long IndexIVFScalarQuantizer_SWIGUpcast(long jarg1);
+ public final static native long IndexHNSW_SWIGUpcast(long jarg1);
+ public final static native long IndexHNSWFlat_SWIGUpcast(long jarg1);
+ public final static native long IndexHNSWPQ_SWIGUpcast(long jarg1);
+ public final static native long IndexHNSWSQ_SWIGUpcast(long jarg1);
+ public final static native long IndexHNSW2Level_SWIGUpcast(long jarg1);
+ public final static native long IndexIVFFlat_SWIGUpcast(long jarg1);
+ public final static native long IndexIVFFlatDedup_SWIGUpcast(long jarg1);
+ public final static native long OnDiskInvertedLists_SWIGUpcast(long jarg1);
+ public final static native long IVFPQSearchParameters_SWIGUpcast(long jarg1);
+ public final static native long IndexIVFPQ_SWIGUpcast(long jarg1);
+ public final static native long Index2Layer_SWIGUpcast(long jarg1);
+ public final static native long IndexBinaryFlat_SWIGUpcast(long jarg1);
+ public final static native long IndexBinaryIVF_SWIGUpcast(long jarg1);
+ public final static native long IndexBinaryFromFloat_SWIGUpcast(long jarg1);
+ public final static native long IndexBinaryHNSW_SWIGUpcast(long jarg1);
+ public final static native long IndexRefine_SWIGUpcast(long jarg1);
+ public final static native long IndexRefineFlat_SWIGUpcast(long jarg1);
+ public final static native long IndexSplitVectors_SWIGUpcast(long jarg1);
+ public final static native long IndexIDMap_SWIGUpcast(long jarg1);
+ public final static native long OneRecallAtRCriterion_SWIGUpcast(long jarg1);
+ public final static native long IntersectionCriterion_SWIGUpcast(long jarg1);
+ public final static native long IDSelectorRange_SWIGUpcast(long jarg1);
+ public final static native long IDSelectorArray_SWIGUpcast(long jarg1);
+ public final static native long IDSelectorBatch_SWIGUpcast(long jarg1);
+ public final static native long RangeSearchPartialResult_SWIGUpcast(long jarg1);
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/BUILD b/ann/src/main/java/com/twitter/ann/hnsw/BUILD
new file mode 100644
index 000000000..b7534c6e7
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/BUILD
@@ -0,0 +1,18 @@
+java_library(
+ sources = ["*.java"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [
+ "3rdparty/jvm/com/google/guava",
+ "3rdparty/jvm/com/google/inject:guice",
+ "3rdparty/jvm/com/twitter/bijection:core",
+ "3rdparty/jvm/commons-lang",
+ "3rdparty/jvm/org/apache/thrift",
+ "ann/src/main/scala/com/twitter/ann/common",
+ "ann/src/main/thrift/com/twitter/ann/common:ann-common-java",
+ "mediaservices/commons/src/main/scala:futuretracker",
+ "scrooge/scrooge-core",
+ "src/java/com/twitter/search/common/file",
+ ],
+)
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/DistanceFunction.java b/ann/src/main/java/com/twitter/ann/hnsw/DistanceFunction.java
new file mode 100644
index 000000000..a7adf126f
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/DistanceFunction.java
@@ -0,0 +1,8 @@
+package com.twitter.ann.hnsw;
+
+public interface DistanceFunction {
+ /**
+ * Distance between two items.
+ */
+ float distance(T t, Q q);
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/DistancedItem.java b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItem.java
new file mode 100644
index 000000000..cc3fb6a7a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItem.java
@@ -0,0 +1,23 @@
+package com.twitter.ann.hnsw;
+
+/**
+ * An item associated with a float distance
+ * @param The type of the item.
+ */
+public class DistancedItem {
+ private final T item;
+ private final float distance;
+
+ public DistancedItem(T item, float distance) {
+ this.item = item;
+ this.distance = distance;
+ }
+
+ public T getItem() {
+ return item;
+ }
+
+ public float getDistance() {
+ return distance;
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java
new file mode 100644
index 000000000..f77f9c2b2
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java
@@ -0,0 +1,196 @@
+package com.twitter.ann.hnsw;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.PriorityQueue;
+
+/**
+ * Container for items with their distance.
+ *
+ * @param Type of origin/reference element.
+ * @param Type of element that the queue will hold
+ */
+public class DistancedItemQueue implements Iterable> {
+ private final U origin;
+ private final DistanceFunction distFn;
+ private final PriorityQueue> queue;
+ private final boolean minQueue;
+ /**
+ * Creates ontainer for items with their distances.
+ *
+ * @param origin Origin (reference) point
+ * @param initial Initial list of elements to add in the structure
+ * @param minQueue True for min queue, False for max queue
+ * @param distFn Distance function
+ */
+ public DistancedItemQueue(
+ U origin,
+ List initial,
+ boolean minQueue,
+ DistanceFunction distFn
+ ) {
+ this.origin = origin;
+ this.distFn = distFn;
+ this.minQueue = minQueue;
+ final Comparator> cmp;
+ if (minQueue) {
+ cmp = (o1, o2) -> Float.compare(o1.getDistance(), o2.getDistance());
+ } else {
+ cmp = (o1, o2) -> Float.compare(o2.getDistance(), o1.getDistance());
+ }
+ this.queue = new PriorityQueue<>(cmp);
+ enqueueAll(initial);
+ new DistancedItemQueue<>(origin, distFn, queue, minQueue);
+ }
+
+ private DistancedItemQueue(
+ U origin,
+ DistanceFunction distFn,
+ PriorityQueue> queue,
+ boolean minQueue
+ ) {
+ this.origin = origin;
+ this.distFn = distFn;
+ this.queue = queue;
+ this.minQueue = minQueue;
+ }
+
+ /**
+ * Enqueues all the items into the queue.
+ */
+ public void enqueueAll(List list) {
+ for (T t : list) {
+ enqueue(t);
+ }
+ }
+
+ /**
+ * Return if queue is non empty or not
+ *
+ * @return true if queue is not empty else false
+ */
+ public boolean nonEmpty() {
+ return !queue.isEmpty();
+ }
+
+ /**
+ * Return root of the queue
+ *
+ * @return root of the queue i.e min/max element depending upon min-max queue
+ */
+ public DistancedItem peek() {
+ return queue.peek();
+ }
+
+ /**
+ * Dequeue root of the queue.
+ *
+ * @return remove and return root of the queue i.e min/max element depending upon min-max queue
+ */
+ public DistancedItem dequeue() {
+ return queue.poll();
+ }
+
+ /**
+ * Dequeue all the elements from queueu with ordering mantained
+ *
+ * @return remove all the elements in the order of the queue i.e min/max queue.
+ */
+ public List> dequeueAll() {
+ final List> list = new ArrayList<>(queue.size());
+ while (!queue.isEmpty()) {
+ list.add(queue.poll());
+ }
+
+ return list;
+ }
+
+ /**
+ * Convert queue to list
+ *
+ * @return list of elements of queue with distance and without any specific ordering
+ */
+ public List> toList() {
+ return new ArrayList<>(queue);
+ }
+
+ /**
+ * Convert queue to list
+ *
+ * @return list of elements of queue without any specific ordering
+ */
+ List toListWithItem() {
+ List list = new ArrayList<>(queue.size());
+ Iterator> itr = iterator();
+ while (itr.hasNext()) {
+ list.add(itr.next().getItem());
+ }
+ return list;
+ }
+
+ /**
+ * Enqueue an item into the queue
+ */
+ public void enqueue(T item) {
+ queue.add(new DistancedItem<>(item, distFn.distance(origin, item)));
+ }
+
+ /**
+ * Enqueue an item into the queue with its distance.
+ */
+ public void enqueue(T item, float distance) {
+ queue.add(new DistancedItem<>(item, distance));
+ }
+
+ /**
+ * Size
+ *
+ * @return size of the queue
+ */
+ public int size() {
+ return queue.size();
+ }
+
+ /**
+ * Is Min queue
+ *
+ * @return true if min queue else false
+ */
+ public boolean isMinQueue() {
+ return minQueue;
+ }
+
+ /**
+ * Returns origin (base element) of the queue
+ *
+ * @return origin of the queue
+ */
+ public U getOrigin() {
+ return origin;
+ }
+
+ /**
+ * Return a new queue with ordering reversed.
+ */
+ public DistancedItemQueue reverse() {
+ final PriorityQueue> rqueue =
+ new PriorityQueue<>(queue.comparator().reversed());
+ if (queue.isEmpty()) {
+ return new DistancedItemQueue<>(origin, distFn, rqueue, !isMinQueue());
+ }
+
+ final Iterator> itr = iterator();
+ while (itr.hasNext()) {
+ rqueue.add(itr.next());
+ }
+
+ return new DistancedItemQueue<>(origin, distFn, rqueue, !isMinQueue());
+ }
+
+ @Override
+ public Iterator> iterator() {
+ return queue.iterator();
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/HnswIndex.java b/ann/src/main/java/com/twitter/ann/hnsw/HnswIndex.java
new file mode 100644
index 000000000..2f9c91409
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/HnswIndex.java
@@ -0,0 +1,711 @@
+package com.twitter.ann.hnsw;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.function.Function;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+
+import org.apache.thrift.TException;
+
+import com.twitter.ann.common.IndexOutputFile;
+import com.twitter.ann.common.thriftjava.HnswInternalIndexMetadata;
+import com.twitter.bijection.Injection;
+import com.twitter.logging.Logger;
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec;
+import com.twitter.search.common.file.AbstractFile;
+
+/**
+ * Typed multithreaded HNSW implementation supporting creation/querying of approximate nearest neighbour
+ * Paper: https://arxiv.org/pdf/1603.09320.pdf
+ * Multithreading impl based on NMSLIB version : https://github.com/nmslib/hnsw/blob/master/hnswlib/hnswalg.h
+ *
+ * @param The type of items inserted / searched in the HNSW index.
+ * @param The type of KNN query.
+ */
+public class HnswIndex {
+ private static final Logger LOG = Logger.get(HnswIndex.class);
+ private static final String METADATA_FILE_NAME = "hnsw_internal_metadata";
+ private static final String GRAPH_FILE_NAME = "hnsw_internal_graph";
+ private static final int MAP_SIZE_FACTOR = 5;
+
+ private final DistanceFunction distFnIndex;
+ private final DistanceFunction distFnQuery;
+ private final int efConstruction;
+ private final int maxM;
+ private final int maxM0;
+ private final double levelMultiplier;
+ private final AtomicReference> graphMeta = new AtomicReference<>();
+ private final Map, ImmutableList> graph;
+ // To take lock on vertex level
+ private final ConcurrentHashMap locks;
+ // To take lock on whole graph only if vertex addition is on layer above the current maxLevel
+ private final ReentrantLock globalLock;
+ private final Function lockProvider;
+
+ private final RandomProvider randomProvider;
+
+ // Probability of reevaluating connections of an element in the neighborhood during an update
+ // Can be used as a knob to adjust update_speed/search_speed tradeoff.
+ private final float updateNeighborProbability;
+
+ /**
+ * Creates instance of hnsw index.
+ *
+ * @param distFnIndex Any distance metric/non metric that specifies similarity between two items for indexing.
+ * @param distFnQuery Any distance metric/non metric that specifies similarity between item for which nearest neighbours queried for and already indexed item.
+ * @param efConstruction Provide speed vs index quality tradeoff, higher the value better the quality and higher the time to create index.
+ * Valid range of efConstruction can be anywhere between 1 and tens of thousand. Typically, it should be set so that a search of M
+ * neighbors with ef=efConstruction should end in recall>0.95.
+ * @param maxM Maximum connections per layer except 0th level.
+ * Optimal values between 5-48.
+ * Smaller M generally produces better result for lower recalls and/ or lower dimensional data,
+ * while bigger M is better for high recall and/ or high dimensional, data on the expense of more memory/disk usage
+ * @param expectedElements Approximate number of elements to be indexed
+ */
+ protected HnswIndex(
+ DistanceFunction distFnIndex,
+ DistanceFunction distFnQuery,
+ int efConstruction,
+ int maxM,
+ int expectedElements,
+ RandomProvider randomProvider
+ ) {
+ this(distFnIndex,
+ distFnQuery,
+ efConstruction,
+ maxM,
+ expectedElements,
+ new HnswMeta<>(-1, Optional.empty()),
+ new ConcurrentHashMap<>(MAP_SIZE_FACTOR * expectedElements),
+ randomProvider
+ );
+ }
+
+ private HnswIndex(
+ DistanceFunction distFnIndex,
+ DistanceFunction distFnQuery,
+ int efConstruction,
+ int maxM,
+ int expectedElements,
+ HnswMeta graphMeta,
+ Map, ImmutableList> graph,
+ RandomProvider randomProvider
+ ) {
+ this.distFnIndex = distFnIndex;
+ this.distFnQuery = distFnQuery;
+ this.efConstruction = efConstruction;
+ this.maxM = maxM;
+ this.maxM0 = 2 * maxM;
+ this.levelMultiplier = 1.0 / Math.log(1.0 * maxM);
+ this.graphMeta.set(graphMeta);
+ this.graph = graph;
+ this.locks = new ConcurrentHashMap<>(MAP_SIZE_FACTOR * expectedElements);
+ this.globalLock = new ReentrantLock();
+ this.lockProvider = key -> new ReentrantReadWriteLock();
+ this.randomProvider = randomProvider;
+ this.updateNeighborProbability = 1.0f;
+ }
+
+ /**
+ * wireConnectionForAllLayers finds connections for a new element and creates bi-direction links.
+ * The method assumes using a reentrant lock to link list reads.
+ *
+ * @param entryPoint the global entry point
+ * @param item the item for which the connections are found
+ * @param itemLevel the level of the added item (maximum layer in which we wire the connections)
+ * @param maxLayer the level of the entry point
+ */
+ private void wireConnectionForAllLayers(final T entryPoint, final T item, final int itemLevel,
+ final int maxLayer, final boolean isUpdate) {
+ T curObj = entryPoint;
+ if (itemLevel < maxLayer) {
+ curObj = bestEntryPointUntilLayer(curObj, item, maxLayer, itemLevel, distFnIndex);
+ }
+ for (int level = Math.min(itemLevel, maxLayer); level >= 0; level--) {
+ final DistancedItemQueue candidates =
+ searchLayerForCandidates(item, curObj, efConstruction, level, distFnIndex, isUpdate);
+ curObj = mutuallyConnectNewElement(item, candidates, level, isUpdate);
+ }
+ }
+
+ /**
+ * Insert the item into HNSW index.
+ */
+ public void insert(final T item) throws IllegalDuplicateInsertException {
+ final Lock itemLock = locks.computeIfAbsent(item, lockProvider).writeLock();
+ itemLock.lock();
+ try {
+ final HnswMeta metadata = graphMeta.get();
+ // If the graph already have the item, should not re-insert it again
+ // Need to check entry point in case we reinsert first item where is are no graph
+ // but only a entry point
+ if (graph.containsKey(HnswNode.from(0, item))
+ || (metadata.getEntryPoint().isPresent()
+ && Objects.equals(metadata.getEntryPoint().get(), item))) {
+ throw new IllegalDuplicateInsertException(
+ "Duplicate insertion is not supported: " + item);
+ }
+ final int curLevel = getRandomLevel();
+ Optional entryPoint = metadata.getEntryPoint();
+ // The global lock prevents two threads from making changes to the entry point. This lock
+ // should get taken very infrequently. Something like log-base-levelMultiplier(num items)
+ // For a full explanation of locking see this document: http://go/hnsw-locking
+ int maxLevelCopy = metadata.getMaxLevel();
+ if (curLevel > maxLevelCopy) {
+ globalLock.lock();
+ // Re initialize the entryPoint and maxLevel in case these are changed by any other thread
+ // No need to check the condition again since,
+ // it is already checked at the end before updating entry point struct
+ // No need to unlock for optimization and keeping as is if condition fails since threads
+ // will not be entering this section a lot.
+ final HnswMeta temp = graphMeta.get();
+ entryPoint = temp.getEntryPoint();
+ maxLevelCopy = temp.getMaxLevel();
+ }
+
+ if (entryPoint.isPresent()) {
+ wireConnectionForAllLayers(entryPoint.get(), item, curLevel, maxLevelCopy, false);
+ }
+
+ if (curLevel > maxLevelCopy) {
+ Preconditions.checkState(globalLock.isHeldByCurrentThread(),
+ "Global lock not held before updating entry point");
+ graphMeta.set(new HnswMeta<>(curLevel, Optional.of(item)));
+ }
+ } finally {
+ if (globalLock.isHeldByCurrentThread()) {
+ globalLock.unlock();
+ }
+ itemLock.unlock();
+ }
+ }
+
+ /**
+ * set connections of an element with synchronization
+ * The only other place that should have the lock for writing is during
+ * the element insertion
+ */
+ private void setConnectionList(final T item, int layer, List connections) {
+ final Lock candidateLock = locks.computeIfAbsent(item, lockProvider).writeLock();
+ candidateLock.lock();
+ try {
+ graph.put(
+ HnswNode.from(layer, item),
+ ImmutableList.copyOf(connections)
+ );
+ } finally {
+ candidateLock.unlock();
+ }
+ }
+
+ /**
+ * Reinsert the item into HNSW index.
+ * This method updates the links of an element assuming
+ * the element's distance function is changed externally (e.g. by updating the features)
+ */
+
+ public void reInsert(final T item) {
+ final HnswMeta metadata = graphMeta.get();
+
+ Optional entryPoint = metadata.getEntryPoint();
+
+ Preconditions.checkState(entryPoint.isPresent(),
+ "Update cannot be performed if entry point is not present");
+
+ // This is a check for the single element case
+ if (entryPoint.get().equals(item) && graph.isEmpty()) {
+ return;
+ }
+
+ Preconditions.checkState(graph.containsKey(HnswNode.from(0, item)),
+ "Graph does not contain the item to be updated at level 0");
+
+ int curLevel = 0;
+
+ int maxLevelCopy = metadata.getMaxLevel();
+
+ for (int layer = maxLevelCopy; layer >= 0; layer--) {
+ if (graph.containsKey(HnswNode.from(layer, item))) {
+ curLevel = layer;
+ break;
+ }
+ }
+
+ // Updating the links of the elements from the 1-hop radius of the updated element
+
+ for (int layer = 0; layer <= curLevel; layer++) {
+
+ // Filling the element sets for candidates and updated elements
+ final HashSet setCand = new HashSet();
+ final HashSet setNeigh = new HashSet();
+ final List listOneHop = getConnectionListForRead(item, layer);
+
+ if (listOneHop.isEmpty()) {
+ LOG.debug("No links for the updated element. Empty dataset?");
+ continue;
+ }
+
+ setCand.add(item);
+
+ for (T elOneHop : listOneHop) {
+ setCand.add(elOneHop);
+ if (randomProvider.get().nextFloat() > updateNeighborProbability) {
+ continue;
+ }
+ setNeigh.add(elOneHop);
+ final List listTwoHop = getConnectionListForRead(elOneHop, layer);
+
+ if (listTwoHop.isEmpty()) {
+ LOG.debug("No links for the updated element. Empty dataset?");
+ }
+
+ for (T oneHopEl : listTwoHop) {
+ setCand.add(oneHopEl);
+ }
+ }
+ // No need to update the item itself, so remove it
+ setNeigh.remove(item);
+
+ // Updating the link lists of elements from setNeigh:
+ for (T neigh : setNeigh) {
+ final HashSet setCopy = new HashSet(setCand);
+ setCopy.remove(neigh);
+ int keepElementsNum = Math.min(efConstruction, setCopy.size());
+ final DistancedItemQueue candidates = new DistancedItemQueue<>(
+ neigh,
+ ImmutableList.of(),
+ false,
+ distFnIndex
+ );
+ for (T cand : setCopy) {
+ final float distance = distFnIndex.distance(neigh, cand);
+ if (candidates.size() < keepElementsNum) {
+ candidates.enqueue(cand, distance);
+ } else {
+ if (distance < candidates.peek().getDistance()) {
+ candidates.dequeue();
+ candidates.enqueue(cand, distance);
+ }
+ }
+ }
+ final ImmutableList neighbours = selectNearestNeighboursByHeuristic(
+ candidates,
+ layer == 0 ? maxM0 : maxM
+ );
+
+ final List temp = getConnectionListForRead(neigh, layer);
+ if (temp.isEmpty()) {
+ LOG.debug("existing linkslist is empty. Corrupt index");
+ }
+ if (neighbours.isEmpty()) {
+ LOG.debug("predicted linkslist is empty. Corrupt index");
+ }
+ setConnectionList(neigh, layer, neighbours);
+
+ }
+
+
+ }
+ wireConnectionForAllLayers(metadata.getEntryPoint().get(), item, curLevel, maxLevelCopy, true);
+ }
+
+ /**
+ * This method can be used to get the graph statistics, specifically
+ * it prints the histogram of inbound connections for each element.
+ */
+ private String getStats() {
+ int histogramMaxBins = 50;
+ int[] histogram = new int[histogramMaxBins];
+ HashMap mmap = new HashMap();
+ for (HnswNode key : graph.keySet()) {
+ if (key.level == 0) {
+ List linkList = getConnectionListForRead(key.item, key.level);
+ for (T node : linkList) {
+ int a = mmap.computeIfAbsent(node, k -> 0);
+ mmap.put(node, a + 1);
+
+ }
+ }
+ }
+
+ for (T key : mmap.keySet()) {
+ int ind = mmap.get(key) < histogramMaxBins - 1 ? mmap.get(key) : histogramMaxBins - 1;
+ histogram[ind]++;
+ }
+ int minNonZeroIndex;
+ for (minNonZeroIndex = histogramMaxBins - 1; minNonZeroIndex >= 0; minNonZeroIndex--) {
+ if (histogram[minNonZeroIndex] > 0) {
+ break;
+ }
+ }
+
+ String output = "";
+ for (int i = 0; i <= minNonZeroIndex; i++) {
+ output += "" + i + "\t" + histogram[i] / (0.01f * mmap.keySet().size()) + "\n";
+ }
+
+ return output;
+ }
+
+ private int getRandomLevel() {
+ return (int) (-Math.log(randomProvider.get().nextDouble()) * levelMultiplier);
+ }
+
+ /**
+ * Note that to avoid deadlocks it is important that this method is called after all the searches
+ * of the graph have completed. If you take a lock on any items discovered in the graph after
+ * this, you may get stuck waiting on a thread that is waiting for item to be fully inserted.
+ *
+ * Note: when using concurrent writers we can miss connections that we would otherwise get.
+ * This will reduce the recall.
+ *
+ * For a full explanation of locking see this document: http://go/hnsw-locking
+ * The method returns the closest nearest neighbor (can be used as an enter point)
+ */
+ private T mutuallyConnectNewElement(
+ final T item,
+ final DistancedItemQueue candidates, // Max queue
+ final int level,
+ final boolean isUpdate
+ ) {
+
+ // Using maxM here. Its implementation is ambiguous in HNSW paper,
+ // so using the way it is getting used in Hnsw lib.
+ final ImmutableList neighbours = selectNearestNeighboursByHeuristic(candidates, maxM);
+ setConnectionList(item, level, neighbours);
+ final int M = level == 0 ? maxM0 : maxM;
+ for (T nn : neighbours) {
+ if (nn.equals(item)) {
+ continue;
+ }
+ final Lock curLock = locks.computeIfAbsent(nn, lockProvider).writeLock();
+ curLock.lock();
+ try {
+ final HnswNode key = HnswNode.from(level, nn);
+ final ImmutableList connections = graph.getOrDefault(key, ImmutableList.of());
+ final boolean isItemAlreadyPresent =
+ isUpdate && connections.indexOf(item) != -1 ? true : false;
+
+ // If `item` is already present in the neighboring connections,
+ // then no need to modify any connections or run the search heuristics.
+ if (isItemAlreadyPresent) {
+ continue;
+ }
+
+ final ImmutableList updatedConnections;
+ if (connections.size() < M) {
+ final List temp = new ArrayList<>(connections);
+ temp.add(item);
+ updatedConnections = ImmutableList.copyOf(temp.iterator());
+ } else {
+ // Max Queue
+ final DistancedItemQueue queue = new DistancedItemQueue<>(
+ nn,
+ connections,
+ false,
+ distFnIndex
+ );
+ queue.enqueue(item);
+ updatedConnections = selectNearestNeighboursByHeuristic(queue, M);
+ }
+ if (updatedConnections.isEmpty()) {
+ LOG.debug("Internal error: predicted linkslist is empty");
+ }
+
+ graph.put(key, updatedConnections);
+ } finally {
+ curLock.unlock();
+ }
+ }
+ return neighbours.get(0);
+ }
+
+ /*
+ * bestEntryPointUntilLayer starts the graph search for item from the entry point
+ * until the searches reaches the selectedLayer layer.
+ * @return a point from selectedLayer layer, was the closest on the (selectedLayer+1) layer
+ */
+ private T bestEntryPointUntilLayer(
+ final T entryPoint,
+ final K item,
+ int maxLayer,
+ int selectedLayer,
+ DistanceFunction distFn
+ ) {
+ T curObj = entryPoint;
+ if (selectedLayer < maxLayer) {
+ float curDist = distFn.distance(item, curObj);
+ for (int level = maxLayer; level > selectedLayer; level--) {
+ boolean changed = true;
+ while (changed) {
+ changed = false;
+ final List list = getConnectionListForRead(curObj, level);
+ for (T nn : list) {
+ final float tempDist = distFn.distance(item, nn);
+ if (tempDist < curDist) {
+ curDist = tempDist;
+ curObj = nn;
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+
+ return curObj;
+ }
+
+
+ @VisibleForTesting
+ protected ImmutableList selectNearestNeighboursByHeuristic(
+ final DistancedItemQueue candidates, // Max queue
+ final int maxConnections
+ ) {
+ Preconditions.checkState(!candidates.isMinQueue(),
+ "candidates in selectNearestNeighboursByHeuristic should be a max queue");
+
+ final T baseElement = candidates.getOrigin();
+ if (candidates.size() <= maxConnections) {
+ List list = candidates.toListWithItem();
+ list.remove(baseElement);
+ return ImmutableList.copyOf(list);
+ } else {
+ final List resSet = new ArrayList<>(maxConnections);
+ // Min queue for closest elements first
+ final DistancedItemQueue minQueue = candidates.reverse();
+ while (minQueue.nonEmpty()) {
+ if (resSet.size() >= maxConnections) {
+ break;
+ }
+ final DistancedItem candidate = minQueue.dequeue();
+
+ // We do not want to creates loops:
+ // While heuristic is used only for creating the links
+ if (candidate.getItem().equals(baseElement)) {
+ continue;
+ }
+
+ boolean toInclude = true;
+ for (T e : resSet) {
+ // Do not include candidate if the distance from candidate to any of existing item in
+ // resSet is closer to the distance from the candidate to the item. By doing this, the
+ // connection of graph will be more diverse, and in case of highly clustered data set,
+ // connections will be made between clusters instead of all being in the same cluster.
+ final float dist = distFnIndex.distance(e, candidate.getItem());
+ if (dist < candidate.getDistance()) {
+ toInclude = false;
+ break;
+ }
+ }
+
+ if (toInclude) {
+ resSet.add(candidate.getItem());
+ }
+ }
+ return ImmutableList.copyOf(resSet);
+ }
+ }
+
+ /**
+ * Search the index for the neighbours.
+ *
+ * @param query Query
+ * @param numOfNeighbours Number of neighbours to search for.
+ * @param ef This param controls the accuracy of the search.
+ * Bigger the ef better the accuracy on the expense of latency.
+ * Keep it atleast number of neighbours to find.
+ * @return Neighbours
+ */
+ public List> searchKnn(final Q query, final int numOfNeighbours, final int ef) {
+ final HnswMeta metadata = graphMeta.get();
+ if (metadata.getEntryPoint().isPresent()) {
+ T entryPoint = bestEntryPointUntilLayer(metadata.getEntryPoint().get(),
+ query, metadata.getMaxLevel(), 0, distFnQuery);
+ // Get the actual neighbours from 0th layer
+ final List> neighbours =
+ searchLayerForCandidates(query, entryPoint, Math.max(ef, numOfNeighbours),
+ 0, distFnQuery, false).dequeueAll();
+ Collections.reverse(neighbours);
+ return neighbours.size() > numOfNeighbours
+ ? neighbours.subList(0, numOfNeighbours) : neighbours;
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ // This method is currently not used
+ // It is needed for debugging purposes only
+ private void checkIntegrity(String message) {
+ final HnswMeta metadata = graphMeta.get();
+ for (HnswNode node : graph.keySet()) {
+ List linkList = graph.get(node);
+
+ for (T el : linkList) {
+ if (el.equals(node.item)) {
+ LOG.debug(message);
+ throw new RuntimeException("integrity check failed");
+ }
+ }
+ }
+ }
+
+ private DistancedItemQueue searchLayerForCandidates(
+ final K item,
+ final T entryPoint,
+ final int ef,
+ final int level,
+ final DistanceFunction distFn,
+ boolean isUpdate
+ ) {
+ // Min queue
+ final DistancedItemQueue cQueue = new DistancedItemQueue<>(
+ item,
+ Collections.singletonList(entryPoint),
+ true,
+ distFn
+ );
+ // Max Queue
+ final DistancedItemQueue wQueue = cQueue.reverse();
+ final Set visited = new HashSet<>();
+ float lowerBoundDistance = wQueue.peek().getDistance();
+ visited.add(entryPoint);
+
+ while (cQueue.nonEmpty()) {
+ final DistancedItem candidate = cQueue.peek();
+ if (candidate.getDistance() > lowerBoundDistance) {
+ break;
+ }
+
+ cQueue.dequeue();
+ final List list = getConnectionListForRead(candidate.getItem(), level);
+ for (T nn : list) {
+ if (!visited.contains(nn)) {
+ visited.add(nn);
+ final float distance = distFn.distance(item, nn);
+ if (wQueue.size() < ef || distance < wQueue.peek().getDistance()) {
+ cQueue.enqueue(nn, distance);
+
+ if (isUpdate && item.equals(nn)) {
+ continue;
+ }
+
+ wQueue.enqueue(nn, distance);
+ if (wQueue.size() > ef) {
+ wQueue.dequeue();
+ }
+
+ lowerBoundDistance = wQueue.peek().getDistance();
+ }
+ }
+ }
+ }
+
+ return wQueue;
+ }
+
+ /**
+ * Serialize hnsw index
+ */
+ public void toDirectory(IndexOutputFile indexOutputFile, Injection injection)
+ throws IOException, TException {
+ final int totalGraphEntries = HnswIndexIOUtil.saveHnswGraphEntries(
+ graph,
+ indexOutputFile.createFile(GRAPH_FILE_NAME).getOutputStream(),
+ injection);
+
+ HnswIndexIOUtil.saveMetadata(
+ graphMeta.get(),
+ efConstruction,
+ maxM,
+ totalGraphEntries,
+ injection,
+ indexOutputFile.createFile(METADATA_FILE_NAME).getOutputStream());
+}
+
+ /**
+ * Load hnsw index
+ */
+ public static HnswIndex loadHnswIndex(
+ DistanceFunction distFnIndex,
+ DistanceFunction distFnQuery,
+ AbstractFile directory,
+ Injection injection,
+ RandomProvider randomProvider) throws IOException, TException {
+ final AbstractFile graphFile = directory.getChild(GRAPH_FILE_NAME);
+ final AbstractFile metadataFile = directory.getChild(METADATA_FILE_NAME);
+ final HnswInternalIndexMetadata metadata = HnswIndexIOUtil.loadMetadata(metadataFile);
+ final Map, ImmutableList> graph =
+ HnswIndexIOUtil.loadHnswGraph(graphFile, injection, metadata.numElements);
+ final ByteBuffer entryPointBB = metadata.entryPoint;
+ final HnswMeta graphMeta = new HnswMeta<>(
+ metadata.maxLevel,
+ entryPointBB == null ? Optional.empty()
+ : Optional.of(injection.invert(ArrayByteBufferCodec.decode(entryPointBB)).get())
+ );
+ return new HnswIndex<>(
+ distFnIndex,
+ distFnQuery,
+ metadata.efConstruction,
+ metadata.maxM,
+ metadata.numElements,
+ graphMeta,
+ graph,
+ randomProvider
+ );
+ }
+
+ private List getConnectionListForRead(T node, int level) {
+ final Lock curLock = locks.computeIfAbsent(node, lockProvider).readLock();
+ curLock.lock();
+ final List list;
+ try {
+ list = graph
+ .getOrDefault(HnswNode.from(level, node), ImmutableList.of());
+ } finally {
+ curLock.unlock();
+ }
+
+ return list;
+ }
+
+ @VisibleForTesting
+ AtomicReference> getGraphMeta() {
+ return graphMeta;
+ }
+
+ @VisibleForTesting
+ Map getLocks() {
+ return locks;
+ }
+
+ @VisibleForTesting
+ Map, ImmutableList> getGraph() {
+ return graph;
+ }
+
+ public interface RandomProvider {
+ /**
+ * RandomProvider interface made public for scala 2.12 compat
+ */
+ Random get();
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/HnswIndexIOUtil.java b/ann/src/main/java/com/twitter/ann/hnsw/HnswIndexIOUtil.java
new file mode 100644
index 000000000..fba2dc55a
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/HnswIndexIOUtil.java
@@ -0,0 +1,133 @@
+package com.twitter.ann.hnsw;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TException;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TIOStreamTransport;
+import org.apache.thrift.transport.TTransportException;
+
+import com.twitter.ann.common.thriftjava.HnswGraphEntry;
+import com.twitter.ann.common.thriftjava.HnswInternalIndexMetadata;
+import com.twitter.bijection.Injection;
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec;
+import com.twitter.search.common.file.AbstractFile;
+
+public final class HnswIndexIOUtil {
+ private HnswIndexIOUtil() {
+ }
+
+ /**
+ * Save thrift object in file
+ */
+ public static void saveMetadata(
+ HnswMeta graphMeta,
+ int efConstruction,
+ int maxM,
+ int numElements,
+ Injection injection,
+ OutputStream outputStream
+ ) throws IOException, TException {
+ final int maxLevel = graphMeta.getMaxLevel();
+ final HnswInternalIndexMetadata metadata = new HnswInternalIndexMetadata(
+ maxLevel,
+ efConstruction,
+ maxM,
+ numElements
+ );
+
+ if (graphMeta.getEntryPoint().isPresent()) {
+ metadata.setEntryPoint(injection.apply(graphMeta.getEntryPoint().get()));
+ }
+ final TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
+ outputStream.write(serializer.serialize(metadata));
+ outputStream.close();
+ }
+
+ /**
+ * Load Hnsw index metadata
+ */
+ public static HnswInternalIndexMetadata loadMetadata(AbstractFile file)
+ throws IOException, TException {
+ final HnswInternalIndexMetadata obj = new HnswInternalIndexMetadata();
+ final TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
+ deserializer.deserialize(obj, file.getByteSource().read());
+ return obj;
+ }
+
+ /**
+ * Load Hnsw graph entries from file
+ */
+ public static Map, ImmutableList> loadHnswGraph(
+ AbstractFile file,
+ Injection injection,
+ int numElements
+ ) throws IOException, TException {
+ final InputStream stream = file.getByteSource().openBufferedStream();
+ final TProtocol protocol = new TBinaryProtocol(new TIOStreamTransport(stream));
+ final Map, ImmutableList> graph =
+ new HashMap<>(numElements);
+ while (true) {
+ try {
+ final HnswGraphEntry entry = new HnswGraphEntry();
+ entry.read(protocol);
+ final HnswNode node = HnswNode.from(entry.level,
+ injection.invert(ArrayByteBufferCodec.decode(entry.key)).get());
+ final List list = entry.getNeighbours().stream()
+ .map(bb -> injection.invert(ArrayByteBufferCodec.decode(bb)).get())
+ .collect(Collectors.toList());
+ graph.put(node, ImmutableList.copyOf(list.iterator()));
+ } catch (TException e) {
+ if (e instanceof TTransportException
+ && TTransportException.class.cast(e).getType() == TTransportException.END_OF_FILE) {
+ stream.close();
+ break;
+ }
+ stream.close();
+ throw e;
+ }
+ }
+
+ return graph;
+ }
+
+ /**
+ * Save hnsw graph in file
+ *
+ * @return number of keys in the graph
+ */
+ public static int saveHnswGraphEntries(
+ Map, ImmutableList> graph,
+ OutputStream outputStream,
+ Injection injection
+ ) throws IOException, TException {
+ final TProtocol protocol = new TBinaryProtocol(new TIOStreamTransport(outputStream));
+ final Set> nodes = graph.keySet();
+ for (HnswNode node : nodes) {
+ final HnswGraphEntry entry = new HnswGraphEntry();
+ entry.setLevel(node.level);
+ entry.setKey(injection.apply(node.item));
+ final List nn = graph.getOrDefault(node, ImmutableList.of()).stream()
+ .map(t -> ByteBuffer.wrap(injection.apply(t)))
+ .collect(Collectors.toList());
+ entry.setNeighbours(nn);
+ entry.write(protocol);
+ }
+
+ outputStream.close();
+ return nodes.size();
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/HnswMeta.java b/ann/src/main/java/com/twitter/ann/hnsw/HnswMeta.java
new file mode 100644
index 000000000..c990c4bbc
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/HnswMeta.java
@@ -0,0 +1,45 @@
+package com.twitter.ann.hnsw;
+
+import java.util.Objects;
+import java.util.Optional;
+
+class HnswMeta {
+ private final int maxLevel;
+ private final Optional entryPoint;
+
+ HnswMeta(int maxLevel, Optional entryPoint) {
+ this.maxLevel = maxLevel;
+ this.entryPoint = entryPoint;
+ }
+
+ public int getMaxLevel() {
+ return maxLevel;
+ }
+
+ public Optional getEntryPoint() {
+ return entryPoint;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HnswMeta> hnswMeta = (HnswMeta>) o;
+ return maxLevel == hnswMeta.maxLevel
+ && Objects.equals(entryPoint, hnswMeta.entryPoint);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(maxLevel, entryPoint);
+ }
+
+ @Override
+ public String toString() {
+ return "HnswMeta{maxLevel=" + maxLevel + ", entryPoint=" + entryPoint + '}';
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/HnswNode.java b/ann/src/main/java/com/twitter/ann/hnsw/HnswNode.java
new file mode 100644
index 000000000..95819214c
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/HnswNode.java
@@ -0,0 +1,45 @@
+package com.twitter.ann.hnsw;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+public class HnswNode {
+ public final int level;
+ public final T item;
+
+ public HnswNode(int level, T item) {
+ this.level = level;
+ this.item = item;
+ }
+
+ /**
+ * Create a hnsw node.
+ */
+ public static HnswNode from(int level, T item) {
+ return new HnswNode<>(level, item);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof HnswNode)) {
+ return false;
+ }
+
+ HnswNode> that = (HnswNode>) o;
+ return new EqualsBuilder()
+ .append(this.item, that.item)
+ .append(this.level, that.level)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder()
+ .append(item)
+ .append(level)
+ .toHashCode();
+ }
+}
diff --git a/ann/src/main/java/com/twitter/ann/hnsw/IllegalDuplicateInsertException.java b/ann/src/main/java/com/twitter/ann/hnsw/IllegalDuplicateInsertException.java
new file mode 100644
index 000000000..634dc63f6
--- /dev/null
+++ b/ann/src/main/java/com/twitter/ann/hnsw/IllegalDuplicateInsertException.java
@@ -0,0 +1,7 @@
+package com.twitter.ann.hnsw;
+
+public class IllegalDuplicateInsertException extends Exception {
+ public IllegalDuplicateInsertException(String message) {
+ super(message);
+ }
+}
diff --git a/ann/src/main/python/dataflow/BUILD.bazel b/ann/src/main/python/dataflow/BUILD.bazel
new file mode 100644
index 000000000..44eeb72e2
--- /dev/null
+++ b/ann/src/main/python/dataflow/BUILD.bazel
@@ -0,0 +1,38 @@
+resources(
+ name = "sql",
+ sources = ["bq.sql"],
+)
+
+python3_library(
+ name = "faiss_indexing",
+ sources = ["**/*.py"],
+ tags = ["bazel-compatible"],
+ dependencies = [
+ ":sql",
+ "3rdparty/python/apache-beam:default",
+ "3rdparty/python/faiss-gpu:default",
+ "3rdparty/python/gcsfs:default",
+ "3rdparty/python/google-cloud-bigquery:default",
+ "3rdparty/python/google-cloud-storage",
+ "3rdparty/python/numpy:default",
+ "3rdparty/python/pandas:default",
+ "3rdparty/python/pandas-gbq:default",
+ "3rdparty/python/pyarrow:default",
+ "src/python/twitter/ml/common/apache_beam",
+ ],
+)
+
+python37_binary(
+ name = "faiss_indexing_bin",
+ sources = ["faiss_index_bq_dataset.py"],
+ platforms = [
+ "current",
+ "linux_x86_64",
+ ],
+ tags = ["no-mypy"],
+ zip_safe = False,
+ dependencies = [
+ ":faiss_indexing",
+ "3rdparty/python/_closures/ann/src/main/python/dataflow:faiss_indexing_bin",
+ ],
+)
diff --git a/ann/src/main/python/dataflow/bq.sql b/ann/src/main/python/dataflow/bq.sql
new file mode 100644
index 000000000..809184bb2
--- /dev/null
+++ b/ann/src/main/python/dataflow/bq.sql
@@ -0,0 +1,6 @@
+WITH maxts as (SELECT as value MAX(ts) as ts FROM `twttr-recos-ml-prod.ssedhain.twhin_tweet_avg_embedding`)
+SELECT entityId, embedding
+FROM `twttr-recos-ml-prod.ssedhain.twhin_tweet_avg_embedding`
+WHERE ts >= (select max(maxts) from maxts)
+AND DATE(TIMESTAMP_MILLIS(createdAt)) <= (select max(maxts) from maxts)
+AND DATE(TIMESTAMP_MILLIS(createdAt)) >= DATE_SUB((select max(maxts) from maxts), INTERVAL 1 DAY)
\ No newline at end of file
diff --git a/ann/src/main/python/dataflow/faiss_index_bq_dataset.py b/ann/src/main/python/dataflow/faiss_index_bq_dataset.py
new file mode 100644
index 000000000..1863cabef
--- /dev/null
+++ b/ann/src/main/python/dataflow/faiss_index_bq_dataset.py
@@ -0,0 +1,232 @@
+import argparse
+import logging
+import os
+import pkgutil
+import sys
+from urllib.parse import urlsplit
+
+import apache_beam as beam
+from apache_beam.options.pipeline_options import PipelineOptions
+import faiss
+
+
+def parse_d6w_config(argv=None):
+ """Parse d6w config.
+ :param argv: d6w config
+ :return: dictionary containing d6w config
+ """
+
+ parser = argparse.ArgumentParser(
+ description="See https://docbird.twitter.biz/d6w/model.html for any parameters inherited from d6w job config"
+ )
+ parser.add_argument("--job_name", dest="job_name", required=True, help="d6w attribute")
+ parser.add_argument("--project", dest="project", required=True, help="d6w attribute")
+ parser.add_argument(
+ "--staging_location", dest="staging_location", required=True, help="d6w attribute"
+ )
+ parser.add_argument("--temp_location", dest="temp_location", required=True, help="d6w attribute")
+ parser.add_argument(
+ "--output_location",
+ dest="output_location",
+ required=True,
+ help="GCS bucket and path where resulting artifacts are uploaded",
+ )
+ parser.add_argument(
+ "--service_account_email", dest="service_account_email", required=True, help="d6w attribute"
+ )
+ parser.add_argument(
+ "--factory_string",
+ dest="factory_string",
+ required=False,
+ help="FAISS factory string describing index to build. See https://github.com/facebookresearch/faiss/wiki/The-index-factory",
+ )
+ parser.add_argument(
+ "--metric",
+ dest="metric",
+ required=True,
+ help="Metric used to compute distance between embeddings. Valid values are 'l2', 'ip', 'l1', 'linf'",
+ )
+ parser.add_argument(
+ "--use_gpu",
+ dest="gpu",
+ required=True,
+ help="--use_gpu=yes if you want to use GPU during index building",
+ )
+
+ known_args, unknown_args = parser.parse_known_args(argv)
+ d6w_config = vars(known_args)
+ d6w_config["gpu"] = d6w_config["gpu"].lower() == "yes"
+ d6w_config["metric"] = parse_metric(d6w_config)
+
+ """
+ WARNING: Currently, d6w (a Twitter tool used to deploy Dataflow jobs to GCP) and
+ PipelineOptions.for_dataflow_runner (a helper method in twitter.ml.common.apache_beam) do not
+ play nicely together. The helper method will overwrite some of the config specified in the d6w
+ file using the defaults in https://sourcegraph.twitter.biz/git.twitter.biz/source/-/blob/src/python/twitter/ml/common/apache_beam/__init__.py?L24.'
+ However, the d6w output message will still report that the config specified in the d6w file was used.
+ """
+ logging.warning(
+ f"The following d6w config parameters will be overwritten by the defaults in "
+ f"https://sourcegraph.twitter.biz/git.twitter.biz/source/-/blob/src/python/twitter/ml/common/apache_beam/__init__.py?L24\n"
+ f"{str(unknown_args)}"
+ )
+ return d6w_config
+
+
+def get_bq_query():
+ """
+ Query is expected to return rows with unique entityId
+ """
+ return pkgutil.get_data(__name__, "bq.sql").decode("utf-8")
+
+
+def parse_metric(config):
+ metric_str = config["metric"].lower()
+ if metric_str == "l2":
+ return faiss.METRIC_L2
+ elif metric_str == "ip":
+ return faiss.METRIC_INNER_PRODUCT
+ elif metric_str == "l1":
+ return faiss.METRIC_L1
+ elif metric_str == "linf":
+ return faiss.METRIC_Linf
+ else:
+ raise Exception(f"Uknown metric: {metric_str}")
+
+
+def run_pipeline(argv=[]):
+ config = parse_d6w_config(argv)
+ argv_with_extras = argv
+ if config["gpu"]:
+ argv_with_extras.extend(["--experiments", "use_runner_v2"])
+ argv_with_extras.extend(
+ ["--experiments", "worker_accelerator=type:nvidia-tesla-t4;count:1;install-nvidia-driver"]
+ )
+ argv_with_extras.extend(
+ [
+ "--worker_harness_container_image",
+ "gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7",
+ ]
+ )
+
+ options = PipelineOptions(argv_with_extras)
+ output_bucket_name = urlsplit(config["output_location"]).netloc
+
+ with beam.Pipeline(options=options) as p:
+ input_data = p | "Read from BigQuery" >> beam.io.ReadFromBigQuery(
+ method=beam.io.ReadFromBigQuery.Method.DIRECT_READ,
+ query=get_bq_query(),
+ use_standard_sql=True,
+ )
+
+ index_built = input_data | "Build and upload index" >> beam.CombineGlobally(
+ MergeAndBuildIndex(
+ output_bucket_name,
+ config["output_location"],
+ config["factory_string"],
+ config["metric"],
+ config["gpu"],
+ )
+ )
+
+ # Make linter happy
+ index_built
+
+
+class MergeAndBuildIndex(beam.CombineFn):
+ def __init__(self, bucket_name, gcs_output_path, factory_string, metric, gpu):
+ self.bucket_name = bucket_name
+ self.gcs_output_path = gcs_output_path
+ self.factory_string = factory_string
+ self.metric = metric
+ self.gpu = gpu
+
+ def create_accumulator(self):
+ return []
+
+ def add_input(self, accumulator, element):
+ accumulator.append(element)
+ return accumulator
+
+ def merge_accumulators(self, accumulators):
+ merged = []
+ for accum in accumulators:
+ merged.extend(accum)
+ return merged
+
+ def extract_output(self, rows):
+ # Reimports are needed on workers
+ import glob
+ import subprocess
+
+ import faiss
+ from google.cloud import storage
+ import numpy as np
+
+ client = storage.Client()
+ bucket = client.get_bucket(self.bucket_name)
+
+ logging.info("Building FAISS index")
+ logging.info(f"There are {len(rows)} rows")
+
+ ids = np.array([x["entityId"] for x in rows]).astype("long")
+ embeds = np.array([x["embedding"] for x in rows]).astype("float32")
+ dimensions = len(embeds[0])
+ N = ids.shape[0]
+ logging.info(f"There are {dimensions} dimensions")
+
+ if self.factory_string is None:
+ M = 48
+
+ divideable_dimensions = (dimensions // M) * M
+ if divideable_dimensions != dimensions:
+ opq_prefix = f"OPQ{M}_{divideable_dimensions}"
+ else:
+ opq_prefix = f"OPQ{M}"
+
+ clusters = N // 20
+ self.factory_string = f"{opq_prefix},IVF{clusters},PQ{M}"
+
+ logging.info(f"Factory string is {self.factory_string}, metric={self.metric}")
+
+ if self.gpu:
+ logging.info("Using GPU")
+
+ res = faiss.StandardGpuResources()
+ cpu_index = faiss.index_factory(dimensions, self.factory_string, self.metric)
+ cpu_index = faiss.IndexIDMap(cpu_index)
+ gpu_index = faiss.index_cpu_to_gpu(res, 0, cpu_index)
+ gpu_index.train(embeds)
+ gpu_index.add_with_ids(embeds, ids)
+ cpu_index = faiss.index_gpu_to_cpu(gpu_index)
+ else:
+ logging.info("Using CPU")
+
+ cpu_index = faiss.index_factory(dimensions, self.factory_string, self.metric)
+ cpu_index = faiss.IndexIDMap(cpu_index)
+ cpu_index.train(embeds)
+ cpu_index.add_with_ids(embeds, ids)
+
+ logging.info("Built faiss index")
+
+ local_path = "/indices"
+ logging.info(f"Writing indices to local {local_path}")
+ subprocess.run(f"mkdir -p {local_path}".strip().split())
+ local_index_path = os.path.join(local_path, "result.index")
+
+ faiss.write_index(cpu_index, local_index_path)
+ logging.info(f"Done writing indices to local {local_path}")
+
+ logging.info(f"Uploading to GCS with path {self.gcs_output_path}")
+ assert os.path.isdir(local_path)
+ for local_file in glob.glob(local_path + "/*"):
+ remote_path = os.path.join(
+ self.gcs_output_path.split("/")[-1], local_file[1 + len(local_path) :]
+ )
+ blob = bucket.blob(remote_path)
+ blob.upload_from_filename(local_file)
+
+
+if __name__ == "__main__":
+ logging.getLogger().setLevel(logging.INFO)
+ run_pipeline(sys.argv)
diff --git a/ann/src/main/python/dataflow/worker_harness/Dockerfile b/ann/src/main/python/dataflow/worker_harness/Dockerfile
new file mode 100644
index 000000000..c5f56e231
--- /dev/null
+++ b/ann/src/main/python/dataflow/worker_harness/Dockerfile
@@ -0,0 +1,34 @@
+FROM --platform=linux/amd64 nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04
+
+RUN \
+ # Add Deadsnakes repository that has a variety of Python packages for Ubuntu.
+ # See: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 \
+ && echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main" >> /etc/apt/sources.list.d/custom.list \
+ && echo "deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main" >> /etc/apt/sources.list.d/custom.list \
+ && apt-get update \
+ && apt-get install -y curl \
+ python3.7 \
+ # With python3.8 package, distutils need to be installed separately.
+ python3.7-distutils \
+ python3-dev \
+ python3.7-dev \
+ libpython3.7-dev \
+ python3-apt \
+ gcc \
+ g++ \
+ && rm -rf /var/lib/apt/lists/*
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10
+RUN rm -f /usr/bin/python3 && ln -s /usr/bin/python3.7 /usr/bin/python3
+RUN \
+ curl https://bootstrap.pypa.io/get-pip.py | python \
+ && pip3 install pip==22.0.3 \
+ && python3 -m pip install --no-cache-dir apache-beam[gcp]==2.39.0
+# Verify that there are no conflicting dependencies.
+RUN pip3 check
+
+# Copy the Apache Beam worker dependencies from the Beam Python 3.7 SDK image.
+COPY --from=apache/beam_python3.7_sdk:2.39.0 /opt/apache/beam /opt/apache/beam
+
+# Set the entrypoint to Apache Beam SDK worker launcher.
+ENTRYPOINT [ "/opt/apache/beam/boot" ]
\ No newline at end of file
diff --git a/ann/src/main/python/dataflow/worker_harness/cloudbuild.yml b/ann/src/main/python/dataflow/worker_harness/cloudbuild.yml
new file mode 100644
index 000000000..34aab720f
--- /dev/null
+++ b/ann/src/main/python/dataflow/worker_harness/cloudbuild.yml
@@ -0,0 +1,6 @@
+steps:
+- name: 'gcr.io/cloud-builders/docker'
+ args: ['build', '-t', 'gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7', '.']
+- name: 'gcr.io/cloud-builders/docker'
+ args: ['push', 'gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7']
+images: ['gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7']
\ No newline at end of file
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/AnnoyCommon.scala b/ann/src/main/scala/com/twitter/ann/annoy/AnnoyCommon.scala
new file mode 100644
index 000000000..ffe035c48
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/AnnoyCommon.scala
@@ -0,0 +1,44 @@
+package com.twitter.ann.annoy
+
+import com.twitter.ann.common.RuntimeParams
+import com.twitter.ann.common.thriftscala.AnnoyIndexMetadata
+import com.twitter.bijection.Injection
+import com.twitter.mediaservices.commons.codec.ThriftByteBufferCodec
+import com.twitter.ann.common.thriftscala.{AnnoyRuntimeParam, RuntimeParams => ServiceRuntimeParams}
+import scala.util.{Failure, Success, Try}
+
+object AnnoyCommon {
+ private[annoy] lazy val MetadataCodec = new ThriftByteBufferCodec(AnnoyIndexMetadata)
+ private[annoy] val IndexFileName = "annoy_index"
+ private[annoy] val MetaDataFileName = "annoy_index_metadata"
+ private[annoy] val IndexIdMappingFileName = "annoy_index_id_mapping"
+
+ val RuntimeParamsInjection: Injection[AnnoyRuntimeParams, ServiceRuntimeParams] =
+ new Injection[AnnoyRuntimeParams, ServiceRuntimeParams] {
+ override def apply(scalaParams: AnnoyRuntimeParams): ServiceRuntimeParams = {
+ ServiceRuntimeParams.AnnoyParam(
+ AnnoyRuntimeParam(
+ scalaParams.nodesToExplore
+ )
+ )
+ }
+
+ override def invert(thriftParams: ServiceRuntimeParams): Try[AnnoyRuntimeParams] =
+ thriftParams match {
+ case ServiceRuntimeParams.AnnoyParam(annoyParam) =>
+ Success(
+ AnnoyRuntimeParams(annoyParam.numOfNodesToExplore)
+ )
+ case p => Failure(new IllegalArgumentException(s"Expected AnnoyRuntimeParams got $p"))
+ }
+ }
+}
+
+case class AnnoyRuntimeParams(
+ /* Number of vectors to evaluate while searching. A larger value will give more accurate results, but will take longer time to return.
+ * Default value would be numberOfTrees*numberOfNeigboursRequested
+ */
+ nodesToExplore: Option[Int])
+ extends RuntimeParams {
+ override def toString: String = s"AnnoyRuntimeParams( nodesToExplore = $nodesToExplore)"
+}
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/BUILD b/ann/src/main/scala/com/twitter/ann/annoy/BUILD
new file mode 100644
index 000000000..fb882dac2
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/BUILD
@@ -0,0 +1,23 @@
+scala_library(
+ sources = ["*.scala"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [
+ "3rdparty/jvm/com/spotify:annoy-java",
+ "3rdparty/jvm/com/spotify:annoy-snapshot",
+ "3rdparty/jvm/com/twitter/storehaus:core",
+ "ann/src/main/scala/com/twitter/ann/common",
+ "ann/src/main/scala/com/twitter/ann/file_store",
+ "ann/src/main/thrift/com/twitter/ann/common:ann-common-scala",
+ "mediaservices/commons",
+ "src/java/com/twitter/search/common/file",
+ "src/scala/com/twitter/ml/api/embedding",
+ ],
+ exports = [
+ "ann/src/main/scala/com/twitter/ann/common",
+ "src/java/com/twitter/common_internal/hadoop",
+ "src/java/com/twitter/search/common/file",
+ "src/scala/com/twitter/ml/api/embedding",
+ ],
+)
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyIndexBuilder.scala b/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyIndexBuilder.scala
new file mode 100644
index 000000000..d1f889a96
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyIndexBuilder.scala
@@ -0,0 +1,123 @@
+package com.twitter.ann.annoy
+
+import com.spotify.annoy.jni.base.{Annoy => AnnoyLib}
+import com.twitter.ann.annoy.AnnoyCommon.IndexFileName
+import com.twitter.ann.annoy.AnnoyCommon.MetaDataFileName
+import com.twitter.ann.annoy.AnnoyCommon.MetadataCodec
+import com.twitter.ann.common.EmbeddingType._
+import com.twitter.ann.common._
+import com.twitter.ann.common.thriftscala.AnnoyIndexMetadata
+import com.twitter.concurrent.AsyncSemaphore
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.search.common.file.LocalFile
+import com.twitter.util.Future
+import com.twitter.util.FuturePool
+import java.io.File
+import java.nio.file.Files
+import org.apache.beam.sdk.io.fs.ResourceId
+import scala.collection.JavaConverters._
+
+private[annoy] object RawAnnoyIndexBuilder {
+ private[annoy] def apply[D <: Distance[D]](
+ dimension: Int,
+ numOfTrees: Int,
+ metric: Metric[D],
+ futurePool: FuturePool
+ ): RawAppendable[AnnoyRuntimeParams, D] with Serialization = {
+ val indexBuilder = AnnoyLib.newIndex(dimension, annoyMetric(metric))
+ new RawAnnoyIndexBuilder(dimension, numOfTrees, metric, indexBuilder, futurePool)
+ }
+
+ private[this] def annoyMetric(metric: Metric[_]): AnnoyLib.Metric = {
+ metric match {
+ case L2 => AnnoyLib.Metric.EUCLIDEAN
+ case Cosine => AnnoyLib.Metric.ANGULAR
+ case _ => throw new RuntimeException("Not supported: " + metric)
+ }
+ }
+}
+
+private[this] class RawAnnoyIndexBuilder[D <: Distance[D]](
+ dimension: Int,
+ numOfTrees: Int,
+ metric: Metric[D],
+ indexBuilder: AnnoyLib.Builder,
+ futurePool: FuturePool)
+ extends RawAppendable[AnnoyRuntimeParams, D]
+ with Serialization {
+ private[this] var counter = 0
+ // Note: Only one thread can access the underlying index, multithreaded index building not supported
+ private[this] val semaphore = new AsyncSemaphore(1)
+
+ override def append(embedding: EmbeddingVector): Future[Long] =
+ semaphore.acquireAndRun({
+ counter += 1
+ indexBuilder.addItem(
+ counter,
+ embedding.toArray
+ .map(float => float2Float(float))
+ .toList
+ .asJava
+ )
+
+ Future.value(counter)
+ })
+
+ override def toQueryable: Queryable[Long, AnnoyRuntimeParams, D] = {
+ val tempDirParent = Files.createTempDirectory("raw_annoy_index").toFile
+ tempDirParent.deleteOnExit
+ val tempDir = new LocalFile(tempDirParent)
+ this.toDirectory(tempDir)
+ RawAnnoyQueryIndex(
+ dimension,
+ metric,
+ futurePool,
+ tempDir
+ )
+ }
+
+ override def toDirectory(directory: ResourceId): Unit = {
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ /**
+ * Serialize the annoy index in a directory.
+ * @param directory: Directory to save to.
+ */
+ override def toDirectory(directory: AbstractFile): Unit = {
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ private def toDirectory(directory: IndexOutputFile): Unit = {
+ val indexFile = directory.createFile(IndexFileName)
+ saveIndex(indexFile)
+
+ val metaDataFile = directory.createFile(MetaDataFileName)
+ saveMetadata(metaDataFile)
+ }
+
+ private[this] def saveIndex(indexFile: IndexOutputFile): Unit = {
+ val index = indexBuilder
+ .build(numOfTrees)
+ val temp = new LocalFile(File.createTempFile(IndexFileName, null))
+ index.save(temp.getPath)
+ indexFile.copyFrom(temp.getByteSource.openStream())
+ temp.delete()
+ }
+
+ private[this] def saveMetadata(metadataFile: IndexOutputFile): Unit = {
+ val numberOfVectorsIndexed = counter
+ val metadata = AnnoyIndexMetadata(
+ dimension,
+ Metric.toThrift(metric),
+ numOfTrees,
+ numberOfVectorsIndexed
+ )
+ val bytes = ArrayByteBufferCodec.decode(MetadataCodec.encode(metadata))
+ val temp = new LocalFile(File.createTempFile(MetaDataFileName, null))
+ temp.getByteSink.write(bytes)
+ metadataFile.copyFrom(temp.getByteSource.openStream())
+ temp.delete()
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyQueryIndex.scala b/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyQueryIndex.scala
new file mode 100644
index 000000000..9fc65ddf7
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/RawAnnoyQueryIndex.scala
@@ -0,0 +1,142 @@
+package com.twitter.ann.annoy
+
+import com.spotify.annoy.{ANNIndex, IndexType}
+import com.twitter.ann.annoy.AnnoyCommon._
+import com.twitter.ann.common._
+import com.twitter.ann.common.EmbeddingType._
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec
+import com.twitter.search.common.file.{AbstractFile, LocalFile}
+import com.twitter.util.{Future, FuturePool}
+import java.io.File
+import scala.collection.JavaConverters._
+
+private[annoy] object RawAnnoyQueryIndex {
+ private[annoy] def apply[D <: Distance[D]](
+ dimension: Int,
+ metric: Metric[D],
+ futurePool: FuturePool,
+ directory: AbstractFile
+ ): Queryable[Long, AnnoyRuntimeParams, D] = {
+ val metadataFile = directory.getChild(MetaDataFileName)
+ val indexFile = directory.getChild(IndexFileName)
+ val metadata = MetadataCodec.decode(
+ ArrayByteBufferCodec.encode(metadataFile.getByteSource.read())
+ )
+
+ val existingDimension = metadata.dimension
+ assert(
+ existingDimension == dimension,
+ s"Dimensions do not match. requested: $dimension existing: $existingDimension"
+ )
+
+ val existingMetric = Metric.fromThrift(metadata.distanceMetric)
+ assert(
+ existingMetric == metric,
+ s"DistanceMetric do not match. requested: $metric existing: $existingMetric"
+ )
+
+ val index = loadIndex(indexFile, dimension, annoyMetric(metric))
+ new RawAnnoyQueryIndex[D](
+ dimension,
+ metric,
+ metadata.numOfTrees,
+ index,
+ futurePool
+ )
+ }
+
+ private[this] def annoyMetric(metric: Metric[_]): IndexType = {
+ metric match {
+ case L2 => IndexType.EUCLIDEAN
+ case Cosine => IndexType.ANGULAR
+ case _ => throw new RuntimeException("Not supported: " + metric)
+ }
+ }
+
+ private[this] def loadIndex(
+ indexFile: AbstractFile,
+ dimension: Int,
+ indexType: IndexType
+ ): ANNIndex = {
+ var localIndexFile = indexFile
+
+ // If not a local file copy to local, so that it can be memory mapped.
+ if (!indexFile.isInstanceOf[LocalFile]) {
+ val tempFile = File.createTempFile(IndexFileName, null)
+ tempFile.deleteOnExit()
+
+ val temp = new LocalFile(tempFile)
+ indexFile.copyTo(temp)
+ localIndexFile = temp
+ }
+
+ new ANNIndex(
+ dimension,
+ localIndexFile.getPath(),
+ indexType
+ )
+ }
+}
+
+private[this] class RawAnnoyQueryIndex[D <: Distance[D]](
+ dimension: Int,
+ metric: Metric[D],
+ numOfTrees: Int,
+ index: ANNIndex,
+ futurePool: FuturePool)
+ extends Queryable[Long, AnnoyRuntimeParams, D]
+ with AutoCloseable {
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: AnnoyRuntimeParams
+ ): Future[List[Long]] = {
+ queryWithDistance(embedding, numOfNeighbours, runtimeParams)
+ .map(_.map(_.neighbor))
+ }
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: AnnoyRuntimeParams
+ ): Future[List[NeighborWithDistance[Long, D]]] = {
+ futurePool {
+ val queryVector = embedding.toArray
+ val neigboursToRequest = neighboursToRequest(numOfNeighbours, runtimeParams)
+ val neigbours = index
+ .getNearestWithDistance(queryVector, neigboursToRequest)
+ .asScala
+ .take(numOfNeighbours)
+ .map { nn =>
+ val id = nn.getFirst.toLong
+ val distance = metric.fromAbsoluteDistance(nn.getSecond)
+ NeighborWithDistance(id, distance)
+ }
+ .toList
+
+ neigbours
+ }
+ }
+
+ // Annoy java lib do not expose param for numOfNodesToExplore.
+ // Default number is numOfTrees*numOfNeigbours.
+ // Simple hack is to artificially increase the numOfNeighbours to be requested and then just cap it before returning.
+ private[this] def neighboursToRequest(
+ numOfNeighbours: Int,
+ annoyParams: AnnoyRuntimeParams
+ ): Int = {
+ annoyParams.nodesToExplore match {
+ case Some(nodesToExplore) => {
+ val neigboursToRequest = nodesToExplore / numOfTrees
+ if (neigboursToRequest < numOfNeighbours)
+ numOfNeighbours
+ else
+ neigboursToRequest
+ }
+ case _ => numOfNeighbours
+ }
+ }
+
+ // To close the memory map based file resource.
+ override def close(): Unit = index.close()
+}
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndex.scala b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndex.scala
new file mode 100644
index 000000000..e686bbe5e
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndex.scala
@@ -0,0 +1,55 @@
+package com.twitter.ann.annoy
+
+import com.twitter.ann.common._
+import com.twitter.bijection.Injection
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.util.FuturePool
+
+// Class to provide Annoy based ann index.
+object TypedAnnoyIndex {
+
+ /**
+ * Create Annoy based typed index builder that serializes index to a directory (HDFS/Local file system).
+ * It cannot be used in scalding as it leverage C/C++ jni bindings, whose build conflicts with version of some libs installed on hadoop.
+ * You can use it on aurora or with IndexBuilding job which triggers scalding job but then streams data to aurora machine for building index.
+ * @param dimension dimension of embedding
+ * @param numOfTrees builds a forest of numOfTrees trees.
+ * More trees gives higher precision when querying at the cost of increased memory and disk storage requirement at the build time.
+ * At runtime the index will be memory mapped, so memory wont be an issue but disk storage would be needed.
+ * @param metric distance metric for nearest neighbour search
+ * @param injection Injection to convert bytes to Id.
+ * @tparam T Type of Id for embedding
+ * @tparam D Typed Distance
+ * @return Serializable AnnoyIndex
+ */
+ def indexBuilder[T, D <: Distance[D]](
+ dimension: Int,
+ numOfTrees: Int,
+ metric: Metric[D],
+ injection: Injection[T, Array[Byte]],
+ futurePool: FuturePool
+ ): Appendable[T, AnnoyRuntimeParams, D] with Serialization = {
+ TypedAnnoyIndexBuilderWithFile(dimension, numOfTrees, metric, injection, futurePool)
+ }
+
+ /**
+ * Load Annoy based queryable index from a directory
+ * @param dimension dimension of embedding
+ * @param metric distance metric for nearest neighbour search
+ * @param injection Injection to convert bytes to Id.
+ * @param futurePool FuturePool
+ * @param directory Directory (HDFS/Local file system) where serialized index is stored.
+ * @tparam T Type of Id for embedding
+ * @tparam D Typed Distance
+ * @return Typed Queryable AnnoyIndex
+ */
+ def loadQueryableIndex[T, D <: Distance[D]](
+ dimension: Int,
+ metric: Metric[D],
+ injection: Injection[T, Array[Byte]],
+ futurePool: FuturePool,
+ directory: AbstractFile
+ ): Queryable[T, AnnoyRuntimeParams, D] = {
+ TypedAnnoyQueryIndexWithFile(dimension, metric, injection, futurePool, directory)
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndexBuilderWithFile.scala b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndexBuilderWithFile.scala
new file mode 100644
index 000000000..1dd07ae38
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyIndexBuilderWithFile.scala
@@ -0,0 +1,55 @@
+package com.twitter.ann.annoy
+
+import com.twitter.ann.annoy.AnnoyCommon.IndexIdMappingFileName
+import com.twitter.ann.common._
+import com.twitter.ann.file_store.WritableIndexIdFileStore
+import com.twitter.bijection.Injection
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.util.Future
+import com.twitter.util.FuturePool
+import org.apache.beam.sdk.io.fs.ResourceId
+
+private[annoy] object TypedAnnoyIndexBuilderWithFile {
+ private[annoy] def apply[T, D <: Distance[D]](
+ dimension: Int,
+ numOfTrees: Int,
+ metric: Metric[D],
+ injection: Injection[T, Array[Byte]],
+ futurePool: FuturePool
+ ): Appendable[T, AnnoyRuntimeParams, D] with Serialization = {
+ val index = RawAnnoyIndexBuilder(dimension, numOfTrees, metric, futurePool)
+ val writableFileStore = WritableIndexIdFileStore(injection)
+ new TypedAnnoyIndexBuilderWithFile[T, D](index, writableFileStore)
+ }
+}
+
+private[this] class TypedAnnoyIndexBuilderWithFile[T, D <: Distance[D]](
+ indexBuilder: RawAppendable[AnnoyRuntimeParams, D] with Serialization,
+ store: WritableIndexIdFileStore[T])
+ extends Appendable[T, AnnoyRuntimeParams, D]
+ with Serialization {
+ private[this] val transformedIndex = IndexTransformer.transformAppendable(indexBuilder, store)
+
+ override def append(entity: EntityEmbedding[T]): Future[Unit] = {
+ transformedIndex.append(entity)
+ }
+
+ override def toDirectory(directory: ResourceId): Unit = {
+ indexBuilder.toDirectory(directory)
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ override def toDirectory(directory: AbstractFile): Unit = {
+ indexBuilder.toDirectory(directory)
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ private def toDirectory(directory: IndexOutputFile): Unit = {
+ val indexIdFile = directory.createFile(IndexIdMappingFileName)
+ store.save(indexIdFile)
+ }
+
+ override def toQueryable: Queryable[T, AnnoyRuntimeParams, D] = {
+ transformedIndex.toQueryable
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyQueryIndexWithFile.scala b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyQueryIndexWithFile.scala
new file mode 100644
index 000000000..b72839765
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/annoy/TypedAnnoyQueryIndexWithFile.scala
@@ -0,0 +1,42 @@
+package com.twitter.ann.annoy
+
+import com.twitter.ann.annoy.AnnoyCommon._
+import com.twitter.ann.common._
+import com.twitter.ann.file_store.ReadableIndexIdFileStore
+import com.twitter.bijection.Injection
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.util.FuturePool
+
+private[annoy] object TypedAnnoyQueryIndexWithFile {
+ private[annoy] def apply[T, D <: Distance[D]](
+ dimension: Int,
+ metric: Metric[D],
+ injection: Injection[T, Array[Byte]],
+ futurePool: FuturePool,
+ directory: AbstractFile
+ ): Queryable[T, AnnoyRuntimeParams, D] = {
+ val deserializer =
+ new TypedAnnoyQueryIndexWithFile(dimension, metric, futurePool, injection)
+ deserializer.fromDirectory(directory)
+ }
+}
+
+private[this] class TypedAnnoyQueryIndexWithFile[T, D <: Distance[D]](
+ dimension: Int,
+ metric: Metric[D],
+ futurePool: FuturePool,
+ injection: Injection[T, Array[Byte]])
+ extends QueryableDeserialization[
+ T,
+ AnnoyRuntimeParams,
+ D,
+ Queryable[T, AnnoyRuntimeParams, D]
+ ] {
+ override def fromDirectory(directory: AbstractFile): Queryable[T, AnnoyRuntimeParams, D] = {
+ val index = RawAnnoyQueryIndex(dimension, metric, futurePool, directory)
+
+ val indexIdFile = directory.getChild(IndexIdMappingFileName)
+ val readableFileStore = ReadableIndexIdFileStore(indexIdFile, injection)
+ IndexTransformer.transformQueryable(index, readableFileStore)
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/brute_force/BUILD b/ann/src/main/scala/com/twitter/ann/brute_force/BUILD
new file mode 100644
index 000000000..4f06431c8
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/brute_force/BUILD
@@ -0,0 +1,12 @@
+scala_library(
+ sources = ["*.scala"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [
+ "ann/src/main/scala/com/twitter/ann/common",
+ "ann/src/main/scala/com/twitter/ann/serialization",
+ "ann/src/main/thrift/com/twitter/ann/serialization:serialization-scala",
+ "src/java/com/twitter/search/common/file",
+ ],
+)
diff --git a/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceDeserialization.scala b/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceDeserialization.scala
new file mode 100644
index 000000000..615c39c95
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceDeserialization.scala
@@ -0,0 +1,64 @@
+package com.twitter.ann.brute_force
+
+import com.google.common.annotations.VisibleForTesting
+import com.twitter.ann.common.{Distance, EntityEmbedding, Metric, QueryableDeserialization}
+import com.twitter.ann.serialization.{PersistedEmbeddingInjection, ThriftIteratorIO}
+import com.twitter.ann.serialization.thriftscala.PersistedEmbedding
+import com.twitter.search.common.file.{AbstractFile, LocalFile}
+import com.twitter.util.FuturePool
+import java.io.File
+
+/**
+ * @param factory creates a BruteForceIndex from the arguments. This is only exposed for testing.
+ * If for some reason you pass this arg in make sure that it eagerly consumes the
+ * iterator. If you don't you might close the input stream that the iterator is
+ * using.
+ * @tparam T the id of the embeddings
+ */
+class BruteForceDeserialization[T, D <: Distance[D]] @VisibleForTesting private[brute_force] (
+ metric: Metric[D],
+ embeddingInjection: PersistedEmbeddingInjection[T],
+ futurePool: FuturePool,
+ thriftIteratorIO: ThriftIteratorIO[PersistedEmbedding],
+ factory: (Metric[D], FuturePool, Iterator[EntityEmbedding[T]]) => BruteForceIndex[T, D])
+ extends QueryableDeserialization[T, BruteForceRuntimeParams.type, D, BruteForceIndex[T, D]] {
+ import BruteForceIndex._
+
+ def this(
+ metric: Metric[D],
+ embeddingInjection: PersistedEmbeddingInjection[T],
+ futurePool: FuturePool,
+ thriftIteratorIO: ThriftIteratorIO[PersistedEmbedding]
+ ) = {
+ this(
+ metric,
+ embeddingInjection,
+ futurePool,
+ thriftIteratorIO,
+ factory = BruteForceIndex.apply[T, D]
+ )
+ }
+
+ override def fromDirectory(
+ serializationDirectory: AbstractFile
+ ): BruteForceIndex[T, D] = {
+ val file = File.createTempFile(DataFileName, "tmp")
+ file.deleteOnExit()
+ val temp = new LocalFile(file)
+ val dataFile = serializationDirectory.getChild(DataFileName)
+ dataFile.copyTo(temp)
+ val inputStream = temp.getByteSource.openBufferedStream()
+ try {
+ val iterator: Iterator[PersistedEmbedding] = thriftIteratorIO.fromInputStream(inputStream)
+
+ val embeddings = iterator.map { thriftEmbedding =>
+ embeddingInjection.invert(thriftEmbedding).get
+ }
+
+ factory(metric, futurePool, embeddings)
+ } finally {
+ inputStream.close()
+ temp.delete()
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceIndex.scala b/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceIndex.scala
new file mode 100644
index 000000000..d737f57b7
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/brute_force/BruteForceIndex.scala
@@ -0,0 +1,162 @@
+package com.twitter.ann.brute_force
+
+import com.twitter.ann.common.Appendable
+import com.twitter.ann.common.Distance
+import com.twitter.ann.common.EmbeddingType._
+import com.twitter.ann.common.EntityEmbedding
+import com.twitter.ann.common.IndexOutputFile
+import com.twitter.ann.common.Metric
+import com.twitter.ann.common.NeighborWithDistance
+import com.twitter.ann.common.Queryable
+import com.twitter.ann.common.RuntimeParams
+import com.twitter.ann.common.Serialization
+import com.twitter.ann.serialization.PersistedEmbeddingInjection
+import com.twitter.ann.serialization.ThriftIteratorIO
+import com.twitter.ann.serialization.thriftscala.PersistedEmbedding
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.util.Future
+import com.twitter.util.FuturePool
+import java.util.concurrent.ConcurrentLinkedQueue
+import org.apache.beam.sdk.io.fs.ResourceId
+import scala.collection.JavaConverters._
+import scala.collection.mutable
+
+object BruteForceRuntimeParams extends RuntimeParams
+
+object BruteForceIndex {
+ val DataFileName = "BruteForceFileData"
+
+ def apply[T, D <: Distance[D]](
+ metric: Metric[D],
+ futurePool: FuturePool,
+ initialEmbeddings: Iterator[EntityEmbedding[T]] = Iterator()
+ ): BruteForceIndex[T, D] = {
+ val linkedQueue = new ConcurrentLinkedQueue[EntityEmbedding[T]]
+ initialEmbeddings.foreach(embedding => linkedQueue.add(embedding))
+ new BruteForceIndex(metric, futurePool, linkedQueue)
+ }
+}
+
+class BruteForceIndex[T, D <: Distance[D]] private (
+ metric: Metric[D],
+ futurePool: FuturePool,
+ // visible for serialization
+ private[brute_force] val linkedQueue: ConcurrentLinkedQueue[EntityEmbedding[T]])
+ extends Appendable[T, BruteForceRuntimeParams.type, D]
+ with Queryable[T, BruteForceRuntimeParams.type, D] {
+
+ override def append(embedding: EntityEmbedding[T]): Future[Unit] = {
+ futurePool {
+ linkedQueue.add(embedding)
+ }
+ }
+
+ override def toQueryable: Queryable[T, BruteForceRuntimeParams.type, D] = this
+
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: BruteForceRuntimeParams.type
+ ): Future[List[T]] = {
+ queryWithDistance(embedding, numOfNeighbours, runtimeParams).map { neighborsWithDistance =>
+ neighborsWithDistance.map(_.neighbor)
+ }
+ }
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: BruteForceRuntimeParams.type
+ ): Future[List[NeighborWithDistance[T, D]]] = {
+ futurePool {
+ // Use the reverse ordering so that we can call dequeue to remove the largest element.
+ val ordering = Ordering.by[NeighborWithDistance[T, D], D](_.distance)
+ val priorityQueue =
+ new mutable.PriorityQueue[NeighborWithDistance[T, D]]()(ordering)
+ linkedQueue
+ .iterator()
+ .asScala
+ .foreach { entity =>
+ val neighborWithDistance =
+ NeighborWithDistance(entity.id, metric.distance(entity.embedding, embedding))
+ priorityQueue.+=(neighborWithDistance)
+ if (priorityQueue.size > numOfNeighbours) {
+ priorityQueue.dequeue()
+ }
+ }
+ val reverseList: List[NeighborWithDistance[T, D]] =
+ priorityQueue.dequeueAll
+ reverseList.reverse
+ }
+ }
+}
+
+object SerializableBruteForceIndex {
+ def apply[T, D <: Distance[D]](
+ metric: Metric[D],
+ futurePool: FuturePool,
+ embeddingInjection: PersistedEmbeddingInjection[T],
+ thriftIteratorIO: ThriftIteratorIO[PersistedEmbedding]
+ ): SerializableBruteForceIndex[T, D] = {
+ val bruteForceIndex = BruteForceIndex[T, D](metric, futurePool)
+
+ new SerializableBruteForceIndex(bruteForceIndex, embeddingInjection, thriftIteratorIO)
+ }
+}
+
+/**
+ * This is a class that wrapps a BruteForceIndex and provides a method for serialization.
+ *
+ * @param bruteForceIndex all queries and updates are sent to this index.
+ * @param embeddingInjection injection that can convert embeddings to thrift embeddings.
+ * @param thriftIteratorIO class that provides a way to write PersistedEmbeddings to disk
+ */
+class SerializableBruteForceIndex[T, D <: Distance[D]](
+ bruteForceIndex: BruteForceIndex[T, D],
+ embeddingInjection: PersistedEmbeddingInjection[T],
+ thriftIteratorIO: ThriftIteratorIO[PersistedEmbedding])
+ extends Appendable[T, BruteForceRuntimeParams.type, D]
+ with Queryable[T, BruteForceRuntimeParams.type, D]
+ with Serialization {
+ import BruteForceIndex._
+
+ override def append(entity: EntityEmbedding[T]): Future[Unit] =
+ bruteForceIndex.append(entity)
+
+ override def toQueryable: Queryable[T, BruteForceRuntimeParams.type, D] = this
+
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: BruteForceRuntimeParams.type
+ ): Future[List[T]] =
+ bruteForceIndex.query(embedding, numOfNeighbours, runtimeParams)
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbours: Int,
+ runtimeParams: BruteForceRuntimeParams.type
+ ): Future[List[NeighborWithDistance[T, D]]] =
+ bruteForceIndex.queryWithDistance(embedding, numOfNeighbours, runtimeParams)
+
+ override def toDirectory(serializationDirectory: ResourceId): Unit = {
+ toDirectory(new IndexOutputFile(serializationDirectory))
+ }
+
+ override def toDirectory(serializationDirectory: AbstractFile): Unit = {
+ toDirectory(new IndexOutputFile(serializationDirectory))
+ }
+
+ private def toDirectory(serializationDirectory: IndexOutputFile): Unit = {
+ val outputStream = serializationDirectory.createFile(DataFileName).getOutputStream()
+ val thriftEmbeddings =
+ bruteForceIndex.linkedQueue.iterator().asScala.map { embedding =>
+ embeddingInjection(embedding)
+ }
+ try {
+ thriftIteratorIO.toOutputStream(thriftEmbeddings, outputStream)
+ } finally {
+ outputStream.close()
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/AnnInjections.scala b/ann/src/main/scala/com/twitter/ann/common/AnnInjections.scala
new file mode 100644
index 000000000..44ecbb49e
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/AnnInjections.scala
@@ -0,0 +1,28 @@
+package com.twitter.ann.common
+
+import com.twitter.bijection.{Bijection, Injection}
+
+// Class providing commonly used injections that can be used directly with ANN apis.
+// Injection prefixed with `J` can be used in java directly with ANN apis.
+object AnnInjections {
+ val LongInjection: Injection[Long, Array[Byte]] = Injection.long2BigEndian
+
+ def StringInjection: Injection[String, Array[Byte]] = Injection.utf8
+
+ def IntInjection: Injection[Int, Array[Byte]] = Injection.int2BigEndian
+
+ val JLongInjection: Injection[java.lang.Long, Array[Byte]] =
+ Bijection.long2Boxed
+ .asInstanceOf[Bijection[Long, java.lang.Long]]
+ .inverse
+ .andThen(LongInjection)
+
+ val JStringInjection: Injection[java.lang.String, Array[Byte]] =
+ StringInjection
+
+ val JIntInjection: Injection[java.lang.Integer, Array[Byte]] =
+ Bijection.int2Boxed
+ .asInstanceOf[Bijection[Int, java.lang.Integer]]
+ .inverse
+ .andThen(IntInjection)
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/Api.scala b/ann/src/main/scala/com/twitter/ann/common/Api.scala
new file mode 100644
index 000000000..5873c1bbb
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/Api.scala
@@ -0,0 +1,150 @@
+package com.twitter.ann.common
+
+import com.twitter.ann.common.EmbeddingType.EmbeddingVector
+import com.twitter.ml.api.embedding.Embedding
+import com.twitter.ml.api.embedding.EmbeddingMath
+import com.twitter.ml.api.embedding.EmbeddingSerDe
+import com.twitter.util.Future
+
+object EmbeddingType {
+ type EmbeddingVector = Embedding[Float]
+ val embeddingSerDe = EmbeddingSerDe.apply[Float]
+ private[common] val math = EmbeddingMath.Float
+}
+
+/**
+ * Typed entity with an embedding associated with it.
+ * @param id : Unique Id for an entity.
+ * @param embedding : Embedding/Vector of an entity.
+ * @tparam T: Type of id.
+ */
+case class EntityEmbedding[T](id: T, embedding: EmbeddingVector)
+
+// Query interface for ANN
+trait Queryable[T, P <: RuntimeParams, D <: Distance[D]] {
+
+ /**
+ * ANN query for ids.
+ * @param embedding: Embedding/Vector to be queried with.
+ * @param numOfNeighbors: Number of neighbours to be queried for.
+ * @param runtimeParams: Runtime params associated with index to control accuracy/latency etc.
+ * @return List of approximate nearest neighbour ids.
+ */
+ def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[T]]
+
+ /**
+ * ANN query for ids with distance.
+ * @param embedding: Embedding/Vector to be queried with.
+ * @param numOfNeighbors: Number of neighbours to be queried for.
+ * @param runtimeParams: Runtime params associated with index to control accuracy/latency etc.
+ * @return List of approximate nearest neighbour ids with distance from the query embedding.
+ */
+ def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[NeighborWithDistance[T, D]]]
+}
+
+// Query interface for ANN over indexes that are grouped
+trait QueryableGrouped[T, P <: RuntimeParams, D <: Distance[D]] extends Queryable[T, P, D] {
+
+ /**
+ * ANN query for ids.
+ * @param embedding: Embedding/Vector to be queried with.
+ * @param numOfNeighbors: Number of neighbours to be queried for.
+ * @param runtimeParams: Runtime params associated with index to control accuracy/latency etc.
+ * @param key: Optional key to lookup specific ANN index and perform query there
+ * @return List of approximate nearest neighbour ids.
+ */
+ def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P,
+ key: Option[String]
+ ): Future[List[T]]
+
+ /**
+ * ANN query for ids with distance.
+ * @param embedding: Embedding/Vector to be queried with.
+ * @param numOfNeighbors: Number of neighbours to be queried for.
+ * @param runtimeParams: Runtime params associated with index to control accuracy/latency etc.
+ * @param key: Optional key to lookup specific ANN index and perform query there
+ * @return List of approximate nearest neighbour ids with distance from the query embedding.
+ */
+ def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P,
+ key: Option[String]
+ ): Future[List[NeighborWithDistance[T, D]]]
+}
+
+/**
+ * Runtime params associated with index to control accuracy/latency etc while querying.
+ */
+trait RuntimeParams {}
+
+/**
+ * ANN query result with distance.
+ * @param neighbor : Id of the neighbours
+ * @param distance: Distance of neighbour from query ex: D: CosineDistance, L2Distance, InnerProductDistance
+ */
+case class NeighborWithDistance[T, D <: Distance[D]](neighbor: T, distance: D)
+
+/**
+ * ANN query result with seed entity for which this neighbor was provided.
+ * @param seed: Seed Id for which ann query was called
+ * @param neighbor : Id of the neighbours
+ */
+case class NeighborWithSeed[T1, T2](seed: T1, neighbor: T2)
+
+/**
+ * ANN query result with distance with seed entity for which this neighbor was provided.
+ * @param seed: Seed Id for which ann query was called
+ * @param neighbor : Id of the neighbours
+ * @param distance: Distance of neighbour from query ex: D: CosineDistance, L2Distance, InnerProductDistance
+ */
+case class NeighborWithDistanceWithSeed[T1, T2, D <: Distance[D]](
+ seed: T1,
+ neighbor: T2,
+ distance: D)
+
+trait RawAppendable[P <: RuntimeParams, D <: Distance[D]] {
+
+ /**
+ * Append an embedding in an index.
+ * @param embedding: Embedding/Vector
+ * @return Future of long id associated with embedding autogenerated.
+ */
+ def append(embedding: EmbeddingVector): Future[Long]
+
+ /**
+ * Convert an Appendable to Queryable interface to query an index.
+ */
+ def toQueryable: Queryable[Long, P, D]
+}
+
+// Index building interface for ANN.
+trait Appendable[T, P <: RuntimeParams, D <: Distance[D]] {
+
+ /**
+ * Append an entity with embedding in an index.
+ * @param entity: Entity with its embedding
+ */
+ def append(entity: EntityEmbedding[T]): Future[Unit]
+
+ /**
+ * Convert an Appendable to Queryable interface to query an index.
+ */
+ def toQueryable: Queryable[T, P, D]
+}
+
+// Updatable index interface for ANN.
+trait Updatable[T] {
+ def update(entity: EntityEmbedding[T]): Future[Unit]
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/BUILD b/ann/src/main/scala/com/twitter/ann/common/BUILD
new file mode 100644
index 000000000..49e1a987e
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/BUILD
@@ -0,0 +1,21 @@
+scala_library(
+ sources = ["*.scala"],
+ compiler_option_sets = ["fatal_warnings"],
+ platform = "java8",
+ tags = ["bazel-compatible"],
+ dependencies = [
+ "3rdparty/jvm/com/google/guava",
+ "3rdparty/jvm/com/twitter/bijection:core",
+ "3rdparty/jvm/com/twitter/storehaus:core",
+ "3rdparty/jvm/org/apache/beam:beam-sdks-java-io-google-cloud-platform",
+ "ann/src/main/thrift/com/twitter/ann/common:ann-common-scala",
+ "finatra/inject/inject-mdc/src/main/scala",
+ "mediaservices/commons/src/main/scala:futuretracker",
+ "src/java/com/twitter/search/common/file",
+ "src/scala/com/twitter/ml/api/embedding",
+ "stitch/stitch-core",
+ ],
+ exports = [
+ "3rdparty/jvm/com/twitter/bijection:core",
+ ],
+)
diff --git a/ann/src/main/scala/com/twitter/ann/common/EmbeddingProducer.scala b/ann/src/main/scala/com/twitter/ann/common/EmbeddingProducer.scala
new file mode 100644
index 000000000..1b99ed9c4
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/EmbeddingProducer.scala
@@ -0,0 +1,13 @@
+package com.twitter.ann.common
+
+import com.twitter.stitch.Stitch
+
+trait EmbeddingProducer[T] {
+
+ /**
+ * Produce an embedding from type T. Implementations of this could do a lookup from an id to an
+ * embedding. Or they could run a deep model on features that output and embedding.
+ * @return An embedding Stitch. See go/stitch for details on how to use the Stitch API.
+ */
+ def produceEmbedding(input: T): Stitch[Option[EmbeddingType.EmbeddingVector]]
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/IndexOutputFile.scala b/ann/src/main/scala/com/twitter/ann/common/IndexOutputFile.scala
new file mode 100644
index 000000000..0e71a317a
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/IndexOutputFile.scala
@@ -0,0 +1,226 @@
+package com.twitter.ann.common
+
+import com.google.common.io.ByteStreams
+import com.twitter.ann.common.thriftscala.AnnIndexMetadata
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec
+import com.twitter.mediaservices.commons.codec.ThriftByteBufferCodec
+import com.twitter.search.common.file.AbstractFile
+import java.io.IOException
+import java.io.InputStream
+import java.io.OutputStream
+import java.nio.channels.Channels
+import org.apache.beam.sdk.io.FileSystems
+import org.apache.beam.sdk.io.fs.MoveOptions
+import org.apache.beam.sdk.io.fs.ResolveOptions
+import org.apache.beam.sdk.io.fs.ResolveOptions.StandardResolveOptions
+import org.apache.beam.sdk.io.fs.ResourceId
+import org.apache.beam.sdk.util.MimeTypes
+import org.apache.hadoop.io.IOUtils
+import scala.collection.JavaConverters._
+
+/**
+ * This class creates a wrapper around GCS filesystem and HDFS filesystem for the index
+ * generation job. It implements the basic methods required by the index generation job and hides
+ * the logic around handling HDFS vs GCS.
+ */
+class IndexOutputFile(val abstractFile: AbstractFile, val resourceId: ResourceId) {
+
+ // Success file name
+ private val SUCCESS_FILE = "_SUCCESS"
+ private val INDEX_METADATA_FILE = "ANN_INDEX_METADATA"
+ private val MetadataCodec = new ThriftByteBufferCodec[AnnIndexMetadata](AnnIndexMetadata)
+
+ /**
+ * Constructor for ResourceId. This is used for GCS filesystem
+ * @param resourceId
+ */
+ def this(resourceId: ResourceId) = {
+ this(null, resourceId)
+ }
+
+ /**
+ * Constructor for AbstractFile. This is used for HDFS and local filesystem
+ * @param abstractFile
+ */
+ def this(abstractFile: AbstractFile) = {
+ this(abstractFile, null)
+ }
+
+ /**
+ * Returns true if this instance is around an AbstractFile.
+ * @return
+ */
+ def isAbstractFile(): Boolean = {
+ abstractFile != null
+ }
+
+ /**
+ * Creates a _SUCCESS file in the current directory.
+ */
+ def createSuccessFile(): Unit = {
+ if (isAbstractFile()) {
+ abstractFile.createSuccessFile()
+ } else {
+ val successFile =
+ resourceId.resolve(SUCCESS_FILE, ResolveOptions.StandardResolveOptions.RESOLVE_FILE)
+ val successWriterChannel = FileSystems.create(successFile, MimeTypes.BINARY)
+ successWriterChannel.close()
+ }
+ }
+
+ /**
+ * Returns whether the current instance represents a directory
+ * @return True if the current instance is a directory
+ */
+ def isDirectory(): Boolean = {
+ if (isAbstractFile()) {
+ abstractFile.isDirectory
+ } else {
+ resourceId.isDirectory
+ }
+ }
+
+ /**
+ * Return the current path of the file represented by the current instance
+ * @return The path string of the file/directory
+ */
+ def getPath(): String = {
+ if (isAbstractFile()) {
+ abstractFile.getPath.toString
+ } else {
+ if (resourceId.isDirectory) {
+ resourceId.getCurrentDirectory.toString
+ } else {
+ resourceId.getCurrentDirectory.toString + resourceId.getFilename
+ }
+ }
+ }
+
+ /**
+ * Creates a new file @param fileName in the current directory.
+ * @param fileName
+ * @return A new file inside the current directory
+ */
+ def createFile(fileName: String): IndexOutputFile = {
+ if (isAbstractFile()) {
+ // AbstractFile treats files and directories the same way. Hence, not checking for directory
+ // here.
+ new IndexOutputFile(abstractFile.getChild(fileName))
+ } else {
+ if (!resourceId.isDirectory) {
+ // If this is not a directory, throw exception.
+ throw new IllegalArgumentException(getPath() + " is not a directory.")
+ }
+ new IndexOutputFile(
+ resourceId.resolve(fileName, ResolveOptions.StandardResolveOptions.RESOLVE_FILE))
+ }
+ }
+
+ /**
+ * Creates a new directory @param directoryName in the current directory.
+ * @param directoryName
+ * @return A new directory inside the current directory
+ */
+ def createDirectory(directoryName: String): IndexOutputFile = {
+ if (isAbstractFile()) {
+ // AbstractFile treats files and directories the same way. Hence, not checking for directory
+ // here.
+ val dir = abstractFile.getChild(directoryName)
+ dir.mkdirs()
+ new IndexOutputFile(dir)
+ } else {
+ if (!resourceId.isDirectory) {
+ // If this is not a directory, throw exception.
+ throw new IllegalArgumentException(getPath() + " is not a directory.")
+ }
+ val newResourceId =
+ resourceId.resolve(directoryName, ResolveOptions.StandardResolveOptions.RESOLVE_DIRECTORY)
+
+ // Create a tmp file and delete in order to trigger directory creation
+ val tmpFile =
+ newResourceId.resolve("tmp", ResolveOptions.StandardResolveOptions.RESOLVE_FILE)
+ val tmpWriterChannel = FileSystems.create(tmpFile, MimeTypes.BINARY)
+ tmpWriterChannel.close()
+ FileSystems.delete(List(tmpFile).asJava, MoveOptions.StandardMoveOptions.IGNORE_MISSING_FILES)
+
+ new IndexOutputFile(newResourceId)
+ }
+ }
+
+ def getChild(fileName: String, isDirectory: Boolean = false): IndexOutputFile = {
+ if (isAbstractFile()) {
+ new IndexOutputFile(abstractFile.getChild(fileName))
+ } else {
+ val resolveOption = if (isDirectory) {
+ StandardResolveOptions.RESOLVE_DIRECTORY
+ } else {
+ StandardResolveOptions.RESOLVE_FILE
+ }
+ new IndexOutputFile(resourceId.resolve(fileName, resolveOption))
+ }
+ }
+
+ /**
+ * Returns an OutputStream for the underlying file.
+ * Note: Close the OutputStream after writing
+ * @return
+ */
+ def getOutputStream(): OutputStream = {
+ if (isAbstractFile()) {
+ abstractFile.getByteSink.openStream()
+ } else {
+ if (resourceId.isDirectory) {
+ // If this is a directory, throw exception.
+ throw new IllegalArgumentException(getPath() + " is a directory.")
+ }
+ val writerChannel = FileSystems.create(resourceId, MimeTypes.BINARY)
+ Channels.newOutputStream(writerChannel)
+ }
+ }
+
+ /**
+ * Returns an InputStream for the underlying file.
+ * Note: Close the InputStream after reading
+ * @return
+ */
+ def getInputStream(): InputStream = {
+ if (isAbstractFile()) {
+ abstractFile.getByteSource.openStream()
+ } else {
+ if (resourceId.isDirectory) {
+ // If this is a directory, throw exception.
+ throw new IllegalArgumentException(getPath() + " is a directory.")
+ }
+ val readChannel = FileSystems.open(resourceId)
+ Channels.newInputStream(readChannel)
+ }
+ }
+
+ /**
+ * Copies content from the srcIn into the current file.
+ * @param srcIn
+ */
+ def copyFrom(srcIn: InputStream): Unit = {
+ val out = getOutputStream()
+ try {
+ IOUtils.copyBytes(srcIn, out, 4096)
+ out.close()
+ } catch {
+ case ex: IOException =>
+ IOUtils.closeStream(out);
+ throw ex;
+ }
+ }
+
+ def writeIndexMetadata(annIndexMetadata: AnnIndexMetadata): Unit = {
+ val out = createFile(INDEX_METADATA_FILE).getOutputStream()
+ val bytes = ArrayByteBufferCodec.decode(MetadataCodec.encode(annIndexMetadata))
+ out.write(bytes)
+ out.close()
+ }
+
+ def loadIndexMetadata(): AnnIndexMetadata = {
+ val in = ByteStreams.toByteArray(getInputStream())
+ MetadataCodec.decode(ArrayByteBufferCodec.encode(in))
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/IndexTransformer.scala b/ann/src/main/scala/com/twitter/ann/common/IndexTransformer.scala
new file mode 100644
index 000000000..b096e2a57
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/IndexTransformer.scala
@@ -0,0 +1,118 @@
+package com.twitter.ann.common
+
+import com.twitter.ann.common.EmbeddingType.EmbeddingVector
+import com.twitter.storehaus.{ReadableStore, Store}
+import com.twitter.util.Future
+
+// Utility to transform raw index to typed index using Store
+object IndexTransformer {
+
+ /**
+ * Transform a long type queryable index to Typed queryable index
+ * @param index: Raw Queryable index
+ * @param store: Readable store to provide mappings between Long and T
+ * @tparam T: Type to transform to
+ * @tparam P: Runtime params
+ * @return Queryable index typed on T
+ */
+ def transformQueryable[T, P <: RuntimeParams, D <: Distance[D]](
+ index: Queryable[Long, P, D],
+ store: ReadableStore[Long, T]
+ ): Queryable[T, P, D] = {
+ new Queryable[T, P, D] {
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[T]] = {
+ val neighbors = index.query(embedding, numOfNeighbors, runtimeParams)
+ neighbors
+ .flatMap(nn => {
+ val ids = nn.map(id => store.get(id).map(_.get))
+ Future
+ .collect(ids)
+ .map(_.toList)
+ })
+ }
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[NeighborWithDistance[T, D]]] = {
+ val neighbors = index.queryWithDistance(embedding, numOfNeighbors, runtimeParams)
+ neighbors
+ .flatMap(nn => {
+ val ids = nn.map(obj =>
+ store.get(obj.neighbor).map(id => NeighborWithDistance(id.get, obj.distance)))
+ Future
+ .collect(ids)
+ .map(_.toList)
+ })
+ }
+ }
+ }
+
+ /**
+ * Transform a long type appendable index to Typed appendable index
+ * @param index: Raw Appendable index
+ * @param store: Writable store to store mappings between Long and T
+ * @tparam T: Type to transform to
+ * @return Appendable index typed on T
+ */
+ def transformAppendable[T, P <: RuntimeParams, D <: Distance[D]](
+ index: RawAppendable[P, D],
+ store: Store[Long, T]
+ ): Appendable[T, P, D] = {
+ new Appendable[T, P, D]() {
+ override def append(entity: EntityEmbedding[T]): Future[Unit] = {
+ index
+ .append(entity.embedding)
+ .flatMap(id => store.put((id, Some(entity.id))))
+ }
+
+ override def toQueryable: Queryable[T, P, D] = {
+ transformQueryable(index.toQueryable, store)
+ }
+ }
+ }
+
+ /**
+ * Transform a long type appendable and queryable index to Typed appendable and queryable index
+ * @param index: Raw Appendable and queryable index
+ * @param store: Store to provide/store mappings between Long and T
+ * @tparam T: Type to transform to
+ * @tparam Index: Index
+ * @return Appendable and queryable index typed on T
+ */
+ def transform1[
+ Index <: RawAppendable[P, D] with Queryable[Long, P, D],
+ T,
+ P <: RuntimeParams,
+ D <: Distance[D]
+ ](
+ index: Index,
+ store: Store[Long, T]
+ ): Queryable[T, P, D] with Appendable[T, P, D] = {
+ val queryable = transformQueryable(index, store)
+ val appendable = transformAppendable(index, store)
+
+ new Queryable[T, P, D] with Appendable[T, P, D] {
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ) = queryable.query(embedding, numOfNeighbors, runtimeParams)
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ) = queryable.queryWithDistance(embedding, numOfNeighbors, runtimeParams)
+
+ override def append(entity: EntityEmbedding[T]) = appendable.append(entity)
+
+ override def toQueryable: Queryable[T, P, D] = appendable.toQueryable
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/MemoizedInEpochs.scala b/ann/src/main/scala/com/twitter/ann/common/MemoizedInEpochs.scala
new file mode 100644
index 000000000..267aee636
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/MemoizedInEpochs.scala
@@ -0,0 +1,37 @@
+package com.twitter.ann.common
+
+import com.twitter.util.Return
+import com.twitter.util.Throw
+import com.twitter.util.Try
+import com.twitter.util.logging.Logging
+
+// Memoization with a twist
+// New epoch reuse K:V pairs from previous and recycle everything else
+class MemoizedInEpochs[K, V](f: K => Try[V]) extends Logging {
+ private var memoizedCalls: Map[K, V] = Map.empty
+
+ def epoch(keys: Seq[K]): Seq[V] = {
+ val newSet = keys.toSet
+ val keysToBeComputed = newSet.diff(memoizedCalls.keySet)
+ val computedKeysAndValues = keysToBeComputed.map { key =>
+ info(s"Memoize ${key}")
+ (key, f(key))
+ }
+ val keysAndValuesAfterFilteringFailures = computedKeysAndValues
+ .flatMap {
+ case (key, Return(value)) => Some((key, value))
+ case (key, Throw(e)) =>
+ warn(s"Calling f for ${key} has failed", e)
+
+ None
+ }
+ val keysReusedFromLastEpoch = memoizedCalls.filterKeys(newSet.contains)
+ memoizedCalls = keysReusedFromLastEpoch ++ keysAndValuesAfterFilteringFailures
+
+ debug(s"Final memoization is ${memoizedCalls.keys.mkString(", ")}")
+
+ keys.flatMap(memoizedCalls.get)
+ }
+
+ def currentEpochKeys: Set[K] = memoizedCalls.keySet
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/Metric.scala b/ann/src/main/scala/com/twitter/ann/common/Metric.scala
new file mode 100644
index 000000000..1c2c95aa9
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/Metric.scala
@@ -0,0 +1,290 @@
+package com.twitter.ann.common
+
+import com.google.common.collect.ImmutableBiMap
+import com.twitter.ann.common.EmbeddingType._
+import com.twitter.ann.common.thriftscala.DistanceMetric
+import com.twitter.ann.common.thriftscala.{CosineDistance => ServiceCosineDistance}
+import com.twitter.ann.common.thriftscala.{Distance => ServiceDistance}
+import com.twitter.ann.common.thriftscala.{InnerProductDistance => ServiceInnerProductDistance}
+import com.twitter.ann.common.thriftscala.{EditDistance => ServiceEditDistance}
+import com.twitter.ann.common.thriftscala.{L2Distance => ServiceL2Distance}
+import com.twitter.bijection.Injection
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+
+// Ann distance metrics
+trait Distance[D] extends Any with Ordered[D] {
+ def distance: Float
+}
+
+case class L2Distance(distance: Float) extends AnyVal with Distance[L2Distance] {
+ override def compare(that: L2Distance): Int =
+ Ordering.Float.compare(this.distance, that.distance)
+}
+
+case class CosineDistance(distance: Float) extends AnyVal with Distance[CosineDistance] {
+ override def compare(that: CosineDistance): Int =
+ Ordering.Float.compare(this.distance, that.distance)
+}
+
+case class InnerProductDistance(distance: Float)
+ extends AnyVal
+ with Distance[InnerProductDistance] {
+ override def compare(that: InnerProductDistance): Int =
+ Ordering.Float.compare(this.distance, that.distance)
+}
+
+case class EditDistance(distance: Float) extends AnyVal with Distance[EditDistance] {
+ override def compare(that: EditDistance): Int =
+ Ordering.Float.compare(this.distance, that.distance)
+}
+
+object Metric {
+ private[this] val thriftMetricMapping = ImmutableBiMap.of(
+ L2,
+ DistanceMetric.L2,
+ Cosine,
+ DistanceMetric.Cosine,
+ InnerProduct,
+ DistanceMetric.InnerProduct,
+ Edit,
+ DistanceMetric.EditDistance
+ )
+
+ def fromThrift(metric: DistanceMetric): Metric[_ <: Distance[_]] = {
+ thriftMetricMapping.inverse().get(metric)
+ }
+
+ def toThrift(metric: Metric[_ <: Distance[_]]): DistanceMetric = {
+ thriftMetricMapping.get(metric)
+ }
+
+ def fromString(metricName: String): Metric[_ <: Distance[_]]
+ with Injection[_, ServiceDistance] = {
+ metricName match {
+ case "Cosine" => Cosine
+ case "L2" => L2
+ case "InnerProduct" => InnerProduct
+ case "EditDistance" => Edit
+ case _ =>
+ throw new IllegalArgumentException(s"No Metric with the name $metricName")
+ }
+ }
+}
+
+sealed trait Metric[D <: Distance[D]] {
+ def distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): D
+ def absoluteDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float
+ def fromAbsoluteDistance(distance: Float): D
+}
+
+case object L2 extends Metric[L2Distance] with Injection[L2Distance, ServiceDistance] {
+ override def distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): L2Distance = {
+ fromAbsoluteDistance(MetricUtil.l2distance(embedding1, embedding2).toFloat)
+ }
+
+ override def fromAbsoluteDistance(distance: Float): L2Distance = {
+ L2Distance(distance)
+ }
+
+ override def absoluteDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = distance(embedding1, embedding2).distance
+
+ override def apply(scalaDistance: L2Distance): ServiceDistance = {
+ ServiceDistance.L2Distance(ServiceL2Distance(scalaDistance.distance))
+ }
+
+ override def invert(serviceDistance: ServiceDistance): Try[L2Distance] = {
+ serviceDistance match {
+ case ServiceDistance.L2Distance(l2Distance) =>
+ Success(L2Distance(l2Distance.distance.toFloat))
+ case distance =>
+ Failure(new IllegalArgumentException(s"Expected an l2 distance but got $distance"))
+ }
+ }
+}
+
+case object Cosine extends Metric[CosineDistance] with Injection[CosineDistance, ServiceDistance] {
+ override def distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): CosineDistance = {
+ fromAbsoluteDistance(1 - MetricUtil.cosineSimilarity(embedding1, embedding2))
+ }
+
+ override def fromAbsoluteDistance(distance: Float): CosineDistance = {
+ CosineDistance(distance)
+ }
+
+ override def absoluteDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = distance(embedding1, embedding2).distance
+
+ override def apply(scalaDistance: CosineDistance): ServiceDistance = {
+ ServiceDistance.CosineDistance(ServiceCosineDistance(scalaDistance.distance))
+ }
+
+ override def invert(serviceDistance: ServiceDistance): Try[CosineDistance] = {
+ serviceDistance match {
+ case ServiceDistance.CosineDistance(cosineDistance) =>
+ Success(CosineDistance(cosineDistance.distance.toFloat))
+ case distance =>
+ Failure(new IllegalArgumentException(s"Expected a cosine distance but got $distance"))
+ }
+ }
+}
+
+case object InnerProduct
+ extends Metric[InnerProductDistance]
+ with Injection[InnerProductDistance, ServiceDistance] {
+ override def distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): InnerProductDistance = {
+ fromAbsoluteDistance(1 - MetricUtil.dot(embedding1, embedding2))
+ }
+
+ override def fromAbsoluteDistance(distance: Float): InnerProductDistance = {
+ InnerProductDistance(distance)
+ }
+
+ override def absoluteDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = distance(embedding1, embedding2).distance
+
+ override def apply(scalaDistance: InnerProductDistance): ServiceDistance = {
+ ServiceDistance.InnerProductDistance(ServiceInnerProductDistance(scalaDistance.distance))
+ }
+
+ override def invert(
+ serviceDistance: ServiceDistance
+ ): Try[InnerProductDistance] = {
+ serviceDistance match {
+ case ServiceDistance.InnerProductDistance(cosineDistance) =>
+ Success(InnerProductDistance(cosineDistance.distance.toFloat))
+ case distance =>
+ Failure(
+ new IllegalArgumentException(s"Expected a inner product distance but got $distance")
+ )
+ }
+ }
+}
+
+case object Edit extends Metric[EditDistance] with Injection[EditDistance, ServiceDistance] {
+
+ private def intDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector,
+ pos1: Int,
+ pos2: Int,
+ precomputedDistances: scala.collection.mutable.Map[(Int, Int), Int]
+ ): Int = {
+ // return the remaining characters of other String
+ if (pos1 == 0) return pos2
+ if (pos2 == 0) return pos1
+
+ // To check if the recursive tree
+ // for given n & m has already been executed
+ precomputedDistances.getOrElse(
+ (pos1, pos2), {
+ // We might want to change this so that capitals are considered the same.
+ // Also maybe some characters that look similar should also be the same.
+ val computed = if (embedding1(pos1 - 1) == embedding2(pos2 - 1)) {
+ intDistance(embedding1, embedding2, pos1 - 1, pos2 - 1, precomputedDistances)
+ } else { // If characters are nt equal, we need to
+ // find the minimum cost out of all 3 operations.
+ val insert = intDistance(embedding1, embedding2, pos1, pos2 - 1, precomputedDistances)
+ val del = intDistance(embedding1, embedding2, pos1 - 1, pos2, precomputedDistances)
+ val replace =
+ intDistance(embedding1, embedding2, pos1 - 1, pos2 - 1, precomputedDistances)
+ 1 + Math.min(insert, Math.min(del, replace))
+ }
+ precomputedDistances.put((pos1, pos2), computed)
+ computed
+ }
+ )
+ }
+
+ override def distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): EditDistance = {
+ val editDistance = intDistance(
+ embedding1,
+ embedding2,
+ embedding1.length,
+ embedding2.length,
+ scala.collection.mutable.Map[(Int, Int), Int]()
+ )
+ EditDistance(editDistance)
+ }
+
+ override def fromAbsoluteDistance(distance: Float): EditDistance = {
+ EditDistance(distance.toInt)
+ }
+
+ override def absoluteDistance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = distance(embedding1, embedding2).distance
+
+ override def apply(scalaDistance: EditDistance): ServiceDistance = {
+ ServiceDistance.EditDistance(ServiceEditDistance(scalaDistance.distance.toInt))
+ }
+
+ override def invert(
+ serviceDistance: ServiceDistance
+ ): Try[EditDistance] = {
+ serviceDistance match {
+ case ServiceDistance.EditDistance(cosineDistance) =>
+ Success(EditDistance(cosineDistance.distance.toFloat))
+ case distance =>
+ Failure(
+ new IllegalArgumentException(s"Expected a inner product distance but got $distance")
+ )
+ }
+ }
+}
+
+object MetricUtil {
+ private[ann] def dot(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = {
+ math.dotProduct(embedding1, embedding2)
+ }
+
+ private[ann] def l2distance(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Double = {
+ math.l2Distance(embedding1, embedding2)
+ }
+
+ private[ann] def cosineSimilarity(
+ embedding1: EmbeddingVector,
+ embedding2: EmbeddingVector
+ ): Float = {
+ math.cosineSimilarity(embedding1, embedding2).toFloat
+ }
+
+ private[ann] def norm(
+ embedding: EmbeddingVector
+ ): EmbeddingVector = {
+ math.normalize(embedding)
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/QueryableById.scala b/ann/src/main/scala/com/twitter/ann/common/QueryableById.scala
new file mode 100644
index 000000000..0f1c8cfe2
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/QueryableById.scala
@@ -0,0 +1,41 @@
+package com.twitter.ann.common
+
+import com.twitter.stitch.Stitch
+
+/**
+ * This is a trait that allows you to query for nearest neighbors given an arbitrary type T1. This is
+ * in contrast to a regular com.twitter.ann.common.Appendable, which takes an embedding as the input
+ * argument.
+ *
+ * This interface uses the Stitch API for batching. See go/stitch for details on how to use it.
+ *
+ * @tparam T1 type of the query.
+ * @tparam T2 type of the result.
+ * @tparam P runtime parameters supported by the index.
+ * @tparam D distance function used in the index.
+ */
+trait QueryableById[T1, T2, P <: RuntimeParams, D <: Distance[D]] {
+ def queryById(
+ id: T1,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[T2]]
+
+ def queryByIdWithDistance(
+ id: T1,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithDistance[T2, D]]]
+
+ def batchQueryById(
+ ids: Seq[T1],
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithSeed[T1, T2]]]
+
+ def batchQueryWithDistanceById(
+ ids: Seq[T1],
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithDistanceWithSeed[T1, T2, D]]]
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/QueryableByIdImplementation.scala b/ann/src/main/scala/com/twitter/ann/common/QueryableByIdImplementation.scala
new file mode 100644
index 000000000..479414eb9
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/QueryableByIdImplementation.scala
@@ -0,0 +1,91 @@
+package com.twitter.ann.common
+
+import com.twitter.stitch.Stitch
+
+/**
+ * Implementation of QueryableById that composes an EmbeddingProducer and a Queryable so that we
+ * can get nearest neighbors given an id of type T1
+ * @param embeddingProducer provides an embedding given an id.
+ * @param queryable provides a list of neighbors given an embedding.
+ * @tparam T1 type of the query.
+ * @tparam T2 type of the result.
+ * @tparam P runtime parameters supported by the index.
+ * @tparam D distance function used in the index.
+ */
+class QueryableByIdImplementation[T1, T2, P <: RuntimeParams, D <: Distance[D]](
+ embeddingProducer: EmbeddingProducer[T1],
+ queryable: Queryable[T2, P, D])
+ extends QueryableById[T1, T2, P, D] {
+ override def queryById(
+ id: T1,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[T2]] = {
+ embeddingProducer.produceEmbedding(id).flatMap { embeddingOption =>
+ embeddingOption
+ .map { embedding =>
+ Stitch.callFuture(queryable.query(embedding, numOfNeighbors, runtimeParams))
+ }.getOrElse {
+ Stitch.value(List.empty)
+ }
+ }
+ }
+
+ override def queryByIdWithDistance(
+ id: T1,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithDistance[T2, D]]] = {
+ embeddingProducer.produceEmbedding(id).flatMap { embeddingOption =>
+ embeddingOption
+ .map { embedding =>
+ Stitch.callFuture(queryable.queryWithDistance(embedding, numOfNeighbors, runtimeParams))
+ }.getOrElse {
+ Stitch.value(List.empty)
+ }
+ }
+ }
+
+ override def batchQueryById(
+ ids: Seq[T1],
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithSeed[T1, T2]]] = {
+ Stitch
+ .traverse(ids) { id =>
+ embeddingProducer.produceEmbedding(id).flatMap { embeddingOption =>
+ embeddingOption
+ .map { embedding =>
+ Stitch
+ .callFuture(queryable.query(embedding, numOfNeighbors, runtimeParams)).map(
+ _.map(neighbor => NeighborWithSeed(id, neighbor)))
+ }.getOrElse {
+ Stitch.value(List.empty)
+ }.handle { case _ => List.empty }
+ }
+ }.map { _.toList.flatten }
+ }
+
+ override def batchQueryWithDistanceById(
+ ids: Seq[T1],
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Stitch[List[NeighborWithDistanceWithSeed[T1, T2, D]]] = {
+ Stitch
+ .traverse(ids) { id =>
+ embeddingProducer.produceEmbedding(id).flatMap { embeddingOption =>
+ embeddingOption
+ .map { embedding =>
+ Stitch
+ .callFuture(queryable.queryWithDistance(embedding, numOfNeighbors, runtimeParams))
+ .map(_.map(neighbor =>
+ NeighborWithDistanceWithSeed(id, neighbor.neighbor, neighbor.distance)))
+ }.getOrElse {
+ Stitch.value(List.empty)
+ }.handle { case _ => List.empty }
+ }
+ }.map {
+ _.toList.flatten
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/QueryableOperations.scala b/ann/src/main/scala/com/twitter/ann/common/QueryableOperations.scala
new file mode 100644
index 000000000..9cd72b066
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/QueryableOperations.scala
@@ -0,0 +1,26 @@
+package com.twitter.ann.common
+
+import com.twitter.ann.common.EmbeddingType.EmbeddingVector
+import com.twitter.util.Future
+
+object QueryableOperations {
+ implicit class Map[T, P <: RuntimeParams, D <: Distance[D]](
+ val q: Queryable[T, P, D]) {
+ def mapRuntimeParameters(f: P => P): Queryable[T, P, D] = {
+ new Queryable[T, P, D] {
+ def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[T]] = q.query(embedding, numOfNeighbors, f(runtimeParams))
+
+ def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[NeighborWithDistance[T, D]]] =
+ q.queryWithDistance(embedding, numOfNeighbors, f(runtimeParams))
+ }
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/ReadWriteFuturePool.scala b/ann/src/main/scala/com/twitter/ann/common/ReadWriteFuturePool.scala
new file mode 100644
index 000000000..5c6c2ba70
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/ReadWriteFuturePool.scala
@@ -0,0 +1,29 @@
+package com.twitter.ann.common
+import com.google.common.annotations.VisibleForTesting
+import com.twitter.util.{Future, FuturePool}
+
+trait ReadWriteFuturePool {
+ def read[T](f: => T): Future[T]
+ def write[T](f: => T): Future[T]
+}
+
+object ReadWriteFuturePool {
+ def apply(readPool: FuturePool, writePool: FuturePool): ReadWriteFuturePool = {
+ new ReadWriteFuturePoolANN(readPool, writePool)
+ }
+
+ def apply(commonPool: FuturePool): ReadWriteFuturePool = {
+ new ReadWriteFuturePoolANN(commonPool, commonPool)
+ }
+}
+
+@VisibleForTesting
+private[ann] class ReadWriteFuturePoolANN(readPool: FuturePool, writePool: FuturePool)
+ extends ReadWriteFuturePool {
+ def read[T](f: => T): Future[T] = {
+ readPool.apply(f)
+ }
+ def write[T](f: => T): Future[T] = {
+ writePool.apply(f)
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/Serialization.scala b/ann/src/main/scala/com/twitter/ann/common/Serialization.scala
new file mode 100644
index 000000000..155042d07
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/Serialization.scala
@@ -0,0 +1,28 @@
+package com.twitter.ann.common
+
+import com.twitter.search.common.file.AbstractFile
+import org.apache.beam.sdk.io.fs.ResourceId
+
+/**
+ * Interface for writing an Appendable to a directory.
+ */
+trait Serialization {
+ def toDirectory(
+ serializationDirectory: AbstractFile
+ ): Unit
+
+ def toDirectory(
+ serializationDirectory: ResourceId
+ ): Unit
+}
+
+/**
+ * Interface for reading a Queryable from a directory
+ * @tparam T the id of the embeddings
+ * @tparam Q type of the Queryable that is deserialized.
+ */
+trait QueryableDeserialization[T, P <: RuntimeParams, D <: Distance[D], Q <: Queryable[T, P, D]] {
+ def fromDirectory(
+ serializationDirectory: AbstractFile
+ ): Q
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/ServiceClientQueryable.scala b/ann/src/main/scala/com/twitter/ann/common/ServiceClientQueryable.scala
new file mode 100644
index 000000000..6b4893aef
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/ServiceClientQueryable.scala
@@ -0,0 +1,64 @@
+package com.twitter.ann.common
+
+import com.twitter.ann.common.EmbeddingType._
+import com.twitter.ann.common.thriftscala.{
+ NearestNeighborQuery,
+ NearestNeighborResult,
+ Distance => ServiceDistance,
+ RuntimeParams => ServiceRuntimeParams
+}
+import com.twitter.bijection.Injection
+import com.twitter.finagle.Service
+import com.twitter.mediaservices.commons.codec.ArrayByteBufferCodec
+import com.twitter.util.Future
+
+class ServiceClientQueryable[T, P <: RuntimeParams, D <: Distance[D]](
+ service: Service[NearestNeighborQuery, NearestNeighborResult],
+ runtimeParamInjection: Injection[P, ServiceRuntimeParams],
+ distanceInjection: Injection[D, ServiceDistance],
+ idInjection: Injection[T, Array[Byte]])
+ extends Queryable[T, P, D] {
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[T]] = {
+ service
+ .apply(
+ NearestNeighborQuery(
+ embeddingSerDe.toThrift(embedding),
+ withDistance = false,
+ runtimeParamInjection(runtimeParams),
+ numOfNeighbors
+ )
+ )
+ .map { result =>
+ result.nearestNeighbors.map { nearestNeighbor =>
+ idInjection.invert(ArrayByteBufferCodec.decode(nearestNeighbor.id)).get
+ }.toList
+ }
+ }
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[NeighborWithDistance[T, D]]] =
+ service
+ .apply(
+ NearestNeighborQuery(
+ embeddingSerDe.toThrift(embedding),
+ withDistance = true,
+ runtimeParamInjection(runtimeParams),
+ numOfNeighbors
+ )
+ )
+ .map { result =>
+ result.nearestNeighbors.map { nearestNeighbor =>
+ NeighborWithDistance(
+ idInjection.invert(ArrayByteBufferCodec.decode(nearestNeighbor.id)).get,
+ distanceInjection.invert(nearestNeighbor.distance.get).get
+ )
+ }.toList
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/ShardApi.scala b/ann/src/main/scala/com/twitter/ann/common/ShardApi.scala
new file mode 100644
index 000000000..9351bd418
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/ShardApi.scala
@@ -0,0 +1,87 @@
+package com.twitter.ann.common
+
+import com.twitter.ann.common.EmbeddingType.EmbeddingVector
+import com.twitter.util.Future
+import scala.util.Random
+
+trait ShardFunction[T] {
+
+ /**
+ * Shard function to shard embedding based on total shards and embedding data.
+ * @param shards
+ * @param entity
+ * @return Shard index, from 0(Inclusive) to shards(Exclusive))
+ */
+ def apply(shards: Int, entity: EntityEmbedding[T]): Int
+}
+
+/**
+ * Randomly shards the embeddings based on number of total shards.
+ */
+class RandomShardFunction[T] extends ShardFunction[T] {
+ def apply(shards: Int, entity: EntityEmbedding[T]): Int = {
+ Random.nextInt(shards)
+ }
+}
+
+/**
+ * Sharded appendable to shard the embedding into different appendable indices
+ * @param indices: Sequence of appendable indices
+ * @param shardFn: Shard function to shard data into different indices
+ * @param shards: Total shards
+ * @tparam T: Type of id.
+ */
+class ShardedAppendable[T, P <: RuntimeParams, D <: Distance[D]](
+ indices: Seq[Appendable[T, P, D]],
+ shardFn: ShardFunction[T],
+ shards: Int)
+ extends Appendable[T, P, D] {
+ override def append(entity: EntityEmbedding[T]): Future[Unit] = {
+ val shard = shardFn(shards, entity)
+ val index = indices(shard)
+ index.append(entity)
+ }
+
+ override def toQueryable: Queryable[T, P, D] = {
+ new ComposedQueryable[T, P, D](indices.map(_.toQueryable))
+ }
+}
+
+/**
+ * Composition of sequence of queryable indices, it queries all the indices,
+ * and merges the result in memory to return the K nearest neighbours
+ * @param indices: Sequence of queryable indices
+ * @tparam T: Type of id
+ * @tparam P: Type of runtime param
+ * @tparam D: Type of distance metric
+ */
+class ComposedQueryable[T, P <: RuntimeParams, D <: Distance[D]](
+ indices: Seq[Queryable[T, P, D]])
+ extends Queryable[T, P, D] {
+ private[this] val ordering =
+ Ordering.by[NeighborWithDistance[T, D], D](_.distance)
+ override def query(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[T]] = {
+ val neighbours = queryWithDistance(embedding, numOfNeighbors, runtimeParams)
+ neighbours.map(list => list.map(nn => nn.neighbor))
+ }
+
+ override def queryWithDistance(
+ embedding: EmbeddingVector,
+ numOfNeighbors: Int,
+ runtimeParams: P
+ ): Future[List[NeighborWithDistance[T, D]]] = {
+ val futures = Future.collect(
+ indices.map(index => index.queryWithDistance(embedding, numOfNeighbors, runtimeParams))
+ )
+ futures.map { list =>
+ list.flatten
+ .sorted(ordering)
+ .take(numOfNeighbors)
+ .toList
+ }
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/ShardedSerialization.scala b/ann/src/main/scala/com/twitter/ann/common/ShardedSerialization.scala
new file mode 100644
index 000000000..9b9cda264
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/ShardedSerialization.scala
@@ -0,0 +1,89 @@
+package com.twitter.ann.common
+
+import com.twitter.search.common.file.AbstractFile
+import com.twitter.search.common.file.AbstractFile.Filter
+import com.twitter.util.Future
+import org.apache.beam.sdk.io.fs.ResourceId
+import scala.collection.JavaConverters._
+
+object ShardConstants {
+ val ShardPrefix = "shard_"
+}
+
+/**
+ * Serialize shards to directory
+ * @param shards: List of shards to serialize
+ */
+class ShardedSerialization(
+ shards: Seq[Serialization])
+ extends Serialization {
+ override def toDirectory(directory: AbstractFile): Unit = {
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ override def toDirectory(directory: ResourceId): Unit = {
+ toDirectory(new IndexOutputFile(directory))
+ }
+
+ private def toDirectory(directory: IndexOutputFile): Unit = {
+ shards.indices.foreach { shardId =>
+ val shardDirectory = directory.createDirectory(ShardConstants.ShardPrefix + shardId)
+ val serialization = shards(shardId)
+ if (shardDirectory.isAbstractFile) {
+ serialization.toDirectory(shardDirectory.abstractFile)
+ } else {
+ serialization.toDirectory(shardDirectory.resourceId)
+ }
+ }
+ }
+}
+
+/**
+ * Deserialize directories containing index shards data to a composed queryable
+ * @param deserializationFn function to deserialize a shard file to Queryable
+ * @tparam T the id of the embeddings
+ * @tparam P : Runtime params type
+ * @tparam D: Distance metric type
+ */
+class ComposedQueryableDeserialization[T, P <: RuntimeParams, D <: Distance[D]](
+ deserializationFn: (AbstractFile) => Queryable[T, P, D])
+ extends QueryableDeserialization[T, P, D, Queryable[T, P, D]] {
+ override def fromDirectory(directory: AbstractFile): Queryable[T, P, D] = {
+ val shardDirs = directory
+ .listFiles(new Filter {
+ override def accept(file: AbstractFile): Boolean =
+ file.getName.startsWith(ShardConstants.ShardPrefix)
+ })
+ .asScala
+ .toList
+
+ val indices = shardDirs
+ .map { shardDir =>
+ deserializationFn(shardDir)
+ }
+
+ new ComposedQueryable[T, P, D](indices)
+ }
+}
+
+class ShardedIndexBuilderWithSerialization[T, P <: RuntimeParams, D <: Distance[D]](
+ shardedIndex: ShardedAppendable[T, P, D],
+ shardedSerialization: ShardedSerialization)
+ extends Appendable[T, P, D]
+ with Serialization {
+ override def append(entity: EntityEmbedding[T]): Future[Unit] = {
+ shardedIndex.append(entity)
+ }
+
+ override def toDirectory(directory: AbstractFile): Unit = {
+ shardedSerialization.toDirectory(directory)
+ }
+
+ override def toDirectory(directory: ResourceId): Unit = {
+ shardedSerialization.toDirectory(directory)
+ }
+
+ override def toQueryable: Queryable[T, P, D] = {
+ shardedIndex.toQueryable
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/common/Task.scala b/ann/src/main/scala/com/twitter/ann/common/Task.scala
new file mode 100644
index 000000000..eaad03a88
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/common/Task.scala
@@ -0,0 +1,121 @@
+package com.twitter.ann.common
+
+import com.twitter.finagle.stats.CategorizingExceptionStatsHandler
+import com.twitter.finagle.stats.StatsReceiver
+import com.twitter.finagle.tracing.DefaultTracer
+import com.twitter.finagle.tracing.Trace
+import com.twitter.finagle.util.DefaultTimer
+import com.twitter.finagle.util.Rng
+import com.twitter.inject.logging.MDCKeys
+import com.twitter.util.Closable
+import com.twitter.util.Duration
+import com.twitter.util.Future
+import com.twitter.util.Time
+import com.twitter.util.Timer
+import com.twitter.util.logging.Logging
+import java.util.concurrent.atomic.AtomicInteger
+import org.slf4j.MDC
+
+/**
+ * A Task that will be scheduled to execute periodically on every interval. If a task takes
+ * longer than an interval to complete, it will be immediately scheduled to run.
+ */
+trait Task extends Closable { self: Logging =>
+
+ // Exposed if the implementation of `task` need to report failures
+ val exnStatsHandler = new CategorizingExceptionStatsHandler(categorizer = _ => Some("failures"))
+
+ protected val statsReceiver: StatsReceiver
+ private val totalTasks = statsReceiver.counter("total")
+ private val successfulTasks = statsReceiver.counter("success")
+ private val taskLatency = statsReceiver.stat("latency_ms")
+
+ private val activeTasks = new AtomicInteger(0)
+
+ protected[common] val rng: Rng = Rng.threadLocal
+ protected[common] val timer: Timer = DefaultTimer
+
+ @volatile private var taskLoop: Future[Unit] = null
+
+ /** Execute the task wih bookkeeping **/
+ private def run(): Future[Unit] = {
+ totalTasks.incr()
+ activeTasks.getAndIncrement()
+
+ val start = Time.now
+ val runningTask =
+ // Setup a new trace root for this task. We also want logs to contain
+ // the same trace information finatra populates for requests.
+ // See com.twitter.finatra.thrift.filters.TraceIdMDCFilter
+ Trace.letTracerAndNextId(DefaultTracer) {
+ val trace = Trace()
+ MDC.put(MDCKeys.TraceId, trace.id.traceId.toString)
+ MDC.put(MDCKeys.TraceSampled, trace.id._sampled.getOrElse(false).toString)
+ MDC.put(MDCKeys.TraceSpanId, trace.id.spanId.toString)
+
+ info(s"starting task ${getClass.toString}")
+ task()
+ .onSuccess({ _ =>
+ info(s"completed task ${getClass.toString}")
+ successfulTasks.incr()
+ })
+ .onFailure({ e =>
+ warn(s"failed task. ", e)
+ exnStatsHandler.record(statsReceiver, e)
+ })
+ }
+
+ runningTask.transform { _ =>
+ val elapsed = Time.now - start
+ activeTasks.getAndDecrement()
+ taskLatency.add(elapsed.inMilliseconds)
+
+ Future
+ .sleep(taskInterval)(timer)
+ .before(run())
+ }
+ }
+
+ // Body of a task to run
+ protected def task(): Future[Unit]
+
+ // Task interval
+ protected def taskInterval: Duration
+
+ /**
+ * Start the task after random jitter
+ */
+ final def jitteredStart(): Unit = synchronized {
+ if (taskLoop != null) {
+ throw new RuntimeException(s"task already started")
+ } else {
+ val jitterNs = rng.nextLong(taskInterval.inNanoseconds)
+ val jitter = Duration.fromNanoseconds(jitterNs)
+
+ taskLoop = Future
+ .sleep(jitter)(timer)
+ .before(run())
+ }
+ }
+
+ /**
+ * Start the task without applying any delay
+ */
+ final def startImmediately(): Unit = synchronized {
+ if (taskLoop != null) {
+ throw new RuntimeException(s"task already started")
+ } else {
+ taskLoop = run()
+ }
+ }
+
+ /**
+ * Close the task. A closed task cannot be restarted.
+ */
+ override def close(deadline: Time): Future[Unit] = {
+ if (taskLoop != null) {
+ taskLoop.raise(new InterruptedException("task closed"))
+ }
+ Future.Done
+ }
+}
diff --git a/ann/src/main/scala/com/twitter/ann/dataflow/offline/ANNIndexBuilderBeamJob.scala b/ann/src/main/scala/com/twitter/ann/dataflow/offline/ANNIndexBuilderBeamJob.scala
new file mode 100644
index 000000000..64ab583ab
--- /dev/null
+++ b/ann/src/main/scala/com/twitter/ann/dataflow/offline/ANNIndexBuilderBeamJob.scala
@@ -0,0 +1,461 @@
+package com.twitter.ann.dataflow.offline
+
+import com.spotify.scio.ScioContext
+import com.spotify.scio.ScioMetrics
+import com.twitter.ann.annoy.TypedAnnoyIndex
+import com.twitter.ann.brute_force.SerializableBruteForceIndex
+import com.twitter.ann.common.thriftscala.AnnIndexMetadata
+import com.twitter.ann.common.Distance
+import com.twitter.ann.common.Cosine
+import com.twitter.ann.common.EntityEmbedding
+import com.twitter.ann.common.IndexOutputFile
+import com.twitter.ann.common.Metric
+import com.twitter.ann.common.ReadWriteFuturePool
+import com.twitter.ann.faiss.FaissIndexer
+import com.twitter.ann.hnsw.TypedHnswIndex
+import com.twitter.ann.serialization.PersistedEmbeddingInjection
+import com.twitter.ann.serialization.ThriftIteratorIO
+import com.twitter.ann.serialization.thriftscala.PersistedEmbedding
+import com.twitter.ann.util.IndexBuilderUtils
+import com.twitter.beam.io.bigquery.BigQueryIO
+import com.twitter.beam.io.dal.DalObservedDatasetRegistration
+import com.twitter.beam.job.DateRange
+import com.twitter.beam.job.DateRangeOptions
+import com.twitter.cortex.ml.embeddings.common._
+import com.twitter.ml.api.embedding.Embedding
+import com.twitter.ml.api.embedding.EmbeddingMath
+import com.twitter.ml.api.embedding.EmbeddingSerDe
+import com.twitter.ml.api.thriftscala.{Embedding => TEmbedding}
+import com.twitter.ml.featurestore.lib.EntityId
+import com.twitter.ml.featurestore.lib.SemanticCoreId
+import com.twitter.ml.featurestore.lib.TfwId
+import com.twitter.ml.featurestore.lib.TweetId
+import com.twitter.ml.featurestore.lib.UserId
+import com.twitter.scalding.DateOps
+import com.twitter.scalding.RichDate
+import com.twitter.scio_internal.job.ScioBeamJob
+import com.twitter.statebird.v2.thriftscala.{Environment => StatebirdEnvironment}
+import com.twitter.util.Await
+import com.twitter.util.FuturePool
+import com.twitter.wtf.beam.bq_embedding_export.BQQueryUtils
+import java.time.Instant
+import java.util.TimeZone
+import java.util.concurrent.Executors
+import org.apache.beam.sdk.io.FileSystems
+import org.apache.beam.sdk.io.fs.ResolveOptions
+import org.apache.beam.sdk.io.fs.ResourceId
+import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead
+import org.apache.beam.sdk.options.Default
+import org.apache.beam.sdk.options.Description
+import org.apache.beam.sdk.transforms.DoFn
+import org.apache.beam.sdk.transforms.DoFn._
+import org.apache.beam.sdk.transforms.PTransform
+import org.apache.beam.sdk.transforms.ParDo
+import org.apache.beam.sdk.values.KV
+import org.apache.beam.sdk.values.PCollection
+import org.apache.beam.sdk.values.PDone
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+trait ANNOptions extends DateRangeOptions {
+ @Description("Output GCS path for the generated index")
+ def getOutputPath(): String
+ def setOutputPath(value: String): Unit
+
+ @Description("If set, the index is grouped")
+ @Default.Boolean(false)
+ def getGrouped: Boolean
+ def setGrouped(value: Boolean): Unit
+
+ @Description(
+ "If set, a segment will be registered for the provided DAL dataset module which will trigger " +
+ "DAL registration.")
+ @Default.Boolean(false)
+ def getEnableDalRegistration: Boolean
+ def setEnableDalRegistration(value: Boolean): Unit
+
+ @Description(
+ "Output GCS path for the generated index. The OutputPath should be of the format " +
+ "'gs://user.{{user_name}}.dp.gcp.twttr.net/subDir/outputDir' and OutputDALPath will be " +
+ "'subDir/outputDir' for this to work")
+ def getOutputDALPath: String
+ def setOutputDALPath(value: String): Unit
+
+ @Description("Get ANN index dataset name")
+ def getDatasetModuleName: String
+ def setDatasetModuleName(value: String): Unit
+
+ @Description("Get ANN index dataset owner role")
+ def getDatasetOwnerRole: String
+ def setDatasetOwnerRole(value: String): Unit
+
+ @Description("If set, index is written in