1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
      SUBROUTINE CLATM6TYPENALDABXLDXYLDYALPHA,
     $                   BETAWXWYSDIF )
*
*  -- LAPACK test routine (version 3.1) --
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
*     June 2010
*
*     .. Scalar Arguments ..
      INTEGER            LDALDXLDYNTYPE
      COMPLEX            ALPHABETAWXWY
*     ..
*     .. Array Arguments ..
      REAL               DIF* ), S* )
      COMPLEX            ALDA* ), BLDA* ), XLDX* ),
     $                   YLDY* )
*     ..
*
*  Purpose
*  =======
*
*  CLATM6 generates test matrices for the generalized eigenvalue
*  problem, their corresponding right and left eigenvector matrices,
*  and also reciprocal condition numbers for all eigenvalues and
*  the reciprocal condition numbers of eigenvectors corresponding to
*  the 1th and 5th eigenvalues.
*
*  Test Matrices
*  =============
*
*  Two kinds of test matrix pairs
*           (A, B) = inverse(YH) * (Da, Db) * inverse(X)
*  are used in the tests:
*
*  Type 1:
*     Da = 1+a   0    0    0    0    Db = 1   0   0   0   0
*           0   2+a   0    0    0         0   1   0   0   0
*           0    0   3+a   0    0         0   0   1   0   0
*           0    0    0   4+a   0         0   0   0   1   0
*           0    0    0    0   5+a ,      0   0   0   0   1
*  and Type 2:
*     Da = 1+i   0    0       0       0    Db = 1   0   0   0   0
*           0   1-i   0       0       0         0   1   0   0   0
*           0    0    1       0       0         0   0   1   0   0
*           0    0    0 (1+a)+(1+b)i  0         0   0   0   1   0
*           0    0    0       0 (1+a)-(1+b)i,   0   0   0   0   1 .
*
*  In both cases the same inverse(YH) and inverse(X) are used to compute
*  (A, B), giving the exact eigenvectors to (A,B) as (YH, X):
*
*  YH:  =  1    0   -y    y   -y    X =  1   0  -x  -x   x
*          0    1   -y    y   -y         0   1   x  -x  -x
*          0    0    1    0    0         0   0   1   0   0
*          0    0    0    1    0         0   0   0   1   0
*          0    0    0    0    1,        0   0   0   0   1 , where
*
*  a, b, x and y will have all values independently of each other.
*
*  Arguments
*  =========
*
*  TYPE    (input) INTEGER
*          Specifies the problem type (see futher details).
*
*  N       (input) INTEGER
*          Size of the matrices A and B.
*
*  A       (output) COMPLEX array, dimension (LDA, N).
*          On exit A N-by-N is initialized according to TYPE.
*
*  LDA     (input) INTEGER
*          The leading dimension of A and of B.
*
*  B       (output) COMPLEX array, dimension (LDA, N).
*          On exit B N-by-N is initialized according to TYPE.
*
*  X       (output) COMPLEX array, dimension (LDX, N).
*          On exit X is the N-by-N matrix of right eigenvectors.
*
*  LDX     (input) INTEGER
*          The leading dimension of X.
*
*  Y       (output) COMPLEX array, dimension (LDY, N).
*          On exit Y is the N-by-N matrix of left eigenvectors.
*
*  LDY     (input) INTEGER
*          The leading dimension of Y.
*
*  ALPHA   (input) COMPLEX
*
*  BETA    (input) COMPLEX
*          Weighting constants for matrix A.
*
*  WX      (input) COMPLEX
*          Constant for right eigenvector matrix.
*
*  WY      (input) COMPLEX
*          Constant for left eigenvector matrix.
*
*  S       (output) REAL array, dimension (N)
*          S(i) is the reciprocal condition number for eigenvalue i.
*
*  DIF     (output) REAL array, dimension (N)
*          DIF(i) is the reciprocal condition number for eigenvector i.
*
*  =====================================================================
*
*     .. Parameters ..
      REAL               RONETWOTHREE
      PARAMETER          ( RONE = 1.0E+0TWO = 2.0E+0THREE = 3.0E+0 )
      COMPLEX            ZEROONE
      PARAMETER          ( ZERO = ( 0.0E+00.0E+0 ),
     $                   ONE = ( 1.0E+00.0E+0 ) )
*     ..
*     .. Local Scalars ..
      INTEGER            IINFOJ
*     ..
*     .. Local Arrays ..
      REAL               RWORK50 )
      COMPLEX            WORK26 ), Z88 )
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          CABSCMPLXCONJGREALSQRT
*     ..
*     .. External Subroutines ..
      EXTERNAL           CGESVDCLACPYCLAKF2
*     ..
*     .. Executable Statements ..
*
*     Generate test problem ...
*     (Da, Db) ...
*
      DO 20 I = 1N
         DO 10 J = 1N
*
            IFI.EQ.J ) THEN
               AII ) = CMPLXI ) + ALPHA
               BII ) = ONE
            ELSE
               AIJ ) = ZERO
               BIJ ) = ZERO
            END IF
*
   10    CONTINUE
   20 CONTINUE
      IFTYPE.EQ.2 ) THEN
         A11 ) = CMPLXRONERONE )
         A22 ) = CONJGA11 ) )
         A33 ) = ONE
         A44 ) = CMPLXREALONE+ALPHA ), REALONE+BETA ) )
         A55 ) = CONJGA44 ) )
      END IF
*
*     Form X and Y
*
      CALL CLACPY'F'NNBLDAYLDY )
      Y31 ) = -CONJGWY )
      Y41 ) = CONJGWY )
      Y51 ) = -CONJGWY )
      Y32 ) = -CONJGWY )
      Y42 ) = CONJGWY )
      Y52 ) = -CONJGWY )
*
      CALL CLACPY'F'NNBLDAXLDX )
      X13 ) = -WX
      X14 ) = -WX
      X15 ) = WX
      X23 ) = WX
      X24 ) = -WX
      X25 ) = -WX
*
*     Form (A, B)
*
      B13 ) = WX + WY
      B23 ) = -WX + WY
      B14 ) = WX - WY
      B24 ) = WX - WY
      B15 ) = -WX + WY
      B25 ) = WX + WY
      A13 ) = WX*A11 ) + WY*A33 )
      A23 ) = -WX*A22 ) + WY*A33 )
      A14 ) = WX*A11 ) - WY*A44 )
      A24 ) = WX*A22 ) - WY*A44 )
      A15 ) = -WX*A11 ) + WY*A55 )
      A25 ) = WX*A22 ) + WY*A55 )
*
*     Compute condition numbers
*
      S1 ) = RONE / SQRT( ( RONE+THREE*CABSWY )*CABSWY ) ) /
     $         ( RONE+CABSA11 ) )*CABSA11 ) ) ) )
      S2 ) = RONE / SQRT( ( RONE+THREE*CABSWY )*CABSWY ) ) /
     $         ( RONE+CABSA22 ) )*CABSA22 ) ) ) )
      S3 ) = RONE / SQRT( ( RONE+TWO*CABSWX )*CABSWX ) ) /
     $         ( RONE+CABSA33 ) )*CABSA33 ) ) ) )
      S4 ) = RONE / SQRT( ( RONE+TWO*CABSWX )*CABSWX ) ) /
     $         ( RONE+CABSA44 ) )*CABSA44 ) ) ) )
      S5 ) = RONE / SQRT( ( RONE+TWO*CABSWX )*CABSWX ) ) /
     $         ( RONE+CABSA55 ) )*CABSA55 ) ) ) )
*
      CALL CLAKF214ALDAA22 ), BB22 ), Z8 )
      CALL CGESVD'N''N'88Z8RWORKWORK1WORK2 ), 1,
     $             WORK3 ), 24RWORK9 ), INFO )
      DIF1 ) = RWORK8 )
*
      CALL CLAKF241ALDAA55 ), BB55 ), Z8 )
      CALL CGESVD'N''N'88Z8RWORKWORK1WORK2 ), 1,
     $             WORK3 ), 24RWORK9 ), INFO )
      DIF5 ) = RWORK8 )
*
      RETURN
*
*     End of CLATM6
*
      END