Skip to content

Commit 3a7690c

Browse files
#826: Correct bug in dstemr.f
1 parent e2428ec commit 3a7690c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SRC/dstemr.f

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,19 @@ SUBROUTINE DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
502502
ELSE IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN
503503
CALL DLAEV2( D(1), E(1), D(2), R1, R2, CS, SN )
504504
END IF
505+
* DLAE2 and DLAEV2 outputs satisfy |R1| >= |R2|. However,
506+
* the following DSTEMR requires R1 >= R2. Hence, we correct
507+
* the order of R1, R2, CS, SN if R1 < R2 before further processing.
508+
IF(R1.LT.R2) THEN
509+
E(2) = R1
510+
R1 = R2
511+
R2 = E(2)
512+
IF(WANTZ.AND.(.NOT.ZQUERY)) THEN
513+
E(2) = CS
514+
CS = -SN
515+
SN = E(2)
516+
ENDIF
517+
ENDIF
505518
IF( ALLEIG.OR.
506519
$ (VALEIG.AND.(R2.GT.WL).AND.
507520
$ (R2.LE.WU)).OR.

0 commit comments

Comments
 (0)