Skip to content

Commit 5aeca59

Browse files
authored
Fix documentation error and ordering bug (Reference-LAPACK PR 1140)
1 parent dcb2895 commit 5aeca59

File tree

8 files changed

+38
-17
lines changed

8 files changed

+38
-17
lines changed

lapack-netlib/SRC/dlaed2.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
*> On entry, D contains the eigenvalues of the two submatrices to
7676
*> be combined.
7777
*> On exit, D contains the trailing (N-K) updated eigenvalues
78-
*> (those which were deflated) sorted into increasing order.
78+
*> (those which were deflated) sorted into decreasing order.
7979
*> \endverbatim
8080
*>
8181
*> \param[in,out] Q

lapack-netlib/SRC/dlaed8.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
*> D is DOUBLE PRECISION array, dimension (N)
8686
*> On entry, the eigenvalues of the two submatrices to be
8787
*> combined. On exit, the trailing (N-K) updated eigenvalues
88-
*> (those which were deflated) sorted into increasing order.
88+
*> (those which were deflated) sorted into decreasing order.
8989
*> \endverbatim
9090
*>
9191
*> \param[in,out] Q

lapack-netlib/SRC/dlasd2.f

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
*> On entry D contains the singular values of the two submatrices
8989
*> to be combined. On exit D contains the trailing (N-K) updated
9090
*> singular values (those which were deflated) sorted into
91-
*> increasing order.
91+
*> decreasing order.
9292
*> \endverbatim
9393
*>
9494
*> \param[out] Z
@@ -219,7 +219,7 @@
219219
*> IDXQ is INTEGER array, dimension(N)
220220
*> This contains the permutation which separately sorts the two
221221
*> sub-problems in D into ascending order. Note that entries in
222-
*> the first hlaf of this permutation must first be moved one
222+
*> the first half of this permutation must first be moved one
223223
*> position backward; and entries in the second half
224224
*> must first have NL+1 added to their values.
225225
*> \endverbatim
@@ -451,7 +451,7 @@ SUBROUTINE DLASD2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT,
451451
*
452452
* Check if singular values are close enough to allow deflation.
453453
*
454-
IF( ABS( D( J )-D( JPREV ) ).LE.TOL ) THEN
454+
IF( ( D( J )-D( JPREV ) ).LE.TOL ) THEN
455455
*
456456
* Deflation is possible.
457457
*
@@ -486,7 +486,14 @@ SUBROUTINE DLASD2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT,
486486
END IF
487487
COLTYP( JPREV ) = 4
488488
K2 = K2 - 1
489-
IDXP( K2 ) = JPREV
489+
*
490+
* Insert the deflated index in the correct position in IDXP.
491+
* If J - JPREV is greater than 1, the indices in between
492+
* must be shifted to preserve the correct output order.
493+
*
494+
DO 105 JP = JPREV, J - 1
495+
IDXP( K2 + J - 1 - JP ) = JP
496+
105 CONTINUE
490497
JPREV = J
491498
ELSE
492499
K = K + 1

lapack-netlib/SRC/dlasd7.f

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,9 @@ SUBROUTINE DLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL,
495495
* If J - JPREV is greater than 1, the indices in between
496496
* must be shifted to preserve the correct output order.
497497
*
498-
DO 130 JP = JPREV, J - 1
498+
DO 85 JP = JPREV, J - 1
499499
IDXP( K2 + J - 1 - JP ) = JP
500-
130 CONTINUE
500+
85 CONTINUE
501501
JPREV = J
502502
ELSE
503503
K = K + 1

lapack-netlib/SRC/slaed2.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
*> On entry, D contains the eigenvalues of the two submatrices to
7676
*> be combined.
7777
*> On exit, D contains the trailing (N-K) updated eigenvalues
78-
*> (those which were deflated) sorted into increasing order.
78+
*> (those which were deflated) sorted into decreasing order.
7979
*> \endverbatim
8080
*>
8181
*> \param[in,out] Q

lapack-netlib/SRC/slaed8.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
*> D is REAL array, dimension (N)
8686
*> On entry, the eigenvalues of the two submatrices to be
8787
*> combined. On exit, the trailing (N-K) updated eigenvalues
88-
*> (those which were deflated) sorted into increasing order.
88+
*> (those which were deflated) sorted into decreasing order.
8989
*> \endverbatim
9090
*>
9191
*> \param[in,out] Q

lapack-netlib/SRC/slasd2.f

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
*> On entry D contains the singular values of the two submatrices
8989
*> to be combined. On exit D contains the trailing (N-K) updated
9090
*> singular values (those which were deflated) sorted into
91-
*> increasing order.
91+
*> decreasing order.
9292
*> \endverbatim
9393
*>
9494
*> \param[out] Z
@@ -219,7 +219,7 @@
219219
*> IDXQ is INTEGER array, dimension (N)
220220
*> This contains the permutation which separately sorts the two
221221
*> sub-problems in D into ascending order. Note that entries in
222-
*> the first hlaf of this permutation must first be moved one
222+
*> the first half of this permutation must first be moved one
223223
*> position backward; and entries in the second half
224224
*> must first have NL+1 added to their values.
225225
*> \endverbatim
@@ -451,7 +451,7 @@ SUBROUTINE SLASD2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT,
451451
*
452452
* Check if singular values are close enough to allow deflation.
453453
*
454-
IF( ABS( D( J )-D( JPREV ) ).LE.TOL ) THEN
454+
IF( ( D( J )-D( JPREV ) ).LE.TOL ) THEN
455455
*
456456
* Deflation is possible.
457457
*
@@ -486,7 +486,14 @@ SUBROUTINE SLASD2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT,
486486
END IF
487487
COLTYP( JPREV ) = 4
488488
K2 = K2 - 1
489-
IDXP( K2 ) = JPREV
489+
*
490+
* Insert the deflated index in the correct position in IDXP.
491+
* If J - JPREV is greater than 1, the indices in between
492+
* must be shifted to preserve the correct output order.
493+
*
494+
DO 105 JP = JPREV, J - 1
495+
IDXP( K2 + J - 1 - JP ) = JP
496+
105 CONTINUE
490497
JPREV = J
491498
ELSE
492499
K = K + 1

lapack-netlib/SRC/slasd7.f

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
*> On entry D contains the singular values of the two submatrices
102102
*> to be combined. On exit D contains the trailing (N-K) updated
103103
*> singular values (those which were deflated) sorted into
104-
*> increasing order.
104+
*> decreasing order.
105105
*> \endverbatim
106106
*>
107107
*> \param[out] Z
@@ -454,7 +454,7 @@ SUBROUTINE SLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL,
454454
*
455455
* Check if singular values are close enough to allow deflation.
456456
*
457-
IF( ABS( D( J )-D( JPREV ) ).LE.TOL ) THEN
457+
IF( ( D( J )-D( JPREV ) ).LE.TOL ) THEN
458458
*
459459
* Deflation is possible.
460460
*
@@ -490,7 +490,14 @@ SUBROUTINE SLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL,
490490
CALL SROT( 1, VF( JPREV ), 1, VF( J ), 1, C, S )
491491
CALL SROT( 1, VL( JPREV ), 1, VL( J ), 1, C, S )
492492
K2 = K2 - 1
493-
IDXP( K2 ) = JPREV
493+
*
494+
* Insert the deflated index in the correct position in IDXP.
495+
* If J - JPREV is greater than 1, the indices in between
496+
* must be shifted to preserve the correct output order.
497+
*
498+
DO 85 JP = JPREV, J - 1
499+
IDXP( K2 + J - 1 - JP ) = JP
500+
85 CONTINUE
494501
JPREV = J
495502
ELSE
496503
K = K + 1

0 commit comments

Comments
 (0)