LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE ZGET51( ITYPE, N, A, LDA, B, LDB, U, LDU, V, LDV, WORK, 00002 $ RWORK, RESULT ) 00003 * 00004 * -- LAPACK test routine (version 3.1) -- 00005 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 INTEGER ITYPE, LDA, LDB, LDU, LDV, N 00010 DOUBLE PRECISION RESULT 00011 * .. 00012 * .. Array Arguments .. 00013 DOUBLE PRECISION RWORK( * ) 00014 COMPLEX*16 A( LDA, * ), B( LDB, * ), U( LDU, * ), 00015 $ V( LDV, * ), WORK( * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * ZGET51 generally checks a decomposition of the form 00022 * 00023 * A = U B V* 00024 * 00025 * where * means conjugate transpose and U and V are unitary. 00026 * 00027 * Specifically, if ITYPE=1 00028 * 00029 * RESULT = | A - U B V* | / ( |A| n ulp ) 00030 * 00031 * If ITYPE=2, then: 00032 * 00033 * RESULT = | A - B | / ( |A| n ulp ) 00034 * 00035 * If ITYPE=3, then: 00036 * 00037 * RESULT = | I - UU* | / ( n ulp ) 00038 * 00039 * Arguments 00040 * ========= 00041 * 00042 * ITYPE (input) INTEGER 00043 * Specifies the type of tests to be performed. 00044 * =1: RESULT = | A - U B V* | / ( |A| n ulp ) 00045 * =2: RESULT = | A - B | / ( |A| n ulp ) 00046 * =3: RESULT = | I - UU* | / ( n ulp ) 00047 * 00048 * N (input) INTEGER 00049 * The size of the matrix. If it is zero, ZGET51 does nothing. 00050 * It must be at least zero. 00051 * 00052 * A (input) COMPLEX*16 array, dimension (LDA, N) 00053 * The original (unfactored) matrix. 00054 * 00055 * LDA (input) INTEGER 00056 * The leading dimension of A. It must be at least 1 00057 * and at least N. 00058 * 00059 * B (input) COMPLEX*16 array, dimension (LDB, N) 00060 * The factored matrix. 00061 * 00062 * LDB (input) INTEGER 00063 * The leading dimension of B. It must be at least 1 00064 * and at least N. 00065 * 00066 * U (input) COMPLEX*16 array, dimension (LDU, N) 00067 * The unitary matrix on the left-hand side in the 00068 * decomposition. 00069 * Not referenced if ITYPE=2 00070 * 00071 * LDU (input) INTEGER 00072 * The leading dimension of U. LDU must be at least N and 00073 * at least 1. 00074 * 00075 * V (input) COMPLEX*16 array, dimension (LDV, N) 00076 * The unitary matrix on the left-hand side in the 00077 * decomposition. 00078 * Not referenced if ITYPE=2 00079 * 00080 * LDV (input) INTEGER 00081 * The leading dimension of V. LDV must be at least N and 00082 * at least 1. 00083 * 00084 * WORK (workspace) COMPLEX*16 array, dimension (2*N**2) 00085 * 00086 * RWORK (workspace) DOUBLE PRECISION array, dimension (N) 00087 * 00088 * RESULT (output) DOUBLE PRECISION 00089 * The values computed by the test specified by ITYPE. The 00090 * value is currently limited to 1/ulp, to avoid overflow. 00091 * Errors are flagged by RESULT=10/ulp. 00092 * 00093 * ===================================================================== 00094 * 00095 * .. Parameters .. 00096 DOUBLE PRECISION ZERO, ONE, TEN 00097 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TEN = 10.0D+0 ) 00098 COMPLEX*16 CZERO, CONE 00099 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ), 00100 $ CONE = ( 1.0D+0, 0.0D+0 ) ) 00101 * .. 00102 * .. Local Scalars .. 00103 INTEGER JCOL, JDIAG, JROW 00104 DOUBLE PRECISION ANORM, ULP, UNFL, WNORM 00105 * .. 00106 * .. External Functions .. 00107 DOUBLE PRECISION DLAMCH, ZLANGE 00108 EXTERNAL DLAMCH, ZLANGE 00109 * .. 00110 * .. External Subroutines .. 00111 EXTERNAL ZGEMM, ZLACPY 00112 * .. 00113 * .. Intrinsic Functions .. 00114 INTRINSIC DBLE, MAX, MIN 00115 * .. 00116 * .. Executable Statements .. 00117 * 00118 RESULT = ZERO 00119 IF( N.LE.0 ) 00120 $ RETURN 00121 * 00122 * Constants 00123 * 00124 UNFL = DLAMCH( 'Safe minimum' ) 00125 ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' ) 00126 * 00127 * Some Error Checks 00128 * 00129 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN 00130 RESULT = TEN / ULP 00131 RETURN 00132 END IF 00133 * 00134 IF( ITYPE.LE.2 ) THEN 00135 * 00136 * Tests scaled by the norm(A) 00137 * 00138 ANORM = MAX( ZLANGE( '1', N, N, A, LDA, RWORK ), UNFL ) 00139 * 00140 IF( ITYPE.EQ.1 ) THEN 00141 * 00142 * ITYPE=1: Compute W = A - UBV' 00143 * 00144 CALL ZLACPY( ' ', N, N, A, LDA, WORK, N ) 00145 CALL ZGEMM( 'N', 'N', N, N, N, CONE, U, LDU, B, LDB, CZERO, 00146 $ WORK( N**2+1 ), N ) 00147 * 00148 CALL ZGEMM( 'N', 'C', N, N, N, -CONE, WORK( N**2+1 ), N, V, 00149 $ LDV, CONE, WORK, N ) 00150 * 00151 ELSE 00152 * 00153 * ITYPE=2: Compute W = A - B 00154 * 00155 CALL ZLACPY( ' ', N, N, B, LDB, WORK, N ) 00156 * 00157 DO 20 JCOL = 1, N 00158 DO 10 JROW = 1, N 00159 WORK( JROW+N*( JCOL-1 ) ) = WORK( JROW+N*( JCOL-1 ) ) 00160 $ - A( JROW, JCOL ) 00161 10 CONTINUE 00162 20 CONTINUE 00163 END IF 00164 * 00165 * Compute norm(W)/ ( ulp*norm(A) ) 00166 * 00167 WNORM = ZLANGE( '1', N, N, WORK, N, RWORK ) 00168 * 00169 IF( ANORM.GT.WNORM ) THEN 00170 RESULT = ( WNORM / ANORM ) / ( N*ULP ) 00171 ELSE 00172 IF( ANORM.LT.ONE ) THEN 00173 RESULT = ( MIN( WNORM, N*ANORM ) / ANORM ) / ( N*ULP ) 00174 ELSE 00175 RESULT = MIN( WNORM / ANORM, DBLE( N ) ) / ( N*ULP ) 00176 END IF 00177 END IF 00178 * 00179 ELSE 00180 * 00181 * Tests not scaled by norm(A) 00182 * 00183 * ITYPE=3: Compute UU' - I 00184 * 00185 CALL ZGEMM( 'N', 'C', N, N, N, CONE, U, LDU, U, LDU, CZERO, 00186 $ WORK, N ) 00187 * 00188 DO 30 JDIAG = 1, N 00189 WORK( ( N+1 )*( JDIAG-1 )+1 ) = WORK( ( N+1 )*( JDIAG-1 )+ 00190 $ 1 ) - CONE 00191 30 CONTINUE 00192 * 00193 RESULT = MIN( ZLANGE( '1', N, N, WORK, N, RWORK ), 00194 $ DBLE( N ) ) / ( N*ULP ) 00195 END IF 00196 * 00197 RETURN 00198 * 00199 * End of ZGET51 00200 * 00201 END