Skip to content

Commit d1f15f5

Browse files
author
Maarten Baert
committed
Fix documentation error and ordering bug in DLASD7
1 parent 49ff177 commit d1f15f5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

SRC/dlasd7.f

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
*> On entry D contains the singular values of the two submatrices
100100
*> to be combined. On exit D contains the trailing (N-K) updated
101101
*> singular values (those which were deflated) sorted into
102-
*> increasing order.
102+
*> decreasing order.
103103
*> \endverbatim
104104
*>
105105
*> \param[out] Z
@@ -453,7 +453,7 @@ SUBROUTINE DLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW,
453453
*
454454
* Check if singular values are close enough to allow deflation.
455455
*
456-
IF( ABS( D( J )-D( JPREV ) ).LE.TOL ) THEN
456+
IF( ( D( J )-D( JPREV ) ).LE.TOL ) THEN
457457
*
458458
* Deflation is possible.
459459
*
@@ -489,7 +489,14 @@ SUBROUTINE DLASD7( ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW,
489489
CALL DROT( 1, VF( JPREV ), 1, VF( J ), 1, C, S )
490490
CALL DROT( 1, VL( JPREV ), 1, VL( J ), 1, C, S )
491491
K2 = K2 - 1
492-
IDXP( K2 ) = JPREV
492+
*
493+
* Insert the deflated index in the correct position in IDXP.
494+
* If J - JPREV is greater than 1, the indices in between
495+
* must be shifted to preserve the correct output order.
496+
*
497+
DO 130 JP = JPREV, J - 1
498+
IDXP( K2 + J - 1 - JP ) = JP
499+
130 CONTINUE
493500
JPREV = J
494501
ELSE
495502
K = K + 1

0 commit comments

Comments
 (0)