**** Correct bug 125 ****
authorlangou <langou@users.noreply.github.com>
Wed, 25 Mar 2015 22:45:19 +0000 (22:45 +0000)
committerlangou <langou@users.noreply.github.com>
Wed, 25 Mar 2015 22:45:19 +0000 (22:45 +0000)
Change the maximum number of QR iterations (ITMAX) for xLAHQR from ITMAX=30 to
ITMAX = 30 * MAX( 10, NH ).

Bug reported by Yoshihide Okimi on July 16, 2014
https://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4566
and, independently, by Marco Caliari (Università di Verona) on February 11,
2015.

Involved in bug fix: Yoshihide Okimi, Marco Caliari (Università di Verona),
Meiyue Shao (LBL), Julien Langou, and Daniel Kressner (EPFL).

** Bug **

xLAHQR v3.5 does not converge on some matrices while xLAHQR v2 converges

** Note **

xLAHQR v2 is available through ARPACK so xLAHQR v2 is still in "wide" use

** Description **

xLAQR0 v3.5 and xLAQR4 v3.5 have ITMAX set to:
    ITMAX = MAX( 30, 2*KEXSH )*MAX( 10, ( IHI-ILO+1 ) )

xLAHQR v2 has ITMAX set to:
    ITMAX = 30 * NH

xLAHQR v3.5 has ITMAX set to:
    ITMAX = 30

Yoshihide Okimi reports that, in his application, (1) xLAHQR v3.5 does not
converge, (2) xLAHQR v2 converges, (3) changing ITMAX to 30*NH in xLAHQR v3.5
enables convergence.

Marco Caliari reports that, in his application, using xLAHQR v2.0 converges,
while xLAHQR v3.5 does not converge.

** Bug fix **

Set ITMAX in xLAHQR to
    ITMAX = 30 * MAX( 10, NH )

Email from Meiyue: I feel that setting ITMAX proportional to NH makes sense.
Perhaps we can change ITMAX to ITMAX*MAX( 10, NH ) so that it is also safe for
ill-conditioned tiny matrices.

SRC/clahqr.f
SRC/dlahqr.f
SRC/slahqr.f
SRC/zlahqr.f

index b99cb69..ad9dafb 100644 (file)
 *  =========================================================
 *
 *     .. Parameters ..
-      INTEGER            ITMAX
-      PARAMETER          ( ITMAX = 30 )
       COMPLEX            ZERO, ONE
       PARAMETER          ( ZERO = ( 0.0e0, 0.0e0 ),
      $                   ONE = ( 1.0e0, 0.0e0 ) )
      $                   V2, X, Y
       REAL               AA, AB, BA, BB, H10, H21, RTEMP, S, SAFMAX,
      $                   SAFMIN, SMLNUM, SX, T2, TST, ULP
-      INTEGER            I, I1, I2, ITS, J, JHI, JLO, K, L, M, NH, NZ
+      INTEGER            I, I1, I2, ITS, ITMAX, J, JHI, JLO, K, L, M,
+     $                   NH, NZ
 *     ..
 *     .. Local Arrays ..
       COMPLEX            V( 2 )
          I2 = N
       END IF
 *
+*     ITMAX is the total number of QR iterations allowed.
+*
+      ITMAX = 30 * MAX( 10, NH ) 
+*
 *     The main loop begins here. I is the loop index and decreases from
 *     IHI to ILO in steps of 1. Each iteration of the loop works
 *     with the active submatrix in rows and columns L to I.
index 9da6b0f..d1a6765 100644 (file)
 *  =========================================================
 *
 *     .. Parameters ..
-      INTEGER            ITMAX
-      PARAMETER          ( ITMAX = 30 )
       DOUBLE PRECISION   ZERO, ONE, TWO
       PARAMETER          ( ZERO = 0.0d0, ONE = 1.0d0, TWO = 2.0d0 )
       DOUBLE PRECISION   DAT1, DAT2
      $                   H22, RT1I, RT1R, RT2I, RT2R, RTDISC, S, SAFMAX,
      $                   SAFMIN, SMLNUM, SN, SUM, T1, T2, T3, TR, TST,
      $                   ULP, V2, V3
-      INTEGER            I, I1, I2, ITS, J, K, L, M, NH, NR, NZ
+      INTEGER            I, I1, I2, ITS, ITMAX, J, K, L, M, NH, NR, NZ
 *     ..
 *     .. Local Arrays ..
       DOUBLE PRECISION   V( 3 )
          I2 = N
       END IF
 *
+*     ITMAX is the total number of QR iterations allowed.
+*
+      ITMAX = 30 * MAX( 10, NH ) 
+*
 *     The main loop begins here. I is the loop index and decreases from
 *     IHI to ILO in steps of 1 or 2. Each iteration of the loop works
 *     with the active submatrix in rows and columns L to I.
index b3caf68..f88fac8 100644 (file)
 *  =========================================================
 *
 *     .. Parameters ..
-      INTEGER            ITMAX
-      PARAMETER          ( ITMAX = 30 )
       REAL               ZERO, ONE, TWO
       PARAMETER          ( ZERO = 0.0e0, ONE = 1.0e0, TWO = 2.0e0 )
       REAL               DAT1, DAT2
      $                   H22, RT1I, RT1R, RT2I, RT2R, RTDISC, S, SAFMAX,
      $                   SAFMIN, SMLNUM, SN, SUM, T1, T2, T3, TR, TST,
      $                   ULP, V2, V3
-      INTEGER            I, I1, I2, ITS, J, K, L, M, NH, NR, NZ
+      INTEGER            I, I1, I2, ITS, ITMAX, J, K, L, M, NH, NR, NZ
 *     ..
 *     .. Local Arrays ..
       REAL               V( 3 )
          I2 = N
       END IF
 *
+*     ITMAX is the total number of QR iterations allowed.
+*
+      ITMAX = 30 * MAX( 10, NH ) 
+*
 *     The main loop begins here. I is the loop index and decreases from
 *     IHI to ILO in steps of 1 or 2. Each iteration of the loop works
 *     with the active submatrix in rows and columns L to I.
index 344a9f8..5249654 100644 (file)
 *  =========================================================
 *
 *     .. Parameters ..
-      INTEGER            ITMAX
-      PARAMETER          ( ITMAX = 30 )
       COMPLEX*16         ZERO, ONE
       PARAMETER          ( ZERO = ( 0.0d0, 0.0d0 ),
      $                   ONE = ( 1.0d0, 0.0d0 ) )
      $                   V2, X, Y
       DOUBLE PRECISION   AA, AB, BA, BB, H10, H21, RTEMP, S, SAFMAX,
      $                   SAFMIN, SMLNUM, SX, T2, TST, ULP
-      INTEGER            I, I1, I2, ITS, J, JHI, JLO, K, L, M, NH, NZ
+      INTEGER            I, I1, I2, ITS, ITMAX, J, JHI, JLO, K, L, M,
+     $                   NH, NZ
 *     ..
 *     .. Local Arrays ..
       COMPLEX*16         V( 2 )
          I2 = N
       END IF
 *
+*     ITMAX is the total number of QR iterations allowed.
+*
+      ITMAX = 30 * MAX( 10, NH ) 
+*
 *     The main loop begins here. I is the loop index and decreases from
 *     IHI to ILO in steps of 1. Each iteration of the loop works
 *     with the active submatrix in rows and columns L to I.