| line |
true |
false |
branch |
|
229
|
0 |
10 |
if (endl >/*=*/ endr) error_index = 2; |
|
230
|
0 |
10 |
else if (dimensions > iterations) error_index = 3; |
|
231
|
10 |
0 |
else if (A->cols <= 0 || A->rows <= 0) error_index = 4; |
|
|
0 |
10 |
else if (A->cols <= 0 || A->rows <= 0) error_index = 4; |
|
233
|
10 |
0 |
else if (iterations <= 0 || iterations > A->cols || iterations > A->rows) |
|
|
10 |
0 |
else if (iterations <= 0 || iterations > A->cols || iterations > A->rows) |
|
|
0 |
10 |
else if (iterations <= 0 || iterations > A->cols || iterations > A->rows) |
|
235
|
10 |
0 |
else if (dimensions <= 0 || dimensions > iterations) error_index = 6; |
|
|
0 |
10 |
else if (dimensions <= 0 || dimensions > iterations) error_index = 6; |
|
236
|
0 |
10 |
if (error_index) |
|
343
|
0 |
0 |
if (!A) { |
|
362
|
10 |
0 |
if (dimensions <= 0 || dimensions > m) |
|
|
7 |
3 |
if (dimensions <= 0 || dimensions > m) |
|
364
|
10 |
0 |
if (iterations <= 0 || iterations > m) |
|
|
10 |
0 |
if (iterations <= 0 || iterations > m) |
|
366
|
0 |
10 |
if (iterations < dimensions) iterations = dimensions; |
|
369
|
0 |
10 |
if (SVDVerbosity > 0) |
|
374
|
0 |
10 |
if (check_parameters(A, dimensions, iterations, end[0], end[1], TRUE)) |
|
397
|
0 |
10 |
if (!(wptr[0] = svd_doubleArray(n, TRUE, "las2: wptr[0]"))) goto abort; |
|
398
|
0 |
10 |
if (!(wptr[1] = svd_doubleArray(n, FALSE, "las2: wptr[1]"))) goto abort; |
|
399
|
0 |
10 |
if (!(wptr[2] = svd_doubleArray(n, FALSE, "las2: wptr[2]"))) goto abort; |
|
400
|
0 |
10 |
if (!(wptr[3] = svd_doubleArray(n, FALSE, "las2: wptr[3]"))) goto abort; |
|
401
|
0 |
10 |
if (!(wptr[4] = svd_doubleArray(n, FALSE, "las2: wptr[4]"))) goto abort; |
|
402
|
0 |
10 |
if (!(wptr[5] = svd_doubleArray(n, FALSE, "las2: wptr[5]"))) goto abort; |
|
403
|
0 |
10 |
if (!(wptr[6] = svd_doubleArray(iterations, FALSE, "las2: wptr[6]"))) |
|
405
|
0 |
10 |
if (!(wptr[7] = svd_doubleArray(iterations, FALSE, "las2: wptr[7]"))) |
|
407
|
0 |
10 |
if (!(wptr[8] = svd_doubleArray(iterations, FALSE, "las2: wptr[8]"))) |
|
409
|
0 |
10 |
if (!(wptr[9] = svd_doubleArray(iterations + 1, FALSE, "las2: wptr[9]"))) |
|
412
|
0 |
10 |
if (!(ritz = svd_doubleArray(iterations + 1, TRUE, "las2: ritz"))) |
|
415
|
0 |
10 |
if (!(bnd = svd_doubleArray(iterations + 1, TRUE, "las2: bnd"))) |
|
419
|
0 |
10 |
if (!(LanStore = (double **) calloc(iterations + MAXLL, sizeof(double *)))) |
|
421
|
0 |
10 |
if (!(OPBTemp = svd_doubleArray(A->rows, FALSE, "las2: OPBTemp"))) |
|
429
|
0 |
10 |
if (SVDVerbosity > 0) { |
|
433
|
0 |
10 |
if (SVDVerbosity > 2) { |
|
435
|
0 |
0 |
for (i = 0; i <= steps; i++) |
|
439
|
10 |
0 |
SAFE_FREE(wptr[0]); |
|
440
|
10 |
0 |
SAFE_FREE(wptr[1]); |
|
441
|
10 |
0 |
SAFE_FREE(wptr[2]); |
|
442
|
10 |
0 |
SAFE_FREE(wptr[3]); |
|
443
|
10 |
0 |
SAFE_FREE(wptr[4]); |
|
444
|
10 |
0 |
SAFE_FREE(wptr[7]); |
|
445
|
10 |
0 |
SAFE_FREE(wptr[8]); |
|
451
|
0 |
10 |
if (!R) { |
|
459
|
10 |
0 |
if (!R->Ut || !R->S || !R->Vt) { |
|
|
10 |
0 |
if (!R->Ut || !R->S || !R->Vt) { |
|
|
0 |
10 |
if (!R->Ut || !R->S || !R->Vt) { |
|
467
|
0 |
10 |
if (SVDVerbosity > 1) { |
|
471
|
0 |
0 |
if (SVDVerbosity > 2) { |
|
479
|
0 |
10 |
if (SVDVerbosity > 0) { |
|
485
|
100 |
10 |
for (i = 0; i <= 9; i++) |
|
486
|
30 |
70 |
SAFE_FREE(wptr[i]); |
|
487
|
10 |
0 |
SAFE_FREE(ritz); |
|
488
|
10 |
0 |
SAFE_FREE(bnd); |
|
489
|
10 |
0 |
if (LanStore) { |
|
490
|
80 |
10 |
for (i = 0; i < iterations + MAXLL; i++) |
|
491
|
80 |
0 |
SAFE_FREE(LanStore[i]); |
|
492
|
10 |
0 |
SAFE_FREE(LanStore); |
|
494
|
10 |
0 |
SAFE_FREE(OPBTemp); |
|
497
|
10 |
0 |
if (R && transpose) { |
|
|
0 |
10 |
if (R && transpose) { |
|
570
|
7 |
3 |
if (x == 0) return; |
|
573
|
105 |
3 |
for (i = 0; i < size; i++) { |
|
574
|
21 |
84 |
n = (j >= x) ? j - x : j + size - x; |
|
579
|
21 |
84 |
if (j == start) { |
|
599
|
60 |
10 |
for (i = 0; i < jsq; i+= (js+1)) s[i] = 1.0; |
|
613
|
0 |
10 |
if (ierr) { |
|
618
|
60 |
10 |
for (k = 0; k < js; k++) { |
|
620
|
60 |
0 |
if (bnd[k] <= kappa * fabs(ritz[k]) && k > js-neig-1) { |
|
|
60 |
0 |
if (bnd[k] <= kappa * fabs(ritz[k]) && k > js-neig-1) { |
|
621
|
13 |
47 |
if (--x < 0) x = R->d - 1; |
|
623
|
420 |
60 |
for (i = 0; i < n; i++) w1[i] = 0.0; |
|
624
|
360 |
60 |
for (i = 0; i < js; i++) { |
|
647
|
10 |
0 |
SAFE_FREE(s); |
|
654
|
57 |
10 |
for (x = 0; x < R->d; x++) { |
|
672
|
0 |
10 |
SAFE_FREE(s); |
|
673
|
10 |
0 |
SAFE_FREE(xv2); |
|
745
|
10 |
0 |
if (!rnm || ierr) return 0; |
|
|
0 |
10 |
if (!rnm || ierr) return 0; |
|
753
|
10 |
10 |
while (/*id1 < dimensions && */!ENOUGH) { |
|
754
|
0 |
10 |
if (rnm <= tol) rnm = 0.0; |
|
759
|
0 |
10 |
if (ENOUGH) j = j - 1; |
|
766
|
20 |
0 |
for (id2 = 0; id2 < j; id2++) { |
|
767
|
10 |
10 |
if (l > j) break; |
|
768
|
10 |
50 |
for (i = l; i <= j; i++) if (!bet[i+1]) break; |
|
|
60 |
0 |
for (i = l; i <= j; i++) if (!bet[i+1]) break; |
|
769
|
0 |
10 |
if (i > j) i = j; |
|
777
|
0 |
10 |
if (ierr) { |
|
780
|
0 |
0 |
for (id3 = l; id3 <= i; id3++) |
|
784
|
60 |
10 |
for (id3 = l; id3 <= i; id3++) |
|
801
|
0 |
10 |
if (neig < dimensions) { |
|
802
|
0 |
0 |
if (!neig) { |
|
809
|
0 |
10 |
ENOUGH = ENOUGH || first >= iterations; |
|
|
0 |
0 |
ENOUGH = ENOUGH || first >= iterations; |
|
863
|
50 |
10 |
for (j=first; j
|
|
872
|
20 |
30 |
if (j-1 < MAXLL) store(n, STORP, j-1, wptr[4]); |
|
876
|
0 |
50 |
if (!bet[j]) { |
|
878
|
0 |
0 |
if (ierr) return j; |
|
879
|
0 |
0 |
if (!rnm) *enough = TRUE; |
|
881
|
0 |
50 |
if (*enough) { |
|
901
|
20 |
30 |
if (j <= MAXLL && (fabs(alf[j-1]) > 4.0 * fabs(alf[j]))) |
|
|
0 |
20 |
if (j <= MAXLL && (fabs(alf[j-1]) > 4.0 * fabs(alf[j]))) |
|
903
|
0 |
50 |
for (i=0; i < svd_imin(*ll, j-1); i++) { |
|
915
|
50 |
0 |
if (bet[j] > 0.0) bet[j] = bet[j] + t; |
|
930
|
10 |
40 |
if (rnm <= tol) rnm = 0.0; |
|
977
|
0 |
50 |
if (step < 1) return; |
|
978
|
50 |
0 |
if (rnm) { |
|
979
|
40 |
10 |
if (step > 1) { |
|
983
|
60 |
50 |
for (i=1; i<=step-2; i++) |
|
1043
|
10 |
40 |
if (step < ll+2) return; |
|
1046
|
10 |
30 |
if (fabs(eta[k]) > reps) { |
|
1050
|
20 |
10 |
while (iteration < 2 && flag) { |
|
|
20 |
0 |
while (iteration < 2 && flag) { |
|
1051
|
0 |
20 |
if (rnm > tol) { |
|
1057
|
0 |
0 |
for (i = ll; i < step; i++) { |
|
1072
|
0 |
0 |
if (tq <= reps1 && tr <= reps1 * rnm) flag = FALSE; |
|
|
0 |
0 |
if (tq <= reps1 && tr <= reps1 * rnm) flag = FALSE; |
|
1076
|
60 |
10 |
for (i = ll; i <= step; i++) { |
|
1131
|
10 |
0 |
if (rnm == 0.0 || ierr != 0) return; |
|
|
0 |
10 |
if (rnm == 0.0 || ierr != 0) return; |
|
1200
|
10 |
0 |
for (id = 0; id < 3; id++) { |
|
1201
|
10 |
0 |
if (id > 0 || step > 0 || rnm2 == 0) |
|
|
10 |
0 |
if (id > 0 || step > 0 || rnm2 == 0) |
|
|
10 |
0 |
if (id > 0 || step > 0 || rnm2 == 0) |
|
1202
|
70 |
10 |
for (i = 0; i < n; i++) r[i] = svd_random2(&irand); |
|
1209
|
10 |
0 |
if (rnm2 > 0.0) break; |
|
1213
|
0 |
10 |
if (rnm2 <= 0.0) { |
|
1217
|
0 |
10 |
if (step > 0) { |
|
1218
|
0 |
0 |
for (i = 0; i < step; i++) { |
|
1229
|
0 |
0 |
if (t <= eps * rnm2) t = 0.0; |
|
1277
|
50 |
10 |
for (i=((step+1) + (step-1)) / 2; i >= mid + 1; i -= 1) |
|
1278
|
0 |
50 |
if (fabs(ritz[i-1] - ritz[i]) < eps34 * fabs(ritz[i])) |
|
1279
|
0 |
0 |
if (bnd[i] > tol && bnd[i-1] > tol) { |
|
|
0 |
0 |
if (bnd[i] > tol && bnd[i-1] > tol) { |
|
1285
|
0 |
10 |
for (i=((step+1) - (step-1)) / 2; i <= mid - 1; i +=1 ) |
|
1286
|
0 |
0 |
if (fabs(ritz[i+1] - ritz[i]) < eps34 * fabs(ritz[i])) |
|
1287
|
0 |
0 |
if (bnd[i] > tol && bnd[i+1] > tol) { |
|
|
0 |
0 |
if (bnd[i] > tol && bnd[i+1] > tol) { |
|
1295
|
60 |
10 |
for (i = 0; i <= step; i++) { |
|
1297
|
50 |
10 |
if (i < step) gapl = ritz[i+1] - ritz[i]; |
|
1299
|
60 |
0 |
if (gap > bnd[i]) bnd[i] = bnd[i] * (bnd[i] / gap); |
|
1300
|
60 |
0 |
if (bnd[i] <= 16.0 * eps * fabs(ritz[i])) { |
|
1302
|
60 |
0 |
if (!*enough) *enough = endl < ritz[i] && ritz[i] < endr; |
|
|
60 |
0 |
if (!*enough) *enough = endl < ritz[i] && ritz[i] < endr; |
|
|
0 |
60 |
if (!*enough) *enough = endl < ritz[i] && ritz[i] < endr; |
|
1364
|
0 |
10 |
if (n == 1) return; |
|
1368
|
50 |
10 |
for (i = 1; i < n; i++) { |
|
1373
|
60 |
10 |
for (l = 0; l < n; l++) { |
|
1375
|
150 |
60 |
while (iteration <= 30) { |
|
1376
|
460 |
0 |
for (m = l; m < n; m++) { |
|
1378
|
100 |
360 |
if (m == last) break; |
|
1381
|
50 |
310 |
if (test + fabs(e[m]) == test) convergence = TRUE; |
|
1383
|
50 |
310 |
if (convergence) break; |
|
1387
|
90 |
60 |
if (m != l) { |
|
1388
|
0 |
90 |
if (iteration == 30) { |
|
1402
|
400 |
0 |
while (underflow == FALSE && i >= l) { |
|
|
310 |
90 |
while (underflow == FALSE && i >= l) { |
|
1407
|
0 |
310 |
if (r == 0.0) underflow = TRUE; |
|
1423
|
0 |
90 |
if (underflow) { |
|
1437
|
50 |
10 |
if (l != 0) { |
|
1439
|
110 |
0 |
while (i >= 1 && exchange == TRUE) { |
|
|
60 |
50 |
while (i >= 1 && exchange == TRUE) { |
|
1440
|
10 |
50 |
if (p < d[i-1]) { |
|
1448
|
10 |
50 |
if (exchange) i = 0; |
|
1515
|
0 |
10 |
if (n == 1) return; |
|
1518
|
50 |
10 |
for (i = 1; i < n; i++) e[i-1] = e[i]; |
|
1521
|
60 |
10 |
for (l = 0; l < n; l++) { |
|
1525
|
150 |
0 |
while (iteration <= 30) { |
|
1526
|
460 |
0 |
for (m = l; m < n; m++) { |
|
1528
|
100 |
360 |
if (m == last) break; |
|
1531
|
50 |
310 |
if (test + fabs(e[m]) == test) convergence = TRUE; |
|
1533
|
50 |
310 |
if (convergence) break; |
|
1535
|
90 |
60 |
if (m != l) { |
|
1539
|
0 |
90 |
if (iteration == 30) { |
|
1555
|
400 |
0 |
while (underflow == FALSE && i >= l) { |
|
|
310 |
90 |
while (underflow == FALSE && i >= l) { |
|
1560
|
0 |
310 |
if (r == 0.0) underflow = TRUE; |
|
1571
|
1860 |
310 |
for (k = 0; k < nnm; k += n) { |
|
1581
|
0 |
90 |
if (underflow) { |
|
1596
|
50 |
10 |
for (l = 1; l < n; l++) { |
|
1600
|
150 |
50 |
for (j = l; j < n; j++) { |
|
1601
|
10 |
140 |
if (d[j] < p) { |
|
1607
|
10 |
40 |
if (k != i) { |
|
1610
|
60 |
10 |
for (j = 0; j < nnm; j += n) { |
|
1680
|
530 |
10 |
while (temp1 - ONE == ZERO) { |
|
1688
|
10 |
10 |
while (itemp == 0) { |
|
1699
|
530 |
10 |
while (temp1 - ONE == ZERO) { |
|
1708
|
0 |
10 |
if (temp - a != ZERO) *irnd = 1; |
|
1711
|
10 |
0 |
if ((*irnd == 0) && (temp - tempa != ZERO)) *irnd = 2; |
|
|
10 |
0 |
if ((*irnd == 0) && (temp - tempa != ZERO)) *irnd = 2; |
|
1716
|
560 |
10 |
for (i = 0; i < *negep; i++) a = a * betain; |
|
1719
|
30 |
10 |
while (temp-ONE == ZERO) { |
|
1729
|
40 |
10 |
while (temp - ONE == ZERO) { |
|
1778
|
60 |
0 |
if (!LanStore[j + MAXLL]) { |
|
1779
|
0 |
60 |
if (!(LanStore[j + MAXLL] = svd_doubleArray(n, FALSE, "LanStore[j]"))) |
|
1785
|
0 |
360 |
if (!LanStore[j + MAXLL]) |
|
1791
|
0 |
20 |
if (j >= MAXLL) { |
|
1795
|
20 |
0 |
if (!LanStore[j]) { |
|
1796
|
0 |
20 |
if (!(LanStore[j] = svd_doubleArray(n, FALSE, "LanStore[j]"))) |
|
1802
|
0 |
0 |
if (j >= MAXLL) { |
|
1806
|
0 |
0 |
if (!LanStore[j]) |