LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE CLATM6( TYPE, N, A, LDA, B, X, LDX, Y, LDY, ALPHA, 00002 $ BETA, WX, WY, S, DIF ) 00003 * 00004 * -- LAPACK test routine (version 3.1) -- 00005 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. 00006 * June 2010 00007 * 00008 * .. Scalar Arguments .. 00009 INTEGER LDA, LDX, LDY, N, TYPE 00010 COMPLEX ALPHA, BETA, WX, WY 00011 * .. 00012 * .. Array Arguments .. 00013 REAL DIF( * ), S( * ) 00014 COMPLEX A( LDA, * ), B( LDA, * ), X( LDX, * ), 00015 $ Y( LDY, * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * CLATM6 generates test matrices for the generalized eigenvalue 00022 * problem, their corresponding right and left eigenvector matrices, 00023 * and also reciprocal condition numbers for all eigenvalues and 00024 * the reciprocal condition numbers of eigenvectors corresponding to 00025 * the 1th and 5th eigenvalues. 00026 * 00027 * Test Matrices 00028 * ============= 00029 * 00030 * Two kinds of test matrix pairs 00031 * (A, B) = inverse(YH) * (Da, Db) * inverse(X) 00032 * are used in the tests: 00033 * 00034 * Type 1: 00035 * Da = 1+a 0 0 0 0 Db = 1 0 0 0 0 00036 * 0 2+a 0 0 0 0 1 0 0 0 00037 * 0 0 3+a 0 0 0 0 1 0 0 00038 * 0 0 0 4+a 0 0 0 0 1 0 00039 * 0 0 0 0 5+a , 0 0 0 0 1 00040 * and Type 2: 00041 * Da = 1+i 0 0 0 0 Db = 1 0 0 0 0 00042 * 0 1-i 0 0 0 0 1 0 0 0 00043 * 0 0 1 0 0 0 0 1 0 0 00044 * 0 0 0 (1+a)+(1+b)i 0 0 0 0 1 0 00045 * 0 0 0 0 (1+a)-(1+b)i, 0 0 0 0 1 . 00046 * 00047 * In both cases the same inverse(YH) and inverse(X) are used to compute 00048 * (A, B), giving the exact eigenvectors to (A,B) as (YH, X): 00049 * 00050 * YH: = 1 0 -y y -y X = 1 0 -x -x x 00051 * 0 1 -y y -y 0 1 x -x -x 00052 * 0 0 1 0 0 0 0 1 0 0 00053 * 0 0 0 1 0 0 0 0 1 0 00054 * 0 0 0 0 1, 0 0 0 0 1 , where 00055 * 00056 * a, b, x and y will have all values independently of each other. 00057 * 00058 * Arguments 00059 * ========= 00060 * 00061 * TYPE (input) INTEGER 00062 * Specifies the problem type (see futher details). 00063 * 00064 * N (input) INTEGER 00065 * Size of the matrices A and B. 00066 * 00067 * A (output) COMPLEX array, dimension (LDA, N). 00068 * On exit A N-by-N is initialized according to TYPE. 00069 * 00070 * LDA (input) INTEGER 00071 * The leading dimension of A and of B. 00072 * 00073 * B (output) COMPLEX array, dimension (LDA, N). 00074 * On exit B N-by-N is initialized according to TYPE. 00075 * 00076 * X (output) COMPLEX array, dimension (LDX, N). 00077 * On exit X is the N-by-N matrix of right eigenvectors. 00078 * 00079 * LDX (input) INTEGER 00080 * The leading dimension of X. 00081 * 00082 * Y (output) COMPLEX array, dimension (LDY, N). 00083 * On exit Y is the N-by-N matrix of left eigenvectors. 00084 * 00085 * LDY (input) INTEGER 00086 * The leading dimension of Y. 00087 * 00088 * ALPHA (input) COMPLEX 00089 * 00090 * BETA (input) COMPLEX 00091 * Weighting constants for matrix A. 00092 * 00093 * WX (input) COMPLEX 00094 * Constant for right eigenvector matrix. 00095 * 00096 * WY (input) COMPLEX 00097 * Constant for left eigenvector matrix. 00098 * 00099 * S (output) REAL array, dimension (N) 00100 * S(i) is the reciprocal condition number for eigenvalue i. 00101 * 00102 * DIF (output) REAL array, dimension (N) 00103 * DIF(i) is the reciprocal condition number for eigenvector i. 00104 * 00105 * ===================================================================== 00106 * 00107 * .. Parameters .. 00108 REAL RONE, TWO, THREE 00109 PARAMETER ( RONE = 1.0E+0, TWO = 2.0E+0, THREE = 3.0E+0 ) 00110 COMPLEX ZERO, ONE 00111 PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ), 00112 $ ONE = ( 1.0E+0, 0.0E+0 ) ) 00113 * .. 00114 * .. Local Scalars .. 00115 INTEGER I, INFO, J 00116 * .. 00117 * .. Local Arrays .. 00118 REAL RWORK( 50 ) 00119 COMPLEX WORK( 26 ), Z( 8, 8 ) 00120 * .. 00121 * .. Intrinsic Functions .. 00122 INTRINSIC CABS, CMPLX, CONJG, REAL, SQRT 00123 * .. 00124 * .. External Subroutines .. 00125 EXTERNAL CGESVD, CLACPY, CLAKF2 00126 * .. 00127 * .. Executable Statements .. 00128 * 00129 * Generate test problem ... 00130 * (Da, Db) ... 00131 * 00132 DO 20 I = 1, N 00133 DO 10 J = 1, N 00134 * 00135 IF( I.EQ.J ) THEN 00136 A( I, I ) = CMPLX( I ) + ALPHA 00137 B( I, I ) = ONE 00138 ELSE 00139 A( I, J ) = ZERO 00140 B( I, J ) = ZERO 00141 END IF 00142 * 00143 10 CONTINUE 00144 20 CONTINUE 00145 IF( TYPE.EQ.2 ) THEN 00146 A( 1, 1 ) = CMPLX( RONE, RONE ) 00147 A( 2, 2 ) = CONJG( A( 1, 1 ) ) 00148 A( 3, 3 ) = ONE 00149 A( 4, 4 ) = CMPLX( REAL( ONE+ALPHA ), REAL( ONE+BETA ) ) 00150 A( 5, 5 ) = CONJG( A( 4, 4 ) ) 00151 END IF 00152 * 00153 * Form X and Y 00154 * 00155 CALL CLACPY( 'F', N, N, B, LDA, Y, LDY ) 00156 Y( 3, 1 ) = -CONJG( WY ) 00157 Y( 4, 1 ) = CONJG( WY ) 00158 Y( 5, 1 ) = -CONJG( WY ) 00159 Y( 3, 2 ) = -CONJG( WY ) 00160 Y( 4, 2 ) = CONJG( WY ) 00161 Y( 5, 2 ) = -CONJG( WY ) 00162 * 00163 CALL CLACPY( 'F', N, N, B, LDA, X, LDX ) 00164 X( 1, 3 ) = -WX 00165 X( 1, 4 ) = -WX 00166 X( 1, 5 ) = WX 00167 X( 2, 3 ) = WX 00168 X( 2, 4 ) = -WX 00169 X( 2, 5 ) = -WX 00170 * 00171 * Form (A, B) 00172 * 00173 B( 1, 3 ) = WX + WY 00174 B( 2, 3 ) = -WX + WY 00175 B( 1, 4 ) = WX - WY 00176 B( 2, 4 ) = WX - WY 00177 B( 1, 5 ) = -WX + WY 00178 B( 2, 5 ) = WX + WY 00179 A( 1, 3 ) = WX*A( 1, 1 ) + WY*A( 3, 3 ) 00180 A( 2, 3 ) = -WX*A( 2, 2 ) + WY*A( 3, 3 ) 00181 A( 1, 4 ) = WX*A( 1, 1 ) - WY*A( 4, 4 ) 00182 A( 2, 4 ) = WX*A( 2, 2 ) - WY*A( 4, 4 ) 00183 A( 1, 5 ) = -WX*A( 1, 1 ) + WY*A( 5, 5 ) 00184 A( 2, 5 ) = WX*A( 2, 2 ) + WY*A( 5, 5 ) 00185 * 00186 * Compute condition numbers 00187 * 00188 S( 1 ) = RONE / SQRT( ( RONE+THREE*CABS( WY )*CABS( WY ) ) / 00189 $ ( RONE+CABS( A( 1, 1 ) )*CABS( A( 1, 1 ) ) ) ) 00190 S( 2 ) = RONE / SQRT( ( RONE+THREE*CABS( WY )*CABS( WY ) ) / 00191 $ ( RONE+CABS( A( 2, 2 ) )*CABS( A( 2, 2 ) ) ) ) 00192 S( 3 ) = RONE / SQRT( ( RONE+TWO*CABS( WX )*CABS( WX ) ) / 00193 $ ( RONE+CABS( A( 3, 3 ) )*CABS( A( 3, 3 ) ) ) ) 00194 S( 4 ) = RONE / SQRT( ( RONE+TWO*CABS( WX )*CABS( WX ) ) / 00195 $ ( RONE+CABS( A( 4, 4 ) )*CABS( A( 4, 4 ) ) ) ) 00196 S( 5 ) = RONE / SQRT( ( RONE+TWO*CABS( WX )*CABS( WX ) ) / 00197 $ ( RONE+CABS( A( 5, 5 ) )*CABS( A( 5, 5 ) ) ) ) 00198 * 00199 CALL CLAKF2( 1, 4, A, LDA, A( 2, 2 ), B, B( 2, 2 ), Z, 8 ) 00200 CALL CGESVD( 'N', 'N', 8, 8, Z, 8, RWORK, WORK, 1, WORK( 2 ), 1, 00201 $ WORK( 3 ), 24, RWORK( 9 ), INFO ) 00202 DIF( 1 ) = RWORK( 8 ) 00203 * 00204 CALL CLAKF2( 4, 1, A, LDA, A( 5, 5 ), B, B( 5, 5 ), Z, 8 ) 00205 CALL CGESVD( 'N', 'N', 8, 8, Z, 8, RWORK, WORK, 1, WORK( 2 ), 1, 00206 $ WORK( 3 ), 24, RWORK( 9 ), INFO ) 00207 DIF( 5 ) = RWORK( 8 ) 00208 * 00209 RETURN 00210 * 00211 * End of CLATM6 00212 * 00213 END