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

Function cbm_sem_normalize

src/semantic/semantic.c:468–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468void cbm_sem_normalize(cbm_sem_vec_t *v) {
469 if (!v) {
470 return;
471 }
472 float mag = 0.0F;
473 for (int i = 0; i < CBM_SEM_DIM; i++) {
474 mag += v->v[i] * v->v[i];
475 }
476 mag = sqrtf(mag);
477 if (mag < CBM_SEM_DENOM_EPS) {
478 return;
479 }
480 float inv = CBM_SEM_UNIT_POS / mag;
481 for (int i = 0; i < CBM_SEM_DIM; i++) {
482 v->v[i] *= inv;
483 }
484}
485
486void cbm_sem_vec_add_scaled(cbm_sem_vec_t *dst, const cbm_sem_vec_t *src, float scale) {
487 if (!dst || !src) {

Callers 8

normalize_workerFunction · 0.85
blend_workerFunction · 0.85
cbm_sem_diffuseFunction · 0.85
build_api_vecFunction · 0.85
build_type_vecFunction · 0.85
build_deco_vecFunction · 0.85
vec_build_workerFunction · 0.85
test_semantic.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected