| 267 | /* ── Jaccard similarity ──────────────────────────────────────────── */ |
| 268 | |
| 269 | double cbm_minhash_jaccard(const cbm_minhash_t *a, const cbm_minhash_t *b) { |
| 270 | if (!a || !b) { |
| 271 | return 0.0; |
| 272 | } |
| 273 | int matching = 0; |
| 274 | for (int i = 0; i < CBM_MINHASH_K; i++) { |
| 275 | if (a->values[i] == b->values[i]) { |
| 276 | matching++; |
| 277 | } |
| 278 | } |
| 279 | return (double)matching / (double)CBM_MINHASH_K; |
| 280 | } |
| 281 | |
| 282 | /* ── Hex encoding/decoding ───────────────────────────────────────── */ |
| 283 |
no outgoing calls
no test coverage detected