/* ----------------------------------------------------------------------------
 * 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));
  }

}
