/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.12
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.intel.analytics.bigdl.friesian.serving.recall.faiss.swighnswlib;

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;
  }

  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 static void setPrecomputed_table_max_bytes(long value) {
    swigfaissJNI.IndexIVFPQ_precomputed_table_max_bytes_set(value);
  }

  public static long getPrecomputed_table_max_bytes() {
    return swigfaissJNI.IndexIVFPQ_precomputed_table_max_bytes_get();
  }

  public void setPrecomputed_table(FloatVector value) {
    swigfaissJNI.IndexIVFPQ_precomputed_table_set(swigCPtr, this, FloatVector.getCPtr(value), value);
  }

  public FloatVector getPrecomputed_table() {
    long cPtr = swigfaissJNI.IndexIVFPQ_precomputed_table_get(swigCPtr, this);
    return (cPtr == 0) ? null : new FloatVector(cPtr, false);
  }

  public IndexIVFPQ(Index quantizer, long d, long nlist, long M, long nbits_per_idx, MetricType metric) {
    this(swigfaissJNI.new_IndexIVFPQ__SWIG_0(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(getCPtr(quantizer), quantizer, d, nlist, M, nbits_per_idx), true);
  }

  public void add_with_ids(int n, SWIGTYPE_p_float x, SWIGTYPE_p_long xids) {
    swigfaissJNI.IndexIVFPQ_add_with_ids__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long.getCPtr(xids));
  }

  public void add_with_ids(int n, SWIGTYPE_p_float x) {
    swigfaissJNI.IndexIVFPQ_add_with_ids__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void encode_vectors(int n, SWIGTYPE_p_float x, SWIGTYPE_p_long 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.getCPtr(list_nos), SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
  }

  public void encode_vectors(int n, SWIGTYPE_p_float x, SWIGTYPE_p_long list_nos, SWIGTYPE_p_unsigned_char codes) {
    swigfaissJNI.IndexIVFPQ_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long.getCPtr(list_nos), SWIGTYPE_p_unsigned_char.getCPtr(codes));
  }

  public void sa_decode(int 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_o(int n, SWIGTYPE_p_float x, SWIGTYPE_p_long xids, SWIGTYPE_p_float residuals_2, SWIGTYPE_p_long precomputed_idx) {
    swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long.getCPtr(xids), SWIGTYPE_p_float.getCPtr(residuals_2), SWIGTYPE_p_long.getCPtr(precomputed_idx));
  }

  public void add_core_o(int n, SWIGTYPE_p_float x, SWIGTYPE_p_long xids, SWIGTYPE_p_float residuals_2) {
    swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long.getCPtr(xids), SWIGTYPE_p_float.getCPtr(residuals_2));
  }

  public void train_residual(int n, SWIGTYPE_p_float x) {
    swigfaissJNI.IndexIVFPQ_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void train_residual_o(int 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(int list_no, int offset, SWIGTYPE_p_float recons) {
    swigfaissJNI.IndexIVFPQ_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
  }

  public long find_duplicates(SWIGTYPE_p_long ids, SWIGTYPE_p_unsigned_long lims) {
    return swigfaissJNI.IndexIVFPQ_find_duplicates(swigCPtr, this, SWIGTYPE_p_long.getCPtr(ids), SWIGTYPE_p_unsigned_long.getCPtr(lims));
  }

  public void encode(int 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, SWIGTYPE_p_long 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.getCPtr(keys), SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes), compute_keys);
  }

  public void encode_multiple(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes) {
    swigfaissJNI.IndexIVFPQ_encode_multiple__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(keys), SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes));
  }

  public void decode_multiple(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_unsigned_char xcodes, SWIGTYPE_p_float x) {
    swigfaissJNI.IndexIVFPQ_decode_multiple(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(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);
  }

}
