line |
true |
false |
branch |
44
|
10 |
10 |
for (i = 0; i < SVD_COUNTERS; i++) |
55
|
0 |
20 |
if (!D) {perror("svdNewDMat"); return NULL;} |
60
|
0 |
20 |
if (!D->value) {SAFE_FREE(D); return NULL;} |
|
0 |
0 |
if (!D->value) {SAFE_FREE(D); return NULL;} |
63
|
0 |
20 |
if (!D->value[0]) {SAFE_FREE(D->value); SAFE_FREE(D); return NULL;} |
|
0 |
0 |
if (!D->value[0]) {SAFE_FREE(D->value); SAFE_FREE(D); return NULL;} |
|
0 |
0 |
if (!D->value[0]) {SAFE_FREE(D->value); SAFE_FREE(D); return NULL;} |
65
|
94 |
20 |
for (i = 1; i < rows; i++) D->value[i] = D->value[i-1] + cols; |
70
|
0 |
20 |
if (!D) return; |
71
|
20 |
0 |
SAFE_FREE(D->value[0]); |
72
|
20 |
0 |
SAFE_FREE(D->value); |
79
|
0 |
3 |
if (!S) {perror("svdNewSMat"); return NULL;} |
84
|
0 |
3 |
if (!S->pointr) {svdFreeSMat(S); return NULL;} |
86
|
0 |
3 |
if (!S->rowind) {svdFreeSMat(S); return NULL;} |
88
|
0 |
3 |
if (!S->value) {svdFreeSMat(S); return NULL;} |
93
|
0 |
3 |
if (!S) return; |
94
|
3 |
0 |
SAFE_FREE(S->pointr); |
95
|
3 |
0 |
SAFE_FREE(S->rowind); |
96
|
3 |
0 |
SAFE_FREE(S->value); |
104
|
0 |
10 |
if (!R) {perror("svdNewSVDRec"); return NULL;} |
110
|
0 |
10 |
if (!R) return; |
111
|
10 |
0 |
if (R->Ut) svdFreeDMat(R->Ut); |
112
|
10 |
0 |
if (R->S) SAFE_FREE(R->S); |
|
10 |
0 |
if (R->S) SAFE_FREE(R->S); |
113
|
10 |
0 |
if (R->Vt) svdFreeDMat(R->Vt); |
124
|
0 |
0 |
if (!D) { |
128
|
0 |
0 |
for (i = 0, c = 0; i < S->vals; i++) { |
129
|
0 |
0 |
while (S->pointr[c + 1] <= i) c++; |
139
|
18 |
3 |
for (i = 0, n = 0; i < D->rows; i++) |
140
|
126 |
18 |
for (j = 0; j < D->cols; j++) |
141
|
66 |
60 |
if (D->value[i][j] != 0) n++; |
144
|
0 |
3 |
if (!S) { |
148
|
21 |
3 |
for (j = 0, n = 0; j < D->cols; j++) { |
150
|
126 |
21 |
for (i = 0; i < D->rows; i++) |
151
|
66 |
60 |
if (D->value[i][j] != 0) { |
165
|
0 |
0 |
for (r = 0; r < D->rows; r++) |
166
|
0 |
0 |
for (c = 0; c < D->cols; c++) |
176
|
0 |
0 |
for (i = 0; i < S->vals; i++) |
180
|
0 |
0 |
for (r = S->rows - 1; r > 0; r--) |
184
|
0 |
0 |
for (c = 0, i = 0; c < S->cols; c++) { |
185
|
0 |
0 |
for (; i < S->pointr[c+1]; i++) { |
201
|
0 |
0 |
if (!file) |
203
|
0 |
0 |
if (binary) { |
205
|
0 |
0 |
for (i = 0; i < n; i++) |
209
|
0 |
0 |
for (i = 0; i < n; i++) |
220
|
0 |
0 |
if (!file) { |
224
|
0 |
0 |
if (binary) { |
226
|
0 |
0 |
} else if (fscanf(file, " %d", np) != 1) { |
233
|
0 |
0 |
if (!a) return NULL; |
234
|
0 |
0 |
if (binary) { |
236
|
0 |
0 |
for (i = 0; i < n; i++) { |
241
|
0 |
0 |
for (i = 0; i < n; i++) { |
242
|
0 |
0 |
if (fscanf(file, " %lf\n", a + i) != 1) { |
265
|
0 |
0 |
if (fscanf(file, "%*s%ld%ld%ld%ld\n", |
270
|
0 |
0 |
if (num_mat != 0) { |
279
|
0 |
0 |
if (!S) return NULL; |
282
|
0 |
0 |
for (i = 0; i <= S->cols; i++) { |
283
|
0 |
0 |
if (fscanf(file, " %ld", &x) != 1) { |
292
|
0 |
0 |
for (i = 0; i < S->vals; i++) { |
293
|
0 |
0 |
if (fscanf(file, " %ld", &x) != 1) { |
299
|
0 |
0 |
for (i = 0; i < S->vals; i++) |
300
|
0 |
0 |
if (fscanf(file, " %lf", S->value + i) != 1) { |
309
|
0 |
0 |
__SVDLIBC_LONG col_lines = ((S->cols + 1) / 8) + (((S->cols + 1) % 8) ? 1 : 0); |
310
|
0 |
0 |
__SVDLIBC_LONG row_lines = (S->vals / 8) + ((S->vals % 8) ? 1 : 0); |
322
|
0 |
0 |
for (i = 0; i <= S->cols; i++) |
323
|
0 |
0 |
fprintf(file, "%ld%s", S->pointr[i] + 1, (((i+1) % 8) == 0) ? "\n" : " "); |
325
|
0 |
0 |
for (i = 0; i < S->vals; i++) |
326
|
0 |
0 |
fprintf(file, "%ld%s", S->rowind[i] + 1, (((i+1) % 8) == 0) ? "\n" : " "); |
328
|
0 |
0 |
for (i = 0; i < S->vals; i++) |
329
|
0 |
0 |
fprintf(file, "%g%s", S->value[i], (((i+1) % 8) == 0) ? "\n" : " "); |
337
|
0 |
0 |
if (fscanf(file, " %ld %ld %ld", &rows, &cols, &vals) != 3) { |
343
|
0 |
0 |
if (!S) return NULL; |
345
|
0 |
0 |
for (c = 0, v = 0; c < cols; c++) { |
346
|
0 |
0 |
if (fscanf(file, " %ld", &n) != 1) { |
351
|
0 |
0 |
for (i = 0; i < n; i++, v++) { |
352
|
0 |
0 |
if (fscanf(file, " %ld %lf", S->rowind + v, S->value + v) != 2) { |
365
|
0 |
0 |
for (c = 0, v = 0; c < S->cols; c++) { |
367
|
0 |
0 |
for (; v < S->pointr[c+1]; v++) |
380
|
0 |
0 |
if (e) { |
386
|
0 |
0 |
if (!S) return NULL; |
388
|
0 |
0 |
for (c = 0, v = 0; c < cols; c++) { |
389
|
0 |
0 |
if (svd_readBinInt(file, &n)) { |
394
|
0 |
0 |
for (i = 0; i < n; i++, v++) { |
397
|
0 |
0 |
if (e) { |
414
|
0 |
0 |
for (c = 0, v = 0; c < S->cols; c++) { |
416
|
0 |
0 |
for (; v < S->pointr[c+1]; v++) { |
427
|
0 |
0 |
if (fscanf(file, " %ld %ld", &rows, &cols) != 2) { |
433
|
0 |
0 |
if (!D) return NULL; |
435
|
0 |
0 |
for (i = 0; i < rows; i++) |
436
|
0 |
0 |
for (j = 0; j < cols; j++) { |
437
|
0 |
0 |
if (fscanf(file, " %lf", &(D->value[i][j])) != 1) { |
448
|
0 |
0 |
for (i = 0; i < D->rows; i++) |
449
|
0 |
0 |
for (j = 0; j < D->cols; j++) |
450
|
0 |
0 |
fprintf(file, "%g%c", D->value[i][j], (j == D->cols - 1) ? '\n' : ' '); |
460
|
0 |
0 |
if (e) { |
466
|
0 |
0 |
if (!D) return NULL; |
468
|
0 |
0 |
for (i = 0; i < rows; i++) |
469
|
0 |
0 |
for (j = 0; j < cols; j++) { |
470
|
0 |
0 |
if (svd_readBinFloat(file, &f)) { |
483
|
0 |
0 |
for (i = 0; i < D->rows; i++) |
484
|
0 |
0 |
for (j = 0; j < D->cols; j++) |
512
|
0 |
0 |
if (D) { |
542
|
0 |
0 |
if (S) { |
552
|
0 |
0 |
if (!file) { |
577
|
0 |
0 |
if (D) svdFreeDMat(D); |
583
|
0 |
0 |
if (!file) { |
609
|
0 |
0 |
if (S) svdFreeSMat(S); |