-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaf_addentry.c
46 lines (39 loc) · 971 Bytes
/
leaf_addentry.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "CommandLineInterface/CLIcore.h"
#include "clustering_defs.h"
#include "addvector_to_CF.h"
// log all debug trace points to file
#define DEBUGLOG
/**
* @brief Add entry to leaf
*
* @param ctree
* @param datavec
* @param ssqr
* @param lCFindex
* @return errno_t
*/
errno_t leaf_addentry(CLUSTERTREE *ctree,
double *datavec,
long double ssqr,
long lCFindex,
int *addOK)
{
DEBUG_TRACE_FSTART();
long cfi = lCFindex;
while(cfi != -1)
{
addvector_to_CF(ctree, datavec, ssqr, 1, cfi, addOK);
if(*addOK == 1)
{
ctree->CFarray[cfi].status |= CLUSTER_CF_STATUS_UPDATE;
// move upstream to propagate change
cfi = ctree->CFarray[cfi].parentindex;
}
else
{
cfi = -1;
}
}
DEBUG_TRACE_FEXIT();
return RETURN_SUCCESS;
}