Skip to content

Commit

Permalink
Merge da7f210 into 3a6f462
Browse files Browse the repository at this point in the history
  • Loading branch information
pleshkovvli authored Nov 3, 2023
2 parents 3a6f462 + da7f210 commit 90398ae
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 16 deletions.
32 changes: 24 additions & 8 deletions SRC/cbdsqr.f
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@
*> algorithm through its inner loop. The algorithms stops
*> (and so fails to converge) if the number of passes
*> through the inner loop exceeds MAXITR*N**2.
*>
*> \endverbatim
*
*> \par Note:
* ===========
*>
*> \verbatim
*> Bug report from Cezary Dendek.
*> On November 3rd 2023, the INTEGER variable MAXIT = MAXITR*N**2 is
*> removed since it can overflow pretty easily (for N larger or equal
*> than 18,919). We instead use MAXITDIVN = MAXITR*N.
*> \endverbatim
*
* Authors:
Expand Down Expand Up @@ -255,8 +266,8 @@ SUBROUTINE CBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
* ..
* .. Local Scalars ..
LOGICAL LOWER, ROTATE
INTEGER I, IDIR, ISUB, ITER, J, LL, LLL, M, MAXIT, NM1,
$ NM12, NM13, OLDLL, OLDM
INTEGER I, IDIR, ISUB, ITER, ITERDIVN, J, LL, LLL, M,
$ MAXITDIVN, NM1, NM12, NM13, OLDLL, OLDM
REAL ABSE, ABSS, COSL, COSR, CS, EPS, F, G, H, MU,
$ OLDCS, OLDSN, R, SHIFT, SIGMN, SIGMX, SINL,
$ SINR, SLL, SMAX, SMIN, SMINOA,
Expand Down Expand Up @@ -389,20 +400,21 @@ SUBROUTINE CBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
40 CONTINUE
50 CONTINUE
SMINOA = SMINOA / SQRT( REAL( N ) )
THRESH = MAX( TOL*SMINOA, MAXITR*N*N*UNFL )
THRESH = MAX( TOL*SMINOA, MAXITR*(N*(N*UNFL)) )

Check warning on line 403 in SRC/cbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/cbdsqr.f#L403

Added line #L403 was not covered by tests
ELSE
*
* Absolute accuracy desired
*
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*N*N*UNFL )
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*(N*(N*UNFL)) )

Check warning on line 408 in SRC/cbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/cbdsqr.f#L408

Added line #L408 was not covered by tests
END IF
*
* Prepare for main iteration loop for the singular values
* (MAXIT is the maximum number of passes through the inner
* loop permitted before nonconvergence signalled.)
*
MAXIT = MAXITR*N*N
ITER = 0
MAXITDIVN = MAXITR*N
ITERDIVN = 0
ITER = -1

Check warning on line 417 in SRC/cbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/cbdsqr.f#L415-L417

Added lines #L415 - L417 were not covered by tests
OLDLL = -1
OLDM = -1
*
Expand All @@ -418,8 +430,12 @@ SUBROUTINE CBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
*
IF( M.LE.1 )
$ GO TO 160
IF( ITER.GT.MAXIT )
$ GO TO 200
IF( ITER.GE.N ) THEN
ITER = ITER - N
ITERDIVN = ITERDIVN + 1
IF( ITERDIVN.GE.MAXITDIVN )
$ GO TO 200

Check warning on line 437 in SRC/cbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/cbdsqr.f#L433-L437

Added lines #L433 - L437 were not covered by tests
END IF
*
* Find diagonal block of matrix to work on
*
Expand Down
32 changes: 24 additions & 8 deletions SRC/zbdsqr.f
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@
*> algorithm through its inner loop. The algorithms stops
*> (and so fails to converge) if the number of passes
*> through the inner loop exceeds MAXITR*N**2.
*>
*> \endverbatim
*
*> \par Note:
* ===========
*>
*> \verbatim
*> Bug report from Cezary Dendek.
*> On November 3rd 2023, the INTEGER variable MAXIT = MAXITR*N**2 is
*> removed since it can overflow pretty easily (for N larger or equal
*> than 18,919). We instead use MAXITDIVN = MAXITR*N.
*> \endverbatim
*
* Authors:
Expand Down Expand Up @@ -255,8 +266,8 @@ SUBROUTINE ZBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
* ..
* .. Local Scalars ..
LOGICAL LOWER, ROTATE
INTEGER I, IDIR, ISUB, ITER, J, LL, LLL, M, MAXIT, NM1,
$ NM12, NM13, OLDLL, OLDM
INTEGER I, IDIR, ISUB, ITER, ITERDIVN, J, LL, LLL, M,
$ MAXITDIVN, NM1, NM12, NM13, OLDLL, OLDM
DOUBLE PRECISION ABSE, ABSS, COSL, COSR, CS, EPS, F, G, H, MU,
$ OLDCS, OLDSN, R, SHIFT, SIGMN, SIGMX, SINL,
$ SINR, SLL, SMAX, SMIN, SMINOA,
Expand Down Expand Up @@ -389,20 +400,21 @@ SUBROUTINE ZBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
40 CONTINUE
50 CONTINUE
SMINOA = SMINOA / SQRT( DBLE( N ) )
THRESH = MAX( TOL*SMINOA, MAXITR*N*N*UNFL )
THRESH = MAX( TOL*SMINOA, MAXITR*(N*(N*UNFL)) )

Check warning on line 403 in SRC/zbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/zbdsqr.f#L403

Added line #L403 was not covered by tests
ELSE
*
* Absolute accuracy desired
*
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*N*N*UNFL )
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*(N*(N*UNFL)) )

Check warning on line 408 in SRC/zbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/zbdsqr.f#L408

Added line #L408 was not covered by tests
END IF
*
* Prepare for main iteration loop for the singular values
* (MAXIT is the maximum number of passes through the inner
* loop permitted before nonconvergence signalled.)
*
MAXIT = MAXITR*N*N
ITER = 0
MAXITDIVN = MAXITR*N
ITERDIVN = 0
ITER = -1

Check warning on line 417 in SRC/zbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/zbdsqr.f#L415-L417

Added lines #L415 - L417 were not covered by tests
OLDLL = -1
OLDM = -1
*
Expand All @@ -418,8 +430,12 @@ SUBROUTINE ZBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
*
IF( M.LE.1 )
$ GO TO 160
IF( ITER.GT.MAXIT )
$ GO TO 200
IF( ITER.GE.N ) THEN
ITER = ITER - N
ITERDIVN = ITERDIVN + 1
IF( ITERDIVN.GE.MAXITDIVN )
$ GO TO 200

Check warning on line 437 in SRC/zbdsqr.f

View check run for this annotation

Codecov / codecov/patch

SRC/zbdsqr.f#L433-L437

Added lines #L433 - L437 were not covered by tests
END IF
*
* Find diagonal block of matrix to work on
*
Expand Down

0 comments on commit 90398ae

Please sign in to comment.