LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE CSYT02( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, 00002 $ RESID ) 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 CHARACTER UPLO 00010 INTEGER LDA, LDB, LDX, N, NRHS 00011 REAL RESID 00012 * .. 00013 * .. Array Arguments .. 00014 REAL RWORK( * ) 00015 COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * CSYT02 computes the residual for a solution to a complex symmetric 00022 * system of linear equations A*x = b: 00023 * 00024 * RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS ), 00025 * 00026 * where EPS is the machine epsilon. 00027 * 00028 * Arguments 00029 * ========= 00030 * 00031 * UPLO (input) CHARACTER*1 00032 * Specifies whether the upper or lower triangular part of the 00033 * symmetric matrix A is stored: 00034 * = 'U': Upper triangular 00035 * = 'L': Lower triangular 00036 * 00037 * N (input) INTEGER 00038 * The number of rows and columns of the matrix A. N >= 0. 00039 * 00040 * NRHS (input) INTEGER 00041 * The number of columns of B, the matrix of right hand sides. 00042 * NRHS >= 0. 00043 * 00044 * A (input) COMPLEX array, dimension (LDA,N) 00045 * The original complex symmetric matrix A. 00046 * 00047 * LDA (input) INTEGER 00048 * The leading dimension of the array A. LDA >= max(1,N) 00049 * 00050 * X (input) COMPLEX array, dimension (LDX,NRHS) 00051 * The computed solution vectors for the system of linear 00052 * equations. 00053 * 00054 * LDX (input) INTEGER 00055 * The leading dimension of the array X. LDX >= max(1,N). 00056 * 00057 * B (input/output) COMPLEX array, dimension (LDB,NRHS) 00058 * On entry, the right hand side vectors for the system of 00059 * linear equations. 00060 * On exit, B is overwritten with the difference B - A*X. 00061 * 00062 * LDB (input) INTEGER 00063 * The leading dimension of the array B. LDB >= max(1,N). 00064 * 00065 * RWORK (workspace) REAL array, dimension (N) 00066 * 00067 * RESID (output) REAL 00068 * The maximum over the number of right hand sides of 00069 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ). 00070 * 00071 * ===================================================================== 00072 * 00073 * .. Parameters .. 00074 REAL ZERO, ONE 00075 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 00076 COMPLEX CONE 00077 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) ) 00078 * .. 00079 * .. Local Scalars .. 00080 INTEGER J 00081 REAL ANORM, BNORM, EPS, XNORM 00082 * .. 00083 * .. External Functions .. 00084 REAL CLANSY, SCASUM, SLAMCH 00085 EXTERNAL CLANSY, SCASUM, SLAMCH 00086 * .. 00087 * .. External Subroutines .. 00088 EXTERNAL CSYMM 00089 * .. 00090 * .. Intrinsic Functions .. 00091 INTRINSIC MAX 00092 * .. 00093 * .. Executable Statements .. 00094 * 00095 * Quick exit if N = 0 or NRHS = 0 00096 * 00097 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 00098 RESID = ZERO 00099 RETURN 00100 END IF 00101 * 00102 * Exit with RESID = 1/EPS if ANORM = 0. 00103 * 00104 EPS = SLAMCH( 'Epsilon' ) 00105 ANORM = CLANSY( '1', UPLO, N, A, LDA, RWORK ) 00106 IF( ANORM.LE.ZERO ) THEN 00107 RESID = ONE / EPS 00108 RETURN 00109 END IF 00110 * 00111 * Compute B - A*X (or B - A'*X ) and store in B . 00112 * 00113 CALL CSYMM( 'Left', UPLO, N, NRHS, -CONE, A, LDA, X, LDX, CONE, B, 00114 $ LDB ) 00115 * 00116 * Compute the maximum over the number of right hand sides of 00117 * norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) . 00118 * 00119 RESID = ZERO 00120 DO 10 J = 1, NRHS 00121 BNORM = SCASUM( N, B( 1, J ), 1 ) 00122 XNORM = SCASUM( N, X( 1, J ), 1 ) 00123 IF( XNORM.LE.ZERO ) THEN 00124 RESID = ONE / EPS 00125 ELSE 00126 RESID = MAX( RESID, ( ( BNORM/ANORM )/XNORM )/EPS ) 00127 END IF 00128 10 CONTINUE 00129 * 00130 RETURN 00131 * 00132 * End of CSYT02 00133 * 00134 END