81 lines
3.0 KiB
Java
81 lines
3.0 KiB
Java
/* ----------------------------------------------------------------------------
|
|
* 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));
|
|
}
|
|
|
|
}
|