Skip to content

Commit dcb2895

Browse files
authored
Merge pull request #5344 from MaartenBaert/fix-dlasd7
LAPACK: Fix documentation error and ordering bug in DLASD7
2 parents 334cd24 + b37889e commit dcb2895

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lapack-netlib/SRC/dlasd7.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 DLASD7( 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 DLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL,
490490
CALL DROT( 1, VF( JPREV ), 1, VF( J ), 1, C, S )
491491
CALL DROT( 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 130 JP = JPREV, J - 1
499+
IDXP( K2 + J - 1 - JP ) = JP
500+
130 CONTINUE
494501
JPREV = J
495502
ELSE
496503
K = K + 1

0 commit comments

Comments
 (0)