docs: remove stale distanceSQ8 JSDoc left by the SQ8 hook refactor

The native SQ8 distance hook renamed the original distanceSQ8 to distanceSQ8Js
and added a dispatcher in its place, but left the old function's doc block
orphaned above distanceSQ8Js (two consecutive comments, the first dangling).
Merge them into one accurate block on distanceSQ8Js with dash-notation params.
This commit is contained in:
David Snelling 2026-05-27 15:21:46 -07:00
parent 4b6f63ed67
commit 6099101336

View file

@ -96,31 +96,24 @@ export function dequantizeSQ8(quantized: Uint8Array, min: number, max: number):
} }
/** /**
* Compute approximate cosine distance between two SQ8-quantized vectors. * Reference JS implementation of {@link distanceSQ8}: approximate cosine distance
* between two SQ8-quantized vectors, operating directly on the uint8 arrays without
* full dequantization. Cosine distance is `1 - (A·B / (|A| · |B|))`; for quantized
* values `q_i` with codebook `(min, max)` the actual value is
* `min + q_i * (max - min) / 255`, and the dot product / norms are computed on the
* quantized values and rescaled by the codebook parameters.
* *
* Operates directly on uint8 arrays without full dequantization. * Exported so callers can explicitly restore the default after swapping in a native
* Uses integer arithmetic where possible for speed. * implementation, and so cross-language parity tests can compare native output
* against this baseline.
* *
* Cosine distance = 1 - (A.B / (|A| * |B|)) * @param a - First quantized vector.
* * @param aMin - First vector's codebook minimum.
* For quantized values q_i with codebook (min, max): * @param aMax - First vector's codebook maximum.
* actual_i = min + q_i * (max - min) / 255 * @param b - Second quantized vector.
* * @param bMin - Second vector's codebook minimum.
* The dot product and norms can be computed on quantized values * @param bMax - Second vector's codebook maximum.
* and scaled by the codebook parameters. * @returns Approximate cosine distance in [0, 2].
*
* @param a - First quantized vector
* @param aMin - First vector codebook minimum
* @param aMax - First vector codebook maximum
* @param b - Second quantized vector
* @param bMin - Second vector codebook minimum
* @param bMax - Second vector codebook maximum
* @returns Approximate cosine distance [0, 2]
*/
/**
* Reference JS implementation of {@link distanceSQ8}. Exported so callers can
* explicitly restore the default after swapping in a native implementation, and
* so cross-language parity tests can compare native output against this baseline.
*/ */
export function distanceSQ8Js( export function distanceSQ8Js(
a: Uint8Array, a: Uint8Array,