summaryrefslogtreecommitdiff
path: root/SRC/cstedc.f
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2015-10-22 04:39:19 +0000
committerjulie <julielangou@users.noreply.github.com>2015-10-22 04:39:19 +0000
commit6d3c6b3d719c4fa38f8321e398a8ab142c124f22 (patch)
treeffda9dbbfb739b23789a2f0e5056e8960acec387 /SRC/cstedc.f
parent2491c9367a9c5e827a935679a4755387b348e159 (diff)
downloadlapack-6d3c6b3d719c4fa38f8321e398a8ab142c124f22.tar.gz
lapack-6d3c6b3d719c4fa38f8321e398a8ab142c124f22.tar.bz2
lapack-6d3c6b3d719c4fa38f8321e398a8ab142c124f22.zip
Fix bug 139 submitted by Christoph Conrads on Oct 6th 2015
"according to the LAPACK documentation, xSTEDC guarantees to return the eigenvalues in ascending order (parameter D on exit). To this end, it sorts the eigenvalues if necessary. If there is only a single subproblem of size n, no sorting algorithm is called (cf. {s,d}tedc.f, line 450). Furthermore, xLAED0 ({s,d}tedc.f:400) does not guarantee to return eigenvalues in ascending order. Thus, xSTEDC may return eigenvalues that are not in ascending order." Applied patch provided by Christoph Conrads: "always sorting the eigenvalues"
Diffstat (limited to 'SRC/cstedc.f')
-rw-r--r--SRC/cstedc.f44
1 files changed, 19 insertions, 25 deletions
diff --git a/SRC/cstedc.f b/SRC/cstedc.f
index 5bf442fa..acaae582 100644
--- a/SRC/cstedc.f
+++ b/SRC/cstedc.f
@@ -453,31 +453,25 @@
*
* endwhile
*
-* If the problem split any number of times, then the eigenvalues
-* will not be properly ordered. Here we permute the eigenvalues
-* (and the associated eigenvectors) into ascending order.
-*
- IF( M.NE.N ) THEN
-*
-* Use Selection Sort to minimize swaps of eigenvectors
-*
- DO 60 II = 2, N
- I = II - 1
- K = I
- P = D( I )
- DO 50 J = II, N
- IF( D( J ).LT.P ) THEN
- K = J
- P = D( J )
- END IF
- 50 CONTINUE
- IF( K.NE.I ) THEN
- D( K ) = D( I )
- D( I ) = P
- CALL CSWAP( N, Z( 1, I ), 1, Z( 1, K ), 1 )
- END IF
- 60 CONTINUE
- END IF
+*
+* Use Selection Sort to minimize swaps of eigenvectors
+*
+ DO 60 II = 2, N
+ I = II - 1
+ K = I
+ P = D( I )
+ DO 50 J = II, N
+ IF( D( J ).LT.P ) THEN
+ K = J
+ P = D( J )
+ END IF
+ 50 CONTINUE
+ IF( K.NE.I ) THEN
+ D( K ) = D( I )
+ D( I ) = P
+ CALL CSWAP( N, Z( 1, I ), 1, Z( 1, K ), 1 )
+ END IF
+ 60 CONTINUE
END IF
*
70 CONTINUE