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

Function cbm_sem_normalize

src/semantic/semantic.c:470–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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