MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / vs_fill_sparse_random

Function vs_fill_sparse_random

src/store/store.c:12135–12143  ·  view source on GitHub ↗

Sparse-random-index fallback for tokens not present in the enriched table. */

Source from the content-addressed store, hash-verified

12133
12134/* Sparse-random-index fallback for tokens not present in the enriched table. */
12135static void vs_fill_sparse_random(const char *token, float *out) {
12136 uint64_t seed = XXH3_64bits(token, strlen(token));
12137 for (int i = 0; i < VS_SPARSE_NNZE; i++) {
12138 uint64_t h = XXH3_64bits_withSeed(&i, sizeof(i), seed + VS_RI_SEED);
12139 int pos = (int)(h % VS_VEC_DIM);
12140 float sign = (h & SKIP_ONE) ? CBM_STORE_UNIT_POS_F : -CBM_STORE_UNIT_POS_F;
12141 out[pos] += sign;
12142 }
12143}
12144
12145/* Clamp one float into the int8 representable range. */
12146static int8_t vs_clamp_int8(float v) {

Callers 1

vs_build_keyword_vectorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected