line |
true |
false |
branch |
56
|
7 |
2 |
for (i = 0; i < n; i++) result += x[i]; |
79
|
1 |
49 |
if (n==2*nr) even = 1; |
80
|
36 |
14 |
if (n<3) |
81
|
0 |
36 |
{ if (n<1) return 0.; |
82
|
36 |
0 |
if (n == 1) return x[0]; |
93
|
1 |
14 |
if (xhi
|
98
|
0 |
15 |
if (result>xhi) result = xhi; |
99
|
0 |
15 |
else if (result
|
106
|
14 |
16 |
{ while (x[i]
|
107
|
15 |
16 |
while (x[j]>result) j--; |
109
|
1 |
15 |
if (i
|
115
|
1 |
0 |
if (i<=j) loop = 1; |
117
|
1 |
15 |
} while (loop); /* Decide which half the median is in. */ |
119
|
2 |
13 |
if (even) |
120
|
1 |
1 |
{ if (j==nl && i==nr) |
|
0 |
1 |
{ if (j==nl && i==nr) |
128
|
0 |
0 |
for (k = lo; k <= j; k++) xmax = max(xmax,x[k]); |
|
0 |
0 |
for (k = lo; k <= j; k++) xmax = max(xmax,x[k]); |
129
|
0 |
0 |
for (k = i; k <= hi; k++) xmin = min(xmin,x[k]); |
|
0 |
0 |
for (k = i; k <= hi; k++) xmin = min(xmin,x[k]); |
132
|
0 |
2 |
if (j
|
133
|
0 |
2 |
if (i>nr) hi = j; |
134
|
2 |
0 |
if (i==j) |
135
|
1 |
1 |
{ if (i==nl) lo = nl; |
136
|
1 |
1 |
if (j==nr) hi = nr; |
140
|
0 |
13 |
{ if (j
|
141
|
0 |
13 |
if (i>nr) hi = j; |
143
|
13 |
0 |
if (i==j && i==nr) return result; |
|
13 |
0 |
if (i==j && i==nr) return result; |
146
|
1 |
1 |
while (lo
|
148
|
1 |
0 |
if (even) return (0.5*(x[nl]+x[nr])); |
149
|
0 |
0 |
if (x[lo]>x[hi]) |
172
|
0 |
0 |
if (term1 < term2) return -1; |
173
|
0 |
0 |
if (term1 > term2) return +1; |
186
|
0 |
0 |
for (i = 0; i < n; i++) index[i] = i; |
203
|
0 |
0 |
if (!rank) return NULL; |
205
|
0 |
0 |
if (!index) |
212
|
0 |
0 |
for (i = 0; i < n; i++) rank[index[i]] = i; |
215
|
0 |
0 |
while (i < n) |
219
|
0 |
0 |
while (j < n && data[index[j]] == value) j++; |
|
0 |
0 |
while (j < n && data[index[j]] == value) j++; |
222
|
0 |
0 |
for (j = i; j < i + m; j++) rank[index[j]] = value; |
237
|
0 |
5 |
if(!data) return 0; |
239
|
0 |
5 |
if(!mask) |
243
|
26 |
5 |
for (i = 0; i < nrows; i++) |
245
|
0 |
26 |
if(!data[i]) break; |
247
|
0 |
26 |
if(!mask[i]) |
252
|
5 |
0 |
if (i==nrows) /* break not encountered */ |
260
|
0 |
0 |
for (i = 0; i < nrows; i++) |
274
|
9 |
3 |
for (i = 0; i < n; i++) |
311
|
252 |
45 |
for (i = 1; i < n; i++) |
312
|
1122 |
252 |
{ for (j = 0; j < i; j++) |
314
|
72 |
1050 |
if (temp
|
399
|
0 |
0 |
if (!rv1) return -1; |
400
|
0 |
0 |
if (m >= n) |
402
|
0 |
0 |
for (i = 0; i < n; i++) |
408
|
0 |
0 |
for (k = i; k < m; k++) scale += fabs(u[k][i]); |
409
|
0 |
0 |
if (scale != 0.0) |
410
|
0 |
0 |
{ for (k = i; k < m; k++) |
415
|
0 |
0 |
g = (f >= 0) ? -sqrt(s) : sqrt(s); |
418
|
0 |
0 |
if (i < n-1) |
419
|
0 |
0 |
{ for (j = l; j < n; j++) |
421
|
0 |
0 |
for (k = i; k < m; k++) s += u[k][i] * u[k][j]; |
423
|
0 |
0 |
for (k = i; k < m; k++) u[k][j] += f * u[k][i]; |
426
|
0 |
0 |
for (k = i; k < m; k++) u[k][i] *= scale; |
432
|
0 |
0 |
if (i
|
433
|
0 |
0 |
{ for (k = l; k < n; k++) scale += fabs(u[i][k]); |
434
|
0 |
0 |
if (scale != 0.0) |
435
|
0 |
0 |
{ for (k = l; k < n; k++) |
440
|
0 |
0 |
g = (f >= 0) ? -sqrt(s) : sqrt(s); |
443
|
0 |
0 |
for (k = l; k < n; k++) rv1[k] = u[i][k] / h; |
444
|
0 |
0 |
for (j = l; j < m; j++) |
446
|
0 |
0 |
for (k = l; k < n; k++) s += u[j][k] * u[i][k]; |
447
|
0 |
0 |
for (k = l; k < n; k++) u[j][k] += s * rv1[k]; |
449
|
0 |
0 |
for (k = l; k < n; k++) u[i][k] *= scale; |
452
|
0 |
0 |
anorm = max(anorm,fabs(w[i])+fabs(rv1[i])); |
455
|
0 |
0 |
for (i = n-1; i>=0; i--) |
456
|
0 |
0 |
{ if (i < n-1) |
457
|
0 |
0 |
{ if (g != 0.0) |
458
|
0 |
0 |
{ for (j = l; j < n; j++) vt[i][j] = (u[i][j] / u[i][l]) / g; |
460
|
0 |
0 |
for (j = l; j < n; j++) |
462
|
0 |
0 |
for (k = l; k < n; k++) s += u[i][k] * vt[j][k]; |
463
|
0 |
0 |
for (k = l; k < n; k++) vt[j][k] += s * vt[i][k]; |
467
|
0 |
0 |
for (j = l; j < n; j++) |
476
|
0 |
0 |
for (i = n-1; i >= 0; i--) |
479
|
0 |
0 |
if (i!=n-1) |
480
|
0 |
0 |
for (j = l; j < n; j++) u[i][j] = 0.0; |
481
|
0 |
0 |
if (g!=0.0) |
482
|
0 |
0 |
{ if (i!=n-1) |
483
|
0 |
0 |
{ for (j = l; j < n; j++) |
485
|
0 |
0 |
for (k = l; k < m; k++) s += u[k][i] * u[k][j]; |
488
|
0 |
0 |
for (k = i; k < m; k++) u[k][j] += f * u[k][i]; |
491
|
0 |
0 |
for (j = i; j < m; j++) u[j][i] /= g; |
494
|
0 |
0 |
for (j = i; j < m; j++) u[j][i] = 0.0; |
498
|
0 |
0 |
for (k = n-1; k >= 0; k--) |
503
|
0 |
0 |
{ for (l = k; l >= 0; l--) |
505
|
0 |
0 |
if (fabs(rv1[l]) + anorm == anorm) break; |
508
|
0 |
0 |
if (fabs(w[l1]) + anorm == anorm) |
512
|
0 |
0 |
for (i = l; i <= k; i++) |
515
|
0 |
0 |
if (fabs(f) + anorm == anorm) break; |
521
|
0 |
0 |
for (j = 0; j < m; j++) |
533
|
0 |
0 |
if (l==k) /* convergence */ |
534
|
0 |
0 |
{ if (z < 0.0) |
537
|
0 |
0 |
for (j = 0; j < n; j++) vt[k][j] = -vt[k][j]; |
541
|
0 |
0 |
else if (its==30) |
554
|
0 |
0 |
f = ((x - z) * (x + z) + h * (y / (f + (f >= 0 ? g : -g)) - h)) / x; |
558
|
0 |
0 |
for (i1 = l; i1 <= k1; i1++) |
572
|
0 |
0 |
for (j = 0; j < n; j++) |
581
|
0 |
0 |
if (z!=0.0) |
587
|
0 |
0 |
for (j = 0; j < m; j++) |
603
|
0 |
0 |
for (i = 0; i < m; i++) |
609
|
0 |
0 |
for (k = i; k < n; k++) scale += fabs(u[i][k]); |
610
|
0 |
0 |
if (scale != 0.0) |
611
|
0 |
0 |
{ for (k = i; k < n; k++) |
616
|
0 |
0 |
g = (f >= 0) ? -sqrt(s) : sqrt(s); |
619
|
0 |
0 |
if (i < m-1) |
620
|
0 |
0 |
{ for (j = l; j < m; j++) |
622
|
0 |
0 |
for (k = i; k < n; k++) s += u[i][k] * u[j][k]; |
624
|
0 |
0 |
for (k = i; k < n; k++) u[j][k] += f * u[i][k]; |
627
|
0 |
0 |
for (k = i; k < n; k++) u[i][k] *= scale; |
633
|
0 |
0 |
if (i
|
634
|
0 |
0 |
{ for (k = l; k < m; k++) scale += fabs(u[k][i]); |
635
|
0 |
0 |
if (scale != 0.0) |
636
|
0 |
0 |
{ for (k = l; k < m; k++) |
641
|
0 |
0 |
g = (f >= 0) ? -sqrt(s) : sqrt(s); |
644
|
0 |
0 |
for (k = l; k < m; k++) rv1[k] = u[k][i] / h; |
645
|
0 |
0 |
for (j = l; j < n; j++) |
647
|
0 |
0 |
for (k = l; k < m; k++) s += u[k][j] * u[k][i]; |
648
|
0 |
0 |
for (k = l; k < m; k++) u[k][j] += s * rv1[k]; |
650
|
0 |
0 |
for (k = l; k < m; k++) u[k][i] *= scale; |
653
|
0 |
0 |
anorm = max(anorm,fabs(w[i])+fabs(rv1[i])); |
656
|
0 |
0 |
for (i = m-1; i>=0; i--) |
657
|
0 |
0 |
{ if (i < m-1) |
658
|
0 |
0 |
{ if (g != 0.0) |
659
|
0 |
0 |
{ for (j = l; j < m; j++) vt[j][i] = (u[j][i] / u[l][i]) / g; |
661
|
0 |
0 |
for (j = l; j < m; j++) |
663
|
0 |
0 |
for (k = l; k < m; k++) s += u[k][i] * vt[k][j]; |
664
|
0 |
0 |
for (k = l; k < m; k++) vt[k][j] += s * vt[k][i]; |
668
|
0 |
0 |
for (j = l; j < m; j++) |
677
|
0 |
0 |
for (i = m-1; i >= 0; i--) |
680
|
0 |
0 |
if (i!=m-1) |
681
|
0 |
0 |
for (j = l; j < m; j++) u[j][i] = 0.0; |
682
|
0 |
0 |
if (g!=0.0) |
683
|
0 |
0 |
{ if (i!=m-1) |
684
|
0 |
0 |
{ for (j = l; j < m; j++) |
686
|
0 |
0 |
for (k = l; k < n; k++) s += u[i][k] * u[j][k]; |
689
|
0 |
0 |
for (k = i; k < n; k++) u[j][k] += f * u[i][k]; |
692
|
0 |
0 |
for (j = i; j < n; j++) u[i][j] /= g; |
695
|
0 |
0 |
for (j = i; j < n; j++) u[i][j] = 0.0; |
699
|
0 |
0 |
for (k = m-1; k >= 0; k--) |
704
|
0 |
0 |
{ for (l = k; l >= 0; l--) |
706
|
0 |
0 |
if (fabs(rv1[l]) + anorm == anorm) break; |
709
|
0 |
0 |
if (fabs(w[l1]) + anorm == anorm) |
713
|
0 |
0 |
for (i = l; i <= k; i++) |
716
|
0 |
0 |
if (fabs(f) + anorm == anorm) break; |
722
|
0 |
0 |
for (j = 0; j < n; j++) |
734
|
0 |
0 |
if (l==k) /* convergence */ |
735
|
0 |
0 |
{ if (z < 0.0) |
738
|
0 |
0 |
for (j = 0; j < m; j++) vt[j][k] = -vt[j][k]; |
742
|
0 |
0 |
else if (its==30) |
755
|
0 |
0 |
f = ((x - z) * (x + z) + h * (y / (f + (f >= 0 ? g : -g)) - h)) / x; |
759
|
0 |
0 |
for (i1 = l; i1 <= k1; i1++) |
773
|
0 |
0 |
for (j = 0; j < m; j++) |
782
|
0 |
0 |
if (z!=0.0) |
788
|
0 |
0 |
for (j = 0; j < n; j++) |
872
|
0 |
0 |
if (!index || !temp) |
|
0 |
0 |
if (!index || !temp) |
873
|
0 |
0 |
{ if (index) free(index); |
874
|
0 |
0 |
if (temp) free(temp); |
878
|
0 |
0 |
if (error==0) |
880
|
0 |
0 |
if (nrows >= ncolumns) |
881
|
0 |
0 |
{ for (j = 0; j < ncolumns; j++) |
883
|
0 |
0 |
for (i = 0; i < nrows; i++) u[i][j] *= s; |
886
|
0 |
0 |
for (i = 0; i < ncolumns/2; i++) |
891
|
0 |
0 |
for (i = 0; i < nrows; i++) |
892
|
0 |
0 |
{ for (j = 0; j < ncolumns; j++) temp[j] = u[i][index[j]]; |
893
|
0 |
0 |
for (j = 0; j < ncolumns; j++) u[i][j] = temp[j]; |
895
|
0 |
0 |
for (i = 0; i < ncolumns; i++) |
896
|
0 |
0 |
{ for (j = 0; j < ncolumns; j++) temp[j] = v[index[j]][i]; |
897
|
0 |
0 |
for (j = 0; j < ncolumns; j++) v[j][i] = temp[j]; |
899
|
0 |
0 |
for (i = 0; i < ncolumns; i++) temp[i] = w[index[i]]; |
900
|
0 |
0 |
for (i = 0; i < ncolumns; i++) w[i] = temp[i]; |
903
|
0 |
0 |
{ for (j = 0; j < nrows; j++) |
905
|
0 |
0 |
for (i = 0; i < nrows; i++) v[i][j] *= s; |
908
|
0 |
0 |
for (i = 0; i < nrows/2; i++) |
913
|
0 |
0 |
for (j = 0; j < ncolumns; j++) |
914
|
0 |
0 |
{ for (i = 0; i < nrows; i++) temp[i] = u[index[i]][j]; |
915
|
0 |
0 |
for (i = 0; i < nrows; i++) u[i][j] = temp[i]; |
917
|
0 |
0 |
for (j = 0; j < nrows; j++) |
918
|
0 |
0 |
{ for (i = 0; i < nrows; i++) temp[i] = v[j][index[i]]; |
919
|
0 |
0 |
for (i = 0; i < nrows; i++) v[j][i] = temp[i]; |
921
|
0 |
0 |
for (i = 0; i < nrows; i++) temp[i] = w[index[i]]; |
922
|
0 |
0 |
for (i = 0; i < nrows; i++) w[i] = temp[i]; |
982
|
36704 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
983
|
108538 |
36704 |
{ for (i = 0; i < n; i++) |
984
|
108538 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
108538 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
992
|
0 |
0 |
{ for (i = 0; i < n; i++) |
993
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1000
|
0 |
36704 |
if (!tweight) return 0; /* usually due to empty clusters */ |
1058
|
64 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
1059
|
192 |
64 |
{ for (i = 0; i < n; i++) |
1060
|
192 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
192 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1068
|
0 |
0 |
{ for (i = 0; i < n; i++) |
1069
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1076
|
0 |
64 |
if (!tweight) return 0; /* usually due to empty clusters */ |
1138
|
0 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
1140
|
0 |
0 |
for (i = 0; i < n; i++) |
1141
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1156
|
0 |
0 |
for (i = 0; i < n; i++) |
1157
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1170
|
0 |
0 |
if (!tweight) return 0; /* usually due to empty clusters */ |
1174
|
0 |
0 |
if (denom1 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1175
|
0 |
0 |
if (denom2 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1237
|
0 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
1239
|
0 |
0 |
for (i = 0; i < n; i++) |
1240
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1255
|
0 |
0 |
for (i = 0; i < n; i++) |
1256
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1269
|
0 |
0 |
if (!tweight) return 0; /* usually due to empty clusters */ |
1273
|
0 |
0 |
if (denom1 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1274
|
0 |
0 |
if (denom2 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1339
|
0 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
1341
|
0 |
0 |
for (i = 0; i < n; i++) |
1342
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1355
|
0 |
0 |
for (i = 0; i < n; i++) |
1356
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1367
|
0 |
0 |
if (!flag) return 0.; |
1368
|
0 |
0 |
if (denom1==0.) return 1.; |
1369
|
0 |
0 |
if (denom2==0.) return 1.; |
1434
|
0 |
0 |
if (transpose==0) /* Calculate the distance between two rows */ |
1436
|
0 |
0 |
for (i = 0; i < n; i++) |
1437
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1450
|
0 |
0 |
for (i = 0; i < n; i++) |
1451
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1462
|
0 |
0 |
if (!flag) return 0.; |
1463
|
0 |
0 |
if (denom1==0.) return 1.; |
1464
|
0 |
0 |
if (denom2==0.) return 1.; |
1530
|
0 |
0 |
if(!tdata1) return 0.0; /* Memory allocation error */ |
1532
|
0 |
0 |
if(!tdata2) /* Memory allocation error */ |
1536
|
0 |
0 |
if (transpose==0) |
1537
|
0 |
0 |
{ for (i = 0; i < n; i++) |
1538
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1546
|
0 |
0 |
{ for (i = 0; i < n; i++) |
1547
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1554
|
0 |
0 |
if (m==0) |
1561
|
0 |
0 |
if(!rank1) |
1567
|
0 |
0 |
if(!rank2) /* Memory allocation error */ |
1572
|
0 |
0 |
for (i = 0; i < m; i++) |
1591
|
0 |
0 |
if (denom1 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1592
|
0 |
0 |
if (denom2 <= 0) return 1; /* include '<' to deal with roundoff errors */ |
1658
|
0 |
0 |
if (transpose==0) |
1659
|
0 |
0 |
{ for (i = 0; i < n; i++) |
1660
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
|
0 |
0 |
{ if (mask1[index1][i] && mask2[index2][i]) |
1661
|
0 |
0 |
{ for (j = 0; j < i; j++) |
1662
|
0 |
0 |
{ if (mask1[index1][j] && mask2[index2][j]) |
|
0 |
0 |
{ if (mask1[index1][j] && mask2[index2][j]) |
1667
|
0 |
0 |
if (x1 < x2 && y1 < y2) con++; |
|
0 |
0 |
if (x1 < x2 && y1 < y2) con++; |
1668
|
0 |
0 |
if (x1 > x2 && y1 > y2) con++; |
|
0 |
0 |
if (x1 > x2 && y1 > y2) con++; |
1669
|
0 |
0 |
if (x1 < x2 && y1 > y2) dis++; |
|
0 |
0 |
if (x1 < x2 && y1 > y2) dis++; |
1670
|
0 |
0 |
if (x1 > x2 && y1 < y2) dis++; |
|
0 |
0 |
if (x1 > x2 && y1 < y2) dis++; |
1671
|
0 |
0 |
if (x1 == x2 && y1 != y2) exx++; |
|
0 |
0 |
if (x1 == x2 && y1 != y2) exx++; |
1672
|
0 |
0 |
if (x1 != x2 && y1 == y2) exy++; |
|
0 |
0 |
if (x1 != x2 && y1 == y2) exy++; |
1680
|
0 |
0 |
{ for (i = 0; i < n; i++) |
1681
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
|
0 |
0 |
{ if (mask1[i][index1] && mask2[i][index2]) |
1682
|
0 |
0 |
{ for (j = 0; j < i; j++) |
1683
|
0 |
0 |
{ if (mask1[j][index1] && mask2[j][index2]) |
|
0 |
0 |
{ if (mask1[j][index1] && mask2[j][index2]) |
1688
|
0 |
0 |
if (x1 < x2 && y1 < y2) con++; |
|
0 |
0 |
if (x1 < x2 && y1 < y2) con++; |
1689
|
0 |
0 |
if (x1 > x2 && y1 > y2) con++; |
|
0 |
0 |
if (x1 > x2 && y1 > y2) con++; |
1690
|
0 |
0 |
if (x1 < x2 && y1 > y2) dis++; |
|
0 |
0 |
if (x1 < x2 && y1 > y2) dis++; |
1691
|
0 |
0 |
if (x1 > x2 && y1 < y2) dis++; |
|
0 |
0 |
if (x1 > x2 && y1 < y2) dis++; |
1692
|
0 |
0 |
if (x1 == x2 && y1 != y2) exx++; |
|
0 |
0 |
if (x1 == x2 && y1 != y2) exx++; |
1693
|
0 |
0 |
if (x1 != x2 && y1 == y2) exy++; |
|
0 |
0 |
if (x1 != x2 && y1 == y2) exy++; |
1700
|
0 |
0 |
if (!flag) return 0.; |
1703
|
0 |
0 |
if (denomx==0) return 1; |
1704
|
0 |
0 |
if (denomy==0) return 1; |
1768
|
4314 |
3 |
if (s1==0 || s2==0) /* initialize */ |
|
0 |
4314 |
if (s1==0 || s2==0) /* initialize */ |
1779
|
467 |
3850 |
if (s1 < 0) s1+=m1; |
1782
|
180 |
4137 |
if(s2 < 0) s2+=m2; |
1784
|
2156 |
2161 |
if(z < 1) z+=(m1-1); |
1785
|
0 |
4317 |
} while (z==m1); /* To avoid returning 1.0 */ |
1825
|
700 |
0 |
if (n*p < 30.0) /* Algorithm BINV */ |
1832
|
700 |
1302 |
{ if (u < r) return x; |
1861
|
0 |
0 |
if (u <= p1) return (int)(xm-p1*v+u); |
1863
|
0 |
0 |
if (u > p2) |
1865
|
0 |
0 |
if (u > p3) |
1868
|
0 |
0 |
if (y > n) continue; |
1874
|
0 |
0 |
if (y < 0) continue; |
1882
|
0 |
0 |
if (v > 1) continue; |
1889
|
0 |
0 |
if (k > 20 && k < 0.5*n*p*q-1.0) |
|
0 |
0 |
if (k > 20 && k < 0.5*n*p*q-1.0) |
1894
|
0 |
0 |
if (A < t-rho) return y; |
1895
|
0 |
0 |
else if (A > t+rho) continue; |
1906
|
0 |
0 |
if (A > xm * log(f1/x1) + (n-m+0.5)*log(z/w) |
1922
|
0 |
0 |
for (i = m; i < y; f *= (aa/(++i)-s)); |
1923
|
0 |
0 |
for (i = y; i < m; f /= (aa/(++i)-s)); |
1924
|
0 |
0 |
if (v > f) continue; |
1969
|
700 |
300 |
for (i = 0; i < nclusters-1; i++) |
1974
|
2002 |
700 |
for ( ; k < j; k++) clusterid[k] = i; |
1977
|
898 |
300 |
for ( ; k < nelements; k++) clusterid[k] = i; |
1980
|
2900 |
300 |
for (i = 0; i < nelements; i++) |
2047
|
555 |
0 |
if (transpose==0) |
2048
|
1665 |
555 |
{ for (i = 0; i < nclusters; i++) |
2049
|
5148 |
1665 |
{ for (j = 0; j < ncolumns; j++) |
2054
|
5397 |
555 |
for (k = 0; k < nrows; k++) |
2056
|
13218 |
5397 |
for (j = 0; j < ncolumns; j++) |
2057
|
13218 |
0 |
{ if (mask[k][j] != 0) |
2063
|
1665 |
555 |
for (i = 0; i < nclusters; i++) |
2064
|
5148 |
1665 |
{ for (j = 0; j < ncolumns; j++) |
2065
|
5148 |
0 |
{ if (cmask[i][j]>0) |
2073
|
0 |
0 |
{ for (i = 0; i < nrows; i++) |
2074
|
0 |
0 |
{ for (j = 0; j < nclusters; j++) |
2079
|
0 |
0 |
for (k = 0; k < ncolumns; k++) |
2081
|
0 |
0 |
for (j = 0; j < nrows; j++) |
2082
|
0 |
0 |
{ if (mask[j][k] != 0) |
2088
|
0 |
0 |
for (i = 0; i < nrows; i++) |
2089
|
0 |
0 |
{ for (j = 0; j < nclusters; j++) |
2090
|
0 |
0 |
{ if (cmask[i][j]>0) |
2163
|
0 |
0 |
if (transpose==0) |
2164
|
0 |
0 |
{ for (i = 0; i < nclusters; i++) |
2165
|
0 |
0 |
{ for (j = 0; j < ncolumns; j++) |
2167
|
0 |
0 |
for (k = 0; k < nrows; k++) |
2168
|
0 |
0 |
{ if (i==clusterid[k] && mask[k][j]) |
|
0 |
0 |
{ if (i==clusterid[k] && mask[k][j]) |
2173
|
0 |
0 |
if (count>0) |
2185
|
0 |
0 |
{ for (i = 0; i < nclusters; i++) |
2186
|
0 |
0 |
{ for (j = 0; j < nrows; j++) |
2188
|
0 |
0 |
for (k = 0; k < ncolumns; k++) |
2189
|
0 |
0 |
{ if (i==clusterid[k] && mask[j][k]) |
|
0 |
0 |
{ if (i==clusterid[k] && mask[j][k]) |
2194
|
0 |
0 |
if (count>0) |
2278
|
0 |
0 |
{ const int nelements = (transpose==0) ? nrows : ncolumns; |
2280
|
0 |
0 |
if (!cache) return 0; |
2335
|
1372 |
343 |
for (j = 0; j < nclusters; j++) errors[j] = DBL_MAX; |
2336
|
4116 |
343 |
for (i = 0; i < nelements; i++) |
2339
|
43863 |
2516 |
for (k = 0; k < nelements; k++) |
2340
|
40506 |
3357 |
{ if (i==k || clusterid[k]!=j) continue; |
|
31013 |
9493 |
{ if (i==k || clusterid[k]!=j) continue; |
2341
|
4810 |
4683 |
d += (i < k ? distance[k][i] : distance[i][k]); |
2342
|
1600 |
7893 |
if (d > errors[j]) break; |
2344
|
2195 |
1921 |
if (d < errors[j]) |
2359
|
3 |
0 |
const int nelements = (transpose==0) ? nrows : ncolumns; |
2360
|
3 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
2370
|
0 |
3 |
if (saved==NULL) return -1; |
2380
|
200 |
1 |
if (npass!=0) randomassign (nclusters, nelements, tclusterid); |
2382
|
603 |
201 |
for (i = 0; i < nclusters; i++) counts[i] = 0; |
2383
|
1713 |
201 |
for (i = 0; i < nelements; i++) counts[tclusterid[i]]++; |
2390
|
201 |
354 |
if (counter % period == 0) /* Save the current cluster assignments */ |
2391
|
1713 |
201 |
{ for (i = 0; i < nelements; i++) saved[i] = tclusterid[i]; |
2392
|
201 |
0 |
if (period < INT_MAX / 2) period *= 2; |
2400
|
5397 |
555 |
for (i = 0; i < nelements; i++) |
2404
|
607 |
4790 |
if (counts[k]==1) continue; |
2408
|
14370 |
4790 |
for (j = 0; j < nclusters; j++) |
2410
|
4790 |
9580 |
if (j==k) continue; |
2412
|
932 |
8648 |
if (tdistance < distance) |
2421
|
152 |
403 |
if (total>=previous) break; |
2424
|
889 |
49 |
for (i = 0; i < nelements; i++) |
2425
|
354 |
535 |
if (saved[i]!=tclusterid[i]) break; |
2426
|
49 |
354 |
if (i==nelements) |
2430
|
1 |
200 |
if (npass<=1) |
2435
|
600 |
200 |
for (i = 0; i < nclusters; i++) mapping[i] = -1; |
2436
|
1544 |
118 |
for (i = 0; i < nelements; i++) |
2439
|
545 |
999 |
if (mapping[k] == -1) mapping[k] = j; |
2440
|
82 |
917 |
else if (mapping[k] != j) |
2441
|
2 |
80 |
{ if (total < *error) |
2444
|
17 |
2 |
for (j = 0; j < nelements; j++) clusterid[j] = tclusterid[j]; |
2449
|
118 |
82 |
if (i==nelements) ifound++; /* break statement not encountered */ |
2450
|
198 |
2 |
} while (++ipass < npass); |
2464
|
0 |
0 |
const int nelements = (transpose==0) ? nrows : ncolumns; |
2465
|
0 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
2475
|
0 |
0 |
if (saved==NULL) return -1; |
2485
|
0 |
0 |
if (npass!=0) randomassign (nclusters, nelements, tclusterid); |
2487
|
0 |
0 |
for (i = 0; i < nclusters; i++) counts[i]=0; |
2488
|
0 |
0 |
for (i = 0; i < nelements; i++) counts[tclusterid[i]]++; |
2495
|
0 |
0 |
if (counter % period == 0) /* Save the current cluster assignments */ |
2496
|
0 |
0 |
{ for (i = 0; i < nelements; i++) saved[i] = tclusterid[i]; |
2497
|
0 |
0 |
if (period < INT_MAX / 2) period *= 2; |
2505
|
0 |
0 |
for (i = 0; i < nelements; i++) |
2509
|
0 |
0 |
if (counts[k]==1) continue; |
2513
|
0 |
0 |
for (j = 0; j < nclusters; j++) |
2515
|
0 |
0 |
if (j==k) continue; |
2517
|
0 |
0 |
if (tdistance < distance) |
2526
|
0 |
0 |
if (total>=previous) break; |
2529
|
0 |
0 |
for (i = 0; i < nelements; i++) |
2530
|
0 |
0 |
if (saved[i]!=tclusterid[i]) break; |
2531
|
0 |
0 |
if (i==nelements) |
2535
|
0 |
0 |
if (npass<=1) |
2540
|
0 |
0 |
for (i = 0; i < nclusters; i++) mapping[i] = -1; |
2541
|
0 |
0 |
for (i = 0; i < nelements; i++) |
2544
|
0 |
0 |
if (mapping[k] == -1) mapping[k] = j; |
2545
|
0 |
0 |
else if (mapping[k] != j) |
2546
|
0 |
0 |
{ if (total < *error) |
2549
|
0 |
0 |
for (j = 0; j < nelements; j++) clusterid[j] = tclusterid[j]; |
2554
|
0 |
0 |
if (i==nelements) ifound++; /* break statement not encountered */ |
2555
|
0 |
0 |
} while (++ipass < npass); |
2648
|
3 |
0 |
{ const int nelements = (transpose==0) ? nrows : ncolumns; |
2649
|
3 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
2659
|
0 |
3 |
if (nelements < nclusters) |
2670
|
0 |
3 |
if(!counts) return; |
2673
|
1 |
2 |
if (npass<=1) tclusterid = clusterid; |
2676
|
0 |
2 |
if (!tclusterid) |
2681
|
0 |
2 |
if (!mapping) |
2686
|
17 |
2 |
for (i = 0; i < nelements; i++) clusterid[i] = 0; |
2690
|
3 |
0 |
if (transpose==0) ok = makedatamask(nclusters, ndata, &cdata, &cmask); |
2692
|
0 |
3 |
if(!ok) |
2694
|
0 |
0 |
if(npass>1) |
2701
|
0 |
3 |
if (method=='m') |
2703
|
0 |
0 |
if(cache) |
2716
|
2 |
1 |
if (npass > 1) |
2721
|
3 |
0 |
if (transpose==0) freedatamask(nclusters, cdata, cmask); |
2793
|
0 |
2 |
if (nelements < nclusters) |
2802
|
0 |
2 |
if (saved==NULL) return; |
2805
|
0 |
2 |
if(!centroids) |
2811
|
0 |
2 |
if(!errors) |
2818
|
1 |
1 |
if (npass<=1) tclusterid = clusterid; |
2821
|
0 |
1 |
if(!tclusterid) |
2827
|
12 |
1 |
for (i = 0; i < nelements; i++) clusterid[i] = -1; |
2836
|
100 |
1 |
if (npass!=0) randomassign(nclusters, nelements, tclusterid); |
2841
|
101 |
242 |
if (counter % period == 0) /* Save the current cluster assignments */ |
2842
|
1212 |
101 |
{ for (i = 0; i < nelements; i++) saved[i] = tclusterid[i]; |
2843
|
101 |
0 |
if (period < INT_MAX / 2) period *= 2; |
2851
|
4116 |
343 |
for (i = 0; i < nelements; i++) |
2854
|
14406 |
2744 |
for (icluster = 0; icluster < nclusters; icluster++) |
2857
|
1372 |
13034 |
if (i==j) |
2862
|
7333 |
5701 |
tdistance = (i > j) ? distmatrix[i][j] : distmatrix[j][i]; |
2863
|
7078 |
5956 |
if (tdistance < distance) |
2870
|
101 |
242 |
if (total>=previous) break; |
2873
|
558 |
0 |
for (i = 0; i < nelements; i++) |
2874
|
242 |
316 |
if (saved[i]!=tclusterid[i]) break; |
2875
|
0 |
242 |
if (i==nelements) |
2879
|
1 |
100 |
if (npass <= 1) { |
2883
|
12 |
1 |
for (j = 0; j < nelements; j++) { |
2889
|
438 |
15 |
for (i = 0; i < nelements; i++) |
2890
|
85 |
353 |
{ if (clusterid[i]!=centroids[tclusterid[i]]) |
2891
|
1 |
84 |
{ if (total < *error) |
2895
|
12 |
1 |
for (j = 0; j < nelements; j++) { |
2902
|
15 |
85 |
if (i==nelements) (*ifound)++; /* break statement not encountered */ |
2903
|
99 |
1 |
} while (++ipass < npass); |
2906
|
1 |
1 |
if (npass > 1) free(tclusterid); |
2981
|
7 |
0 |
const int n = (transpose==0) ? nrows : ncolumns; |
2982
|
7 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
2991
|
0 |
7 |
if (n < 2) return NULL; |
2995
|
0 |
7 |
if(matrix==NULL) return NULL; /* Not enough memory available */ |
2998
|
48 |
7 |
for (i = 1; i < n; i++) |
3000
|
0 |
48 |
if (matrix[i]==NULL) break; /* Not enough memory available */ |
3002
|
0 |
7 |
if (i < n) /* break condition encountered */ |
3004
|
0 |
0 |
for (i = 1; i < j; i++) free(matrix[i]); |
3009
|
48 |
7 |
for (i = 1; i < n; i++) |
3010
|
258 |
48 |
for (j = 0; j < i; j++) |
3089
|
0 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
3090
|
0 |
0 |
const int nelements = (transpose==0) ? nrows : ncolumns; |
3098
|
0 |
0 |
if (!result) return NULL; |
3101
|
0 |
0 |
for (i = 0; i < nelements; i++) |
3103
|
0 |
0 |
for (j = 0; j < i; j++) |
3106
|
0 |
0 |
if (distance < cutoff) |
3114
|
0 |
0 |
for (i = 0; i < nelements; i++) result[i] = 1.0/result[i]; |
3160
|
0 |
0 |
if (nclusters==1) { |
3161
|
0 |
0 |
for (i = 0; i < nelements; i++) clusterid[i] = 0; |
3165
|
0 |
0 |
if (!parents) |
3166
|
0 |
0 |
{ for (i = 0; i < nelements; i++) clusterid[i] = -1; |
3170
|
0 |
0 |
if (i >= 0) { |
3178
|
0 |
0 |
if (previous == tree[j].left) { |
3181
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
3183
|
0 |
0 |
else if (previous == tree[j].right) { |
3186
|
0 |
0 |
if (i==nelements) break; |
3192
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
|
0 |
0 |
if (j >= n && (i >= 0 || -i-1 < n)) k++; |
3270
|
2 |
0 |
const int nelements = (transpose==0) ? nrows : ncolumns; |
3272
|
0 |
2 |
const int ndata = transpose ? nrows : ncolumns; |
3284
|
0 |
2 |
if(!distid) return NULL; |
3286
|
0 |
2 |
if(!result) |
3290
|
0 |
2 |
if(!makedatamask(nelements, ndata, &newdata, &newmask)) |
3296
|
17 |
2 |
for (i = 0; i < nelements; i++) distid[i] = i; |
3300
|
0 |
2 |
if (transpose) |
3301
|
0 |
0 |
{ for (i = 0; i < nelements; i++) |
3302
|
0 |
0 |
{ for (j = 0; j < ndata; j++) |
3311
|
17 |
2 |
{ for (i = 0; i < nelements; i++) |
3319
|
15 |
2 |
for (inode = 0; inode < nnodes; inode++) |
3328
|
39 |
15 |
for (i = 0; i < ndata; i++) |
3331
|
39 |
0 |
if (mask[js][i]) data[js][i] /= mask[js][i]; |
3340
|
55 |
15 |
for (i = 0; i < is; i++) |
3342
|
20 |
15 |
for (i = is + 1; i < nnodes-inode; i++) |
3346
|
24 |
15 |
for (i = 0; i < js; i++) |
3348
|
45 |
15 |
for (i = js + 1; i < nnodes-inode; i++) |
3371
|
17 |
14 |
if (term1 < term2) return -1; |
3372
|
14 |
0 |
if (term1 > term2) return +1; |
3462
|
0 |
2 |
const int nelements = transpose ? ncolumns : nrows; |
3469
|
0 |
2 |
if(!temp) return NULL; |
3471
|
0 |
2 |
if(!index) |
3476
|
0 |
2 |
if(!vector) |
3482
|
0 |
2 |
if(!result) |
3489
|
15 |
2 |
for (i = 0; i < nnodes; i++) vector[i] = i; |
3491
|
0 |
2 |
if(distmatrix) |
3492
|
0 |
0 |
{ for (i = 0; i < nrows; i++) |
3494
|
0 |
0 |
for (j = 0; j < i; j++) temp[j] = distmatrix[i][j]; |
3495
|
0 |
0 |
for (j = 0; j < i; j++) |
3497
|
0 |
0 |
if (result[j].distance >= temp[j]) |
3498
|
0 |
0 |
{ if (result[j].distance < temp[k]) temp[k] = result[j].distance; |
3502
|
0 |
0 |
else if (temp[j] < temp[k]) temp[k] = temp[j]; |
3504
|
0 |
0 |
for (j = 0; j < i; j++) |
3506
|
0 |
0 |
if (result[j].distance >= result[vector[j]].distance) vector[j] = i; |
3511
|
0 |
2 |
{ const int ndata = transpose ? nrows : ncolumns; |
3517
|
17 |
2 |
for (i = 0; i < nelements; i++) |
3519
|
84 |
17 |
for (j = 0; j < i; j++) temp[j] = |
3521
|
84 |
17 |
for (j = 0; j < i; j++) |
3523
|
25 |
59 |
if (result[j].distance >= temp[j]) |
3524
|
3 |
22 |
{ if (result[j].distance < temp[k]) temp[k] = result[j].distance; |
3528
|
10 |
49 |
else if (temp[j] < temp[k]) temp[k] = temp[j]; |
3530
|
84 |
17 |
for (j = 0; j < i; j++) |
3531
|
11 |
73 |
if (result[j].distance >= result[vector[j]].distance) vector[j] = i; |
3536
|
15 |
2 |
for (i = 0; i < nnodes; i++) result[i].left = i; |
3539
|
17 |
2 |
for (i = 0; i < nelements; i++) index[i] = i; |
3540
|
15 |
2 |
for (i = 0; i < nnodes; i++) |
3593
|
0 |
2 |
if(!clusterid) return NULL; |
3595
|
0 |
2 |
if (!result) |
3601
|
17 |
2 |
for (j = 0; j < nelements; j++) clusterid[j] = j; |
3603
|
15 |
2 |
for (n = nelements; n > 1; n--) |
3609
|
22 |
15 |
for (j = 0; j < js; j++) |
3610
|
8 |
14 |
distmatrix[js][j] = max(distmatrix[is][j],distmatrix[js][j]); |
3611
|
13 |
15 |
for (j = js+1; j < is; j++) |
3612
|
4 |
9 |
distmatrix[j][js] = max(distmatrix[is][j],distmatrix[j][js]); |
3613
|
34 |
15 |
for (j = is+1; j < n; j++) |
3614
|
11 |
23 |
distmatrix[j][js] = max(distmatrix[j][is],distmatrix[j][js]); |
3616
|
50 |
15 |
for (j = 0; j < is; j++) distmatrix[is][j] = distmatrix[n-1][j]; |
3617
|
24 |
15 |
for (j = is+1; j < n-1; j++) distmatrix[j][is] = distmatrix[n-1][j]; |
3669
|
0 |
2 |
if(!clusterid) return NULL; |
3671
|
0 |
2 |
if(!number) |
3676
|
0 |
2 |
if (!result) |
3685
|
17 |
2 |
for (j = 0; j < nelements; j++) |
3690
|
15 |
2 |
for (n = nelements; n > 1; n--) |
3702
|
24 |
15 |
for (j = 0; j < js; j++) |
3707
|
16 |
15 |
for (j = js+1; j < is; j++) |
3712
|
29 |
15 |
for (j = is+1; j < n; j++) |
3718
|
55 |
15 |
for (j = 0; j < is; j++) distmatrix[is][j] = distmatrix[n-1][j]; |
3719
|
20 |
15 |
for (j = is+1; j < n-1; j++) distmatrix[j][is] = distmatrix[n-1][j]; |
3818
|
8 |
0 |
const int nelements = (transpose==0) ? nrows : ncolumns; |
3819
|
8 |
0 |
const int ldistmatrix = (distmatrix==NULL && method!='s') ? 1 : 0; |
|
6 |
2 |
const int ldistmatrix = (distmatrix==NULL && method!='s') ? 1 : 0; |
3821
|
0 |
8 |
if (nelements < 2) return NULL; |
3824
|
6 |
2 |
if(ldistmatrix) |
3827
|
0 |
6 |
if (!distmatrix) return NULL; /* Insufficient memory */ |
3848
|
6 |
2 |
if(ldistmatrix) |
3850
|
45 |
6 |
for (i = 1; i < nelements; i++) free(distmatrix[i]); |
3899
|
0 |
0 |
if (!nodecounts) return 0; |
3900
|
0 |
0 |
if (order) { |
3902
|
0 |
0 |
if (!nodeorder) { |
3906
|
0 |
0 |
for (i = 0; i < nnodes; i++) |
3910
|
0 |
0 |
if (i1 < 0) |
3919
|
0 |
0 |
if (i2 < 0) |
3928
|
0 |
0 |
if (order1 > order2) { |
3938
|
0 |
0 |
{ for (i = 0; i < nnodes; i++) |
3942
|
0 |
0 |
counts1 = (i1 < 0) ? nodecounts[-i1-1] : 1; |
3943
|
0 |
0 |
counts2 = (i2 < 0) ? nodecounts[-i2-1] : 1; |
3949
|
0 |
0 |
for ( ; i >= 0; i--) |
3952
|
0 |
0 |
counts1 = (i1<0) ? nodecounts[-i1-1] : 1; |
3954
|
0 |
0 |
if (i1 >= 0) indices[index] = i1; |
3957
|
0 |
0 |
if (i2 >= 0) indices[index] = i2; |
3971
|
2 |
0 |
{ const int nelements = (transpose==0) ? nrows : ncolumns; |
3972
|
2 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
3988
|
2 |
0 |
if (transpose==0) |
3989
|
17 |
2 |
{ for (i = 0; i < nelements; i++) |
3991
|
46 |
17 |
for (j = 0; j < ndata; j++) |
3992
|
46 |
0 |
{ if (mask[i][j]) |
3999
|
17 |
0 |
if (stddata[i] > 0) stddata[i] = sqrt(stddata[i]/n); |
4004
|
0 |
0 |
{ for (i = 0; i < nelements; i++) |
4006
|
0 |
0 |
for (j = 0; j < ndata; j++) |
4007
|
0 |
0 |
{ if (mask[j][i]) |
4014
|
0 |
0 |
if (stddata[i] > 0) stddata[i] = sqrt(stddata[i]/n); |
4019
|
2 |
0 |
if (transpose==0) |
4021
|
20 |
2 |
for (i = 0; i < nygrid; i++) |
4023
|
70 |
20 |
for (j = 0; j < ndata; j++) dummymask[i][j] = 1; |
4028
|
0 |
0 |
for (i = 0; i < ndata; i++) |
4035
|
20 |
2 |
for (ix = 0; ix < nxgrid; ix++) |
4036
|
200 |
20 |
{ for (iy = 0; iy < nygrid; iy++) |
4038
|
700 |
200 |
for (i = 0; i < ndata; i++) |
4044
|
700 |
200 |
for (i = 0; i < ndata; i++) celldata[ix][iy][i] /= sum; |
4050
|
17 |
2 |
for (i = 0; i < nelements; i++) index[i] = i; |
4051
|
17 |
2 |
for (i = 0; i < nelements; i++) |
4059
|
200 |
2 |
for (iter = 0; iter < niter; iter++) |
4064
|
200 |
0 |
if (transpose==0) |
4070
|
2000 |
200 |
for (ix = 0; ix < nxgrid; ix++) |
4071
|
20000 |
2000 |
{ for (iy = 0; iy < nygrid; iy++) |
4075
|
589 |
19411 |
if (distance < closest) |
4082
|
2000 |
200 |
for (ix = 0; ix < nxgrid; ix++) |
4083
|
20000 |
2000 |
{ for (iy = 0; iy < nygrid; iy++) |
4084
|
13018 |
6982 |
{ if (sqrt((ix-ixbest)*(ix-ixbest)+(iy-iybest)*(iy-iybest))
|
4086
|
46124 |
13018 |
for (i = 0; i < ndata; i++) |
4087
|
0 |
46124 |
{ if (mask[iobject][i]==0) continue; |
4091
|
46124 |
13018 |
for (i = 0; i < ndata; i++) |
4096
|
13018 |
0 |
if (sum>0) |
4098
|
46124 |
13018 |
for (i = 0; i < ndata; i++) celldata[ix][iy][i] /= sum; |
4110
|
0 |
0 |
for (i = 0; i < ndata; i++) |
4114
|
0 |
0 |
for (ix = 0; ix < nxgrid; ix++) |
4115
|
0 |
0 |
{ for (iy = 0; iy < nygrid; iy++) |
4117
|
0 |
0 |
for (i = 0; i < ndata; i++) |
4122
|
0 |
0 |
if (distance < closest) |
4130
|
0 |
0 |
for (ix = 0; ix < nxgrid; ix++) |
4131
|
0 |
0 |
{ for (iy = 0; iy < nygrid; iy++) |
4132
|
0 |
0 |
{ if (sqrt((ix-ixbest)*(ix-ixbest)+(iy-iybest)*(iy-iybest))
|
4134
|
0 |
0 |
for (i = 0; i < ndata; i++) |
4135
|
0 |
0 |
{ if (mask[i][iobject]==0) continue; |
4139
|
0 |
0 |
for (i = 0; i < ndata; i++) |
4144
|
0 |
0 |
if (sum>0) |
4146
|
0 |
0 |
for (i = 0; i < ndata; i++) celldata[ix][iy][i] /= sum; |
4153
|
2 |
0 |
if (transpose==0) |
4154
|
20 |
2 |
for (i = 0; i < nygrid; i++) free(dummymask[i]); |
4156
|
0 |
0 |
for (i = 0; i < ndata; i++) free(dummymask[i]); |
4170
|
2 |
0 |
{ const int ndata = (transpose==0) ? ncolumns : nrows; |
4178
|
2 |
0 |
if (transpose==0) |
4180
|
20 |
2 |
for (i = 0; i < nygrid; i++) |
4182
|
70 |
20 |
for (j = 0; j < ncolumns; j++) dummymask[i][j] = 1; |
4184
|
17 |
2 |
for (i = 0; i < nrows; i++) |
4190
|
170 |
17 |
for (ix = 0; ix < nxgrid; ix++) |
4191
|
1700 |
170 |
{ for (iy = 0; iy < nygrid; iy++) |
4195
|
57 |
1643 |
if (distance < closest) |
4205
|
20 |
2 |
for (i = 0; i < nygrid; i++) free(dummymask[i]); |
4213
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4217
|
0 |
0 |
for (i = 0; i < ncolumns; i++) |
4220
|
0 |
0 |
for (j = 0; j < ndata; j++) |
4224
|
0 |
0 |
for (ix = 0; ix < nxgrid; ix++) |
4225
|
0 |
0 |
{ for (iy = 0; iy < nygrid; iy++) |
4227
|
0 |
0 |
for(j = 0; j < ndata; j++) |
4231
|
0 |
0 |
if (distance < closest) |
4242
|
0 |
0 |
for (i = 0; i < nrows; i++) free(dummymask[i]); |
4329
|
2 |
0 |
{ const int nobjects = (transpose==0) ? nrows : ncolumns; |
4330
|
2 |
0 |
const int ndata = (transpose==0) ? ncolumns : nrows; |
4334
|
0 |
2 |
if (nobjects < 2) return; |
4336
|
2 |
0 |
if (lcelldata==0) |
4338
|
20 |
2 |
for (i = 0; i < nxgrid; i++) |
4340
|
200 |
20 |
for (j = 0; j < nygrid; j++) |
4347
|
2 |
0 |
if (clusterid) |
4350
|
2 |
0 |
if(lcelldata==0) |
4351
|
20 |
2 |
{ for (i = 0; i < nxgrid; i++) |
4352
|
200 |
20 |
for (j = 0; j < nygrid; j++) |
4354
|
20 |
2 |
for (i = 0; i < nxgrid; i++) |
4449
|
46 |
0 |
if (n1 < 1 || n2 < 1) return -1.0; |
|
0 |
46 |
if (n1 < 1 || n2 < 1) return -1.0; |
4451
|
46 |
0 |
if (transpose==0) |
4453
|
56 |
46 |
for (i = 0; i < n1; i++) |
4455
|
56 |
0 |
if (index < 0 || index >= nrows) return -1.0; |
|
0 |
56 |
if (index < 0 || index >= nrows) return -1.0; |
4457
|
90 |
46 |
for (i = 0; i < n2; i++) |
4459
|
90 |
0 |
if (index < 0 || index >= nrows) return -1.0; |
|
0 |
90 |
if (index < 0 || index >= nrows) return -1.0; |
4464
|
0 |
0 |
for (i = 0; i < n1; i++) |
4466
|
0 |
0 |
if (index < 0 || index >= ncolumns) return -1.0; |
|
0 |
0 |
if (index < 0 || index >= ncolumns) return -1.0; |
4468
|
0 |
0 |
for (i = 0; i < n2; i++) |
4470
|
0 |
0 |
if (index < 0 || index >= ncolumns) return -1.0; |
|
0 |
0 |
if (index < 0 || index >= ncolumns) return -1.0; |
4478
|
14 |
0 |
if (transpose==0) |
4489
|
24 |
14 |
for (i = 0; i < n1; i++) |
4491
|
68 |
24 |
for (j = 0; j < ncolumns; j++) |
4492
|
68 |
0 |
if (mask[k][j] != 0) |
4497
|
26 |
14 |
for (i = 0; i < n2; i++) |
4499
|
80 |
26 |
for (j = 0; j < ncolumns; j++) |
4500
|
80 |
0 |
if (mask[k][j] != 0) |
4505
|
28 |
14 |
for (i = 0; i < 2; i++) |
4506
|
90 |
28 |
for (j = 0; j < ncolumns; j++) |
4507
|
90 |
0 |
{ if (count[i][j]>0) |
4516
|
28 |
14 |
for (i = 0; i < 2; i++) |
4528
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4533
|
0 |
0 |
for (i = 0; i < n1; i++) |
4535
|
0 |
0 |
for (j = 0; j < nrows; j++) |
4536
|
0 |
0 |
{ if (mask[j][k] != 0) |
4542
|
0 |
0 |
for (i = 0; i < n2; i++) |
4544
|
0 |
0 |
for (j = 0; j < nrows; j++) |
4545
|
0 |
0 |
{ if (mask[j][k] != 0) |
4551
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4552
|
0 |
0 |
for (j = 0; j < 2; j++) |
4553
|
0 |
0 |
if (count[i][j]>0) |
4560
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4573
|
8 |
0 |
if (transpose==0) |
4578
|
16 |
8 |
for (i = 0; i < 2; i++) |
4582
|
24 |
8 |
for (j = 0; j < ncolumns; j++) |
4584
|
24 |
24 |
for (k = 0; k < n1; k++) |
4586
|
24 |
0 |
if (mask[i][j]) |
4591
|
24 |
0 |
if (count>0) |
4600
|
24 |
8 |
for (j = 0; j < ncolumns; j++) |
4602
|
48 |
24 |
for (k = 0; k < n2; k++) |
4604
|
48 |
0 |
if (mask[i][j]) |
4609
|
24 |
0 |
if (count>0) |
4619
|
16 |
8 |
for (i = 0; i < 2; i++) |
4631
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4635
|
0 |
0 |
for (j = 0; j < nrows; j++) |
4637
|
0 |
0 |
for (k = 0; k < n1; k++) |
4639
|
0 |
0 |
if (mask[j][i]) |
4644
|
0 |
0 |
if (count>0) |
4653
|
0 |
0 |
for (j = 0; j < nrows; j++) |
4655
|
0 |
0 |
for (k = 0; k < n2; k++) |
4657
|
0 |
0 |
if (mask[j][i]) |
4662
|
0 |
0 |
if (count>0) |
4672
|
0 |
0 |
for (i = 0; i < nrows; i++) |
4684
|
8 |
0 |
const int n = (transpose==0) ? ncolumns : nrows; |
4686
|
8 |
8 |
for (i1 = 0; i1 < n1; i1++) |
4687
|
16 |
8 |
for (i2 = 0; i2 < n2; i2++) |
4692
|
13 |
3 |
if (distance < mindistance) mindistance = distance; |
4698
|
8 |
0 |
const int n = (transpose==0) ? ncolumns : nrows; |
4700
|
8 |
8 |
for (i1 = 0; i1 < n1; i1++) |
4701
|
16 |
8 |
for (i2 = 0; i2 < n2; i2++) |
4706
|
9 |
7 |
if (distance > maxdistance) maxdistance = distance; |
4712
|
8 |
0 |
const int n = (transpose==0) ? ncolumns : nrows; |
4714
|
8 |
8 |
for (i1 = 0; i1 < n1; i1++) |
4715
|
16 |
8 |
for (i2 = 0; i2 < n2; i2++) |