/** * cosine.ts — exact cosine similarity + full-corpus ranking. * * Stands in for Harper's HNSW approximate-nearest-neighbor index (see * README "Comparable to flair, with a caveat"): flair-bench has no HNSW * graph, so instead of an approximate top-K it scores EVERY corpus vector * against the query and sorts — the correct answer for a corpus this size * (251 records), and the reason the tool can claim exact recall numbers * rather than approximate ones. */ export declare function cosineSimilarity(a: readonly number[], b: readonly number[]): number; /** * 0-based rank of `targetIndex` within `corpusVectors` when sorted by * descending cosine similarity to `query`. Ties break on corpus `.index` * ascending (the total-order tail — not `.id`; this ranking never has one). * Input order of the scored array must not leak: the same corpus in two * permutations of equal-score rows ranks identically (flair#1412). * See README's "exact-vs-HNSW caveat" for what this does and doesn't * guarantee to reproduce of Harper's HNSW. */ export declare function rankOf(query: readonly number[], corpusVectors: readonly (readonly number[])[], targetIndex: number): number;