UNPKG

simsimd

Version:

Portable mixed-precision BLAS-like vector math library for x86 and ARM

75 lines (74 loc) 4.06 kB
/** * @brief Computes the inner distance of two vectors (same as dot product). * @param {Float64Array|Float32Array} a - The first vector. * @param {Float64Array|Float32Array} b - The second vector. * @returns {number} The inner distance of vectors a and b. */ export declare function inner(a: Float64Array | Float32Array, b: Float64Array | Float32Array): number; /** * @brief Computes the inner distance of two vectors (same as inner product). * @param {Float64Array|Float32Array} a - The first vector. * @param {Float64Array|Float32Array} b - The second vector. * @returns {number} The inner distance of vectors a and b. */ export declare function dot(a: Float64Array | Float32Array, b: Float64Array | Float32Array): number; /** * @brief Computes the squared Euclidean distance between two vectors. * @param {Float64Array|Float32Array|Int8Array|Uint8Array} a - The first vector. * @param {Float64Array|Float32Array|Int8Array|Uint8Array} b - The second vector. * @returns {number} The squared Euclidean distance between vectors a and b. */ export declare function sqeuclidean(a: Float64Array | Float32Array | Int8Array | Uint8Array, b: Float64Array | Float32Array | Int8Array | Uint8Array): number; /** * @brief Computes the L2 Euclidean distance between two vectors. * @param {Float64Array|Float32Array|Int8Array | Uint8Array} a - The first vector. * @param {Float64Array|Float32Array|Int8Array | Uint8Array} b - The second vector. * @returns {number} The L2 euclidean distance between vectors a and b. */ export declare function euclidean(a: Float64Array | Float32Array | Int8Array | Uint8Array, b: Float64Array | Float32Array | Int8Array | Uint8Array): number; /** * @brief Computes the cosine distance between two vectors. * @param {Float64Array|Float32Array|Int8Array} a - The first vector. * @param {Float64Array|Float32Array|Int8Array} b - The second vector. * @returns {number} The cosine distance between vectors a and b. */ export declare function cosine(a: Float64Array | Float32Array | Int8Array, b: Float64Array | Float32Array | Int8Array): 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 Kullback-Leibler divergence between two probability distributions. * @param {Float64Array|Float32Array} a - The first vector. * @param {Float64Array|Float32Array} b - The second vector. * @returns {number} The Jaccard similarity coefficient between vectors a and b. */ export declare const kullbackleibler: (a: Float64Array | Float32Array, b: Float64Array | Float32Array) => number; /** * @brief Computes the Jensen-Shannon distance between two probability distributions. * @param {Float64Array|Float32Array} a - The first probability distribution. * @param {Float64Array|Float32Array} b - The second probability distribution. * @returns {number} The Jensen-Shannon distance between distributions a and b. */ export declare const jensenshannon: (a: Float64Array | Float32Array, b: Float64Array | Float32Array) => number; declare const _default: { sqeuclidean: typeof sqeuclidean; euclidean: typeof euclidean; cosine: typeof cosine; inner: typeof inner; hamming: (a: Uint8Array, b: Uint8Array) => number; jaccard: (a: Uint8Array, b: Uint8Array) => number; kullbackleibler: (a: Float64Array | Float32Array, b: Float64Array | Float32Array) => number; jensenshannon: (a: Float64Array | Float32Array, b: Float64Array | Float32Array) => number; }; export default _default;