-
Notifications
You must be signed in to change notification settings - Fork 0
/
printCFtree.c
102 lines (85 loc) · 3.25 KB
/
printCFtree.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <math.h>
#include "CommandLineInterface/CLIcore.h"
#include "clustering_defs.h"
errno_t printCFtree(CLUSTERTREE *ctree)
{
DEBUG_TRACE_FSTART();
printf("\n\n");
for(int level = 0; level < 100; level++)
{
for(int CFindex = 0; CFindex < ctree->NBCF; CFindex++)
{
if((ctree->CFarray[CFindex].type != CLUSTER_CF_TYPE_UNUSED) &&
(ctree->CFarray[CFindex].level == level))
{
for(int l = 0; l < ctree->CFarray[CFindex].level; l++)
{
printf(" ");
}
if(ctree->CFarray[CFindex].status && CLUSTER_CF_STATUS_UPDATE)
{
printf("*");
}
else
{
printf(" ");
}
printf("[%3d] ", CFindex);
switch(ctree->CFarray[CFindex].type)
{
case CLUSTER_CF_TYPE_ROOT:
printf("ROOT");
break;
case CLUSTER_CF_TYPE_NODE:
printf("NODE");
break;
case CLUSTER_CF_TYPE_LEAF:
printf("LEAF");
break;
case CLUSTER_CF_TYPE_LEAFNODE:
printf("LFND");
break;
default:
printf("????");
}
printf(" N=%5ld", ctree->CFarray[CFindex].N);
printf(" %10.4g %10.4g",
(double) ctree->CFarray[CFindex].datassq,
(double) ctree->CFarray[CFindex].sum2);
printf(" R=%6.4f ",
sqrt(ctree->CFarray[CFindex].radius2) / ctree->T);
printf(" parent=%3ld", ctree->CFarray[CFindex].parentindex);
if(ctree->CFarray[CFindex].type == CLUSTER_CF_TYPE_NODE)
{
printf(" %3d children (", ctree->CFarray[CFindex].NBchild);
for(int chi = 0; chi < ctree->CFarray[CFindex].NBchild;
chi++)
{
printf(" %ld", ctree->CFarray[CFindex].childindex[chi]);
}
printf(")");
}
if(ctree->CFarray[CFindex].type == CLUSTER_CF_TYPE_LEAFNODE)
{
printf(" %3d leaves (", ctree->CFarray[CFindex].NBleaf);
for(int lfi = 0; lfi < ctree->CFarray[CFindex].NBleaf;
lfi++)
{
printf(" %ld", ctree->CFarray[CFindex].leafindex[lfi]);
}
printf(")");
}
printf("\n");
}
}
}
printf("Characteristic distance = %g\n", ctree->cdist);
printf("Minimum noise2 = %g\n", ctree->minnoise2);
printf("Distance count %lld\n", ctree->cdistcnt);
printf("Negative distance %lld (fraction = %f)\n",
ctree->cdistnegcnt,
1.0 * ctree->cdistnegcnt / ctree->cdistcnt);
printf("\n\n");
DEBUG_TRACE_FEXIT();
return RETURN_SUCCESS;
}