Module org.elasticsearch.simdvec
Interface ESVectorUtilSupport
- All Known Implementing Classes:
DefaultESVectorUtilSupport,Native22ESVectorUtilSupport,PanamaESVectorUtilSupport
public interface ESVectorUtilSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortThe number of bits in bit-quantized query vectors -
Method Summary
Modifier and TypeMethodDescriptionvoidbFloat16ToFloat(byte[] bfBytes, int bfOffset, float[] floats, int floatOffset, int floatCount, ByteOrder byteOrder) Converts bfloat16s to floatsvoidcalculateOSQGridPoints(float[] target, int[] quantize, int points, float[] pts) floatcalculateOSQLoss(float[] target, float lowerInterval, float upperInterval, float step, float invStep, float norm2, float lambda, int[] quantize) voidcenterAndCalculateOSQStatsDp(byte[] target, byte[] centroid, float[] centered, float[] stats) voidcenterAndCalculateOSQStatsDp(float[] target, float[] centroid, float[] centered, float[] stats) voidcenterAndCalculateOSQStatsEuclidean(byte[] target, byte[] centroid, float[] centered, float[] stats) voidcenterAndCalculateOSQStatsEuclidean(float[] target, float[] centroid, float[] centered, float[] stats) intcodePointCount(org.apache.lucene.util.BytesRef bytesRef) booleancontains(byte[] value, int valueOffset, int valueLength, byte[] term, int termOffset, int termLength) floatcosine(byte[] a, byte[] b) Calculates the cosine of the given byte arrays.voidcosineBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances) floatdotProduct(byte[] a, byte[] b) Calculates the dot product of the given byte arrays.floatdotProduct(byte[] a, byte[] b, int offset, int length) Calculates the dot product over[offset, offset + length).floatdotProduct(float[] a, float[] b) Calculates the dot product of the given float arrays.floatdotProduct(float[] a, float[] b, int offset, int length) Calculates the dot product over[offset, offset + length).voiddotProductBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances) voiddotProductBulk(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances) voidfloatToBFloat16(float[] floats, int floatOffset, byte[] bfBytes, int bfOffset, int floatCount, ByteOrder byteOrder) Converts floats to bfloat16sintindexOf(byte[] bytes, int offset, int length, byte marker) voidinRangeBitmask(long[] values, long lowerValue, long upperValue, long[] matches) longipByteBinByte(byte[] q, byte[] d) Compute dot product betweenqanddintipByteBit(byte[] q, byte[] d) floatipFloatBit(float[] q, byte[] d) floatipFloatByte(float[] q, byte[] d) voidl2Normalize(byte[] v, int offset, int length) L2-normalizesv[offset:offset + length)in place using signed byte values as real components.voidl2Normalize(float[] v, int offset, int length) L2-normalizesv[offset:offset + length)in place.voidlinearCombination(float scaleOther, byte[] other, float[] dest) voidlinearCombination(float scaleOther, byte[] other, float scaleDest, float[] dest) voidlinearCombination(float scaleOther, float[] other, float[] dest) voidlinearCombination(float scaleOther, float[] other, float scaleDest, float[] dest) floatlogSumExpNQT(float[] vector) floatlogSumExpNQTDiff(float[] v1, float[] v2, float eps) floatmaxSimDotProduct(MultiBFloat16VectorsSource source, float[][] query, float[] scoresScratch) floatmaxSimDotProduct(MultiByteVectorsSource source, byte[][] query, float[] scoresScratch) floatmaxSimDotProduct(MultiFloatVectorsSource source, float[][] query, float[] scoresScratch) voidpackAsBinary(int[] vector, byte[] packed) voidpackDibit(int[] vector, byte[] packed) voidpackDibitQuad(int[] vector, byte[] packed) voidpow2DiffAndScaleNQT(float[] v1, float[] v2, float a, float eps, float[] result) intquantizeVectorWithIntervals(float[] vector, int[] quantize, float lowInterval, float upperInterval, byte bit) floatsoarDistance(byte[] v1, byte[] centroid, float[] originalResidual, float soarLambda, float rnorm) floatsoarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm) voidsoarDistanceBulk(byte[] v1, byte[] c0, byte[] c1, byte[] c2, byte[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances) voidsoarDistanceBulk(float[] v1, float[] c0, float[] c1, float[] c2, float[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances) floatsquareDistance(byte[] a, byte[] b) Returns the sum of squared differences of the two vectors.floatsquareDistance(byte[] a, byte[] b, int offset, int length) Returns the sum of squared differences of the two byte vectors over a sub-range.floatsquareDistance(float[] a, float[] b) Returns the sum of squared differences of the two vectors.floatsquareDistance(float[] a, float[] b, int offset, int length) Returns the sum of squared differences over[offset, offset + length).voidsquareDistanceBulk(byte[] query, int vectorOffset, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances, int length) voidsquareDistanceBulk(float[] query, int vectorOffset, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances, int length) voidtransposeHalfByte(int[] q, byte[] quantQueryByte)
-
Field Details
-
B_QUERY
static final short B_QUERYThe number of bits in bit-quantized query vectors- See Also:
-
-
Method Details
-
bFloat16ToFloat
void bFloat16ToFloat(byte[] bfBytes, int bfOffset, float[] floats, int floatOffset, int floatCount, ByteOrder byteOrder) Converts bfloat16s to floats -
floatToBFloat16
void floatToBFloat16(float[] floats, int floatOffset, byte[] bfBytes, int bfOffset, int floatCount, ByteOrder byteOrder) Converts floats to bfloat16s -
dotProduct
float dotProduct(float[] a, float[] b) Calculates the dot product of the given float arrays. -
dotProduct
float dotProduct(float[] a, float[] b, int offset, int length) Calculates the dot product over[offset, offset + length). -
l2Normalize
void l2Normalize(float[] v, int offset, int length) L2-normalizesv[offset:offset + length)in place. A zero prefix is a no-op. -
squareDistance
float squareDistance(float[] a, float[] b) Returns the sum of squared differences of the two vectors. -
squareDistance
float squareDistance(float[] a, float[] b, int offset, int length) Returns the sum of squared differences over[offset, offset + length). -
cosine
float cosine(byte[] a, byte[] b) Calculates the cosine of the given byte arrays. -
dotProduct
float dotProduct(byte[] a, byte[] b) Calculates the dot product of the given byte arrays. -
dotProduct
float dotProduct(byte[] a, byte[] b, int offset, int length) Calculates the dot product over[offset, offset + length). -
l2Normalize
void l2Normalize(byte[] v, int offset, int length) L2-normalizesv[offset:offset + length)in place using signed byte values as real components. -
squareDistance
float squareDistance(byte[] a, byte[] b) Returns the sum of squared differences of the two vectors. -
squareDistance
float squareDistance(byte[] a, byte[] b, int offset, int length) Returns the sum of squared differences of the two byte vectors over a sub-range. -
maxSimDotProduct
-
maxSimDotProduct
-
maxSimDotProduct
-
ipByteBinByte
long ipByteBinByte(byte[] q, byte[] d) Compute dot product betweenqandd- Parameters:
q- query vector,B_QUERY-bit quantized and striped (seeESVectorUtil.transposeHalfByte)d- data vector, 1-bit quantized
-
ipByteBit
int ipByteBit(byte[] q, byte[] d) -
ipFloatBit
float ipFloatBit(float[] q, byte[] d) -
ipFloatByte
float ipFloatByte(float[] q, byte[] d) -
calculateOSQLoss
float calculateOSQLoss(float[] target, float lowerInterval, float upperInterval, float step, float invStep, float norm2, float lambda, int[] quantize) -
calculateOSQGridPoints
void calculateOSQGridPoints(float[] target, int[] quantize, int points, float[] pts) -
centerAndCalculateOSQStatsEuclidean
void centerAndCalculateOSQStatsEuclidean(float[] target, float[] centroid, float[] centered, float[] stats) -
centerAndCalculateOSQStatsDp
void centerAndCalculateOSQStatsDp(float[] target, float[] centroid, float[] centered, float[] stats) -
centerAndCalculateOSQStatsEuclidean
void centerAndCalculateOSQStatsEuclidean(byte[] target, byte[] centroid, float[] centered, float[] stats) -
centerAndCalculateOSQStatsDp
void centerAndCalculateOSQStatsDp(byte[] target, byte[] centroid, float[] centered, float[] stats) -
soarDistance
float soarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm) -
soarDistance
float soarDistance(byte[] v1, byte[] centroid, float[] originalResidual, float soarLambda, float rnorm) -
quantizeVectorWithIntervals
int quantizeVectorWithIntervals(float[] vector, int[] quantize, float lowInterval, float upperInterval, byte bit) -
dotProductBulk
void dotProductBulk(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances) -
squareDistanceBulk
void squareDistanceBulk(float[] query, int vectorOffset, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances, int length) -
dotProductBulk
void dotProductBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances) -
cosineBulk
void cosineBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances) -
squareDistanceBulk
void squareDistanceBulk(byte[] query, int vectorOffset, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances, int length) -
soarDistanceBulk
void soarDistanceBulk(float[] v1, float[] c0, float[] c1, float[] c2, float[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances) -
soarDistanceBulk
void soarDistanceBulk(byte[] v1, byte[] c0, byte[] c1, byte[] c2, byte[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances) -
packAsBinary
void packAsBinary(int[] vector, byte[] packed) -
packDibit
void packDibit(int[] vector, byte[] packed) -
packDibitQuad
void packDibitQuad(int[] vector, byte[] packed) -
transposeHalfByte
void transposeHalfByte(int[] q, byte[] quantQueryByte) -
indexOf
int indexOf(byte[] bytes, int offset, int length, byte marker) -
codePointCount
int codePointCount(org.apache.lucene.util.BytesRef bytesRef) -
contains
boolean contains(byte[] value, int valueOffset, int valueLength, byte[] term, int termOffset, int termLength) -
inRangeBitmask
void inRangeBitmask(long[] values, long lowerValue, long upperValue, long[] matches) -
linearCombination
void linearCombination(float scaleOther, float[] other, float scaleDest, float[] dest) -
linearCombination
void linearCombination(float scaleOther, float[] other, float[] dest) -
linearCombination
void linearCombination(float scaleOther, byte[] other, float scaleDest, float[] dest) -
linearCombination
void linearCombination(float scaleOther, byte[] other, float[] dest) -
logSumExpNQT
float logSumExpNQT(float[] vector) -
logSumExpNQTDiff
float logSumExpNQTDiff(float[] v1, float[] v2, float eps) -
pow2DiffAndScaleNQT
void pow2DiffAndScaleNQT(float[] v1, float[] v2, float a, float eps, float[] result)
-