UNPKG

@sroussey/simsimd

Version:

Fastest SIMD-Accelerated Vector Similarity Functions for x86 and Arm

60 lines (59 loc) 2.87 kB
/** * @brief Computes the squared Euclidean distance between two vectors. * @param {Float32Array|Int8Array} a - The first vector. * @param {Float32Array|Int8Array} b - The second vector. * @returns {number} The squared Euclidean distance between vectors a and b. */ export declare const sqeuclidean: (a: Float32Array | Int8Array, b: Float32Array | Int8Array) => number; /** * @brief Computes the cosine distance between two vectors. * @param {Float32Array|Int8Array} a - The first vector. * @param {Float32Array|Int8Array} b - The second vector. * @returns {number} The cosine distance between vectors a and b. */ export declare const cosine: (a: Float32Array | Int8Array, b: Float32Array | Int8Array) => number; /** * @brief Computes the inner product of two vectors. * @param {Float32Array} a - The first vector. * @param {Float32Array} b - The second vector. * @returns {number} The inner product of vectors a and b. */ export declare const inner: (a: Float32Array, b: Float32Array) => number; /** * @brief Computes the bitwise Hamming distance between two vectors. * @param {Uint8Array} a - The first vector. * @param {Uint8Array} b - The second vector. * @returns {number} The Hamming distance between vectors a and b. */ export declare const hamming: (a: Uint8Array, b: Uint8Array) => number; /** * @brief Computes the bitwise Jaccard similarity coefficient between two vectors. * @param {Uint8Array} a - The first vector. * @param {Uint8Array} b - The second vector. * @returns {number} The Jaccard similarity coefficient between vectors a and b. */ export declare const jaccard: (a: Uint8Array, b: Uint8Array) => number; /** * @brief Computes the kullbackleibler similarity coefficient between two vectors. * @param {Float32Array} a - The first vector. * @param {Float32Array} b - The second vector. * @returns {number} The Jaccard similarity coefficient between vectors a and b. */ export declare const kullbackleibler: (a: Float32Array, b: Float32Array) => number; /** * @brief Computes the jensenshannon similarity coefficient between two vectors. * @param {Float32Array} a - The first vector. * @param {Float32Array} b - The second vector. * @returns {number} The Jaccard similarity coefficient between vectors a and b. */ export declare const jensenshannon: (a: Float32Array, b: Float32Array) => number; declare const _default: { sqeuclidean: (a: Float32Array | Int8Array, b: Float32Array | Int8Array) => number; cosine: (a: Float32Array | Int8Array, b: Float32Array | Int8Array) => number; inner: (a: Float32Array, b: Float32Array) => number; hamming: (a: Uint8Array, b: Uint8Array) => number; jaccard: (a: Uint8Array, b: Uint8Array) => number; kullbackleibler: (a: Float32Array, b: Float32Array) => number; jensenshannon: (a: Float32Array, b: Float32Array) => number; }; export default _default;