1 SUBROUTINE ZPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
2 $ RWORK, RESID )
3 *
4 * -- LAPACK test routine (version 3.1.2) --
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
6 * May 2007
7 *
8 * .. Scalar Arguments ..
9 CHARACTER UPLO
10 INTEGER LDA, LDB, LDX, N, NRHS
11 DOUBLE PRECISION RESID
12 * ..
13 * .. Array Arguments ..
14 DOUBLE PRECISION RWORK( * )
15 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
16 * ..
17 *
18 * Purpose
19 * =======
20 *
21 * ZPOT06 computes the residual for a solution of a system of linear
22 * equations A*x = b :
23 * RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ),
24 * where EPS is the machine epsilon.
25 *
26 * Arguments
27 * =========
28 *
29 * UPLO (input) CHARACTER*1
30 * Specifies whether the upper or lower triangular part of the
31 * symmetric matrix A is stored:
32 * = 'U': Upper triangular
33 * = 'L': Lower triangular
34 *
35 * N (input) INTEGER
36 * The number of rows and columns of the matrix A. N >= 0.
37 *
38 * NRHS (input) INTEGER
39 * The number of columns of B, the matrix of right hand sides.
40 * NRHS >= 0.
41 *
42 * A (input) COMPLEX*16 array, dimension (LDA,N)
43 * The original M x N matrix A.
44 *
45 * LDA (input) INTEGER
46 * The leading dimension of the array A. LDA >= max(1,N).
47 *
48 * X (input) COMPLEX*16 array, dimension (LDX,NRHS)
49 * The computed solution vectors for the system of linear
50 * equations.
51 *
52 * LDX (input) INTEGER
53 * The leading dimension of the array X. If TRANS = 'N',
54 * LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N).
55 *
56 * B (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
57 * On entry, the right hand side vectors for the system of
58 * linear equations.
59 * On exit, B is overwritten with the difference B - A*X.
60 *
61 * LDB (input) INTEGER
62 * The leading dimension of the array B. IF TRANS = 'N',
63 * LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
64 *
65 * RWORK (workspace) DOUBLE PRECISION array, dimension (N)
66 *
67 * RESID (output) DOUBLE PRECISION
68 * The maximum over the number of right hand sides of
69 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
70 *
71 * =====================================================================
72 *
73 * .. Parameters ..
74 DOUBLE PRECISION ZERO, ONE, NEGONE
75 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
76 PARAMETER ( NEGONE = -1.0D+0 )
77 COMPLEX*16 CONE, NEGCONE
78 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
79 PARAMETER ( NEGCONE = ( -1.0D+0, 0.0D+0 ) )
80 * ..
81 * .. Local Scalars ..
82 INTEGER IFAIL, J
83 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
84 COMPLEX*16 ZDUM
85 * ..
86 * .. External Functions ..
87 LOGICAL LSAME
88 INTEGER IZAMAX
89 DOUBLE PRECISION DLAMCH, ZLANSY
90 EXTERNAL LSAME, IZAMAX, DLAMCH, ZLANSY
91 * ..
92 * .. External Subroutines ..
93 EXTERNAL ZHEMM
94 * ..
95 * .. Intrinsic Functions ..
96 INTRINSIC ABS, DBLE, DIMAG, MAX
97 * ..
98 * .. Statement Functions ..
99 DOUBLE PRECISION CABS1
100 * ..
101 * .. Statement Function definitions ..
102 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
103 * ..
104 * ..
105 * .. Executable Statements ..
106 *
107 * Quick exit if N = 0 or NRHS = 0
108 *
109 IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
110 RESID = ZERO
111 RETURN
112 END IF
113 *
114 * Exit with RESID = 1/EPS if ANORM = 0.
115 *
116 EPS = DLAMCH( 'Epsilon' )
117 ANORM = ZLANSY( 'I', UPLO, N, A, LDA, RWORK )
118 IF( ANORM.LE.ZERO ) THEN
119 RESID = ONE / EPS
120 RETURN
121 END IF
122 *
123 * Compute B - A*X and store in B.
124 IFAIL=0
125 *
126 CALL ZHEMM( 'Left', UPLO, N, NRHS, NEGCONE, A, LDA, X,
127 $ LDX, CONE, B, LDB )
128 *
129 * Compute the maximum over the number of right hand sides of
130 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
131 *
132 RESID = ZERO
133 DO 10 J = 1, NRHS
134 BNORM = CABS1(B(IZAMAX( N, B( 1, J ), 1 ),J))
135 XNORM = CABS1(X(IZAMAX( N, X( 1, J ), 1 ),J))
136 IF( XNORM.LE.ZERO ) THEN
137 RESID = ONE / EPS
138 ELSE
139 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
140 END IF
141 10 CONTINUE
142 *
143 RETURN
144 *
145 * End of ZPOT06
146 *
147 END
2 $ RWORK, RESID )
3 *
4 * -- LAPACK test routine (version 3.1.2) --
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
6 * May 2007
7 *
8 * .. Scalar Arguments ..
9 CHARACTER UPLO
10 INTEGER LDA, LDB, LDX, N, NRHS
11 DOUBLE PRECISION RESID
12 * ..
13 * .. Array Arguments ..
14 DOUBLE PRECISION RWORK( * )
15 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
16 * ..
17 *
18 * Purpose
19 * =======
20 *
21 * ZPOT06 computes the residual for a solution of a system of linear
22 * equations A*x = b :
23 * RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ),
24 * where EPS is the machine epsilon.
25 *
26 * Arguments
27 * =========
28 *
29 * UPLO (input) CHARACTER*1
30 * Specifies whether the upper or lower triangular part of the
31 * symmetric matrix A is stored:
32 * = 'U': Upper triangular
33 * = 'L': Lower triangular
34 *
35 * N (input) INTEGER
36 * The number of rows and columns of the matrix A. N >= 0.
37 *
38 * NRHS (input) INTEGER
39 * The number of columns of B, the matrix of right hand sides.
40 * NRHS >= 0.
41 *
42 * A (input) COMPLEX*16 array, dimension (LDA,N)
43 * The original M x N matrix A.
44 *
45 * LDA (input) INTEGER
46 * The leading dimension of the array A. LDA >= max(1,N).
47 *
48 * X (input) COMPLEX*16 array, dimension (LDX,NRHS)
49 * The computed solution vectors for the system of linear
50 * equations.
51 *
52 * LDX (input) INTEGER
53 * The leading dimension of the array X. If TRANS = 'N',
54 * LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N).
55 *
56 * B (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
57 * On entry, the right hand side vectors for the system of
58 * linear equations.
59 * On exit, B is overwritten with the difference B - A*X.
60 *
61 * LDB (input) INTEGER
62 * The leading dimension of the array B. IF TRANS = 'N',
63 * LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
64 *
65 * RWORK (workspace) DOUBLE PRECISION array, dimension (N)
66 *
67 * RESID (output) DOUBLE PRECISION
68 * The maximum over the number of right hand sides of
69 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
70 *
71 * =====================================================================
72 *
73 * .. Parameters ..
74 DOUBLE PRECISION ZERO, ONE, NEGONE
75 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
76 PARAMETER ( NEGONE = -1.0D+0 )
77 COMPLEX*16 CONE, NEGCONE
78 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
79 PARAMETER ( NEGCONE = ( -1.0D+0, 0.0D+0 ) )
80 * ..
81 * .. Local Scalars ..
82 INTEGER IFAIL, J
83 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
84 COMPLEX*16 ZDUM
85 * ..
86 * .. External Functions ..
87 LOGICAL LSAME
88 INTEGER IZAMAX
89 DOUBLE PRECISION DLAMCH, ZLANSY
90 EXTERNAL LSAME, IZAMAX, DLAMCH, ZLANSY
91 * ..
92 * .. External Subroutines ..
93 EXTERNAL ZHEMM
94 * ..
95 * .. Intrinsic Functions ..
96 INTRINSIC ABS, DBLE, DIMAG, MAX
97 * ..
98 * .. Statement Functions ..
99 DOUBLE PRECISION CABS1
100 * ..
101 * .. Statement Function definitions ..
102 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
103 * ..
104 * ..
105 * .. Executable Statements ..
106 *
107 * Quick exit if N = 0 or NRHS = 0
108 *
109 IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
110 RESID = ZERO
111 RETURN
112 END IF
113 *
114 * Exit with RESID = 1/EPS if ANORM = 0.
115 *
116 EPS = DLAMCH( 'Epsilon' )
117 ANORM = ZLANSY( 'I', UPLO, N, A, LDA, RWORK )
118 IF( ANORM.LE.ZERO ) THEN
119 RESID = ONE / EPS
120 RETURN
121 END IF
122 *
123 * Compute B - A*X and store in B.
124 IFAIL=0
125 *
126 CALL ZHEMM( 'Left', UPLO, N, NRHS, NEGCONE, A, LDA, X,
127 $ LDX, CONE, B, LDB )
128 *
129 * Compute the maximum over the number of right hand sides of
130 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
131 *
132 RESID = ZERO
133 DO 10 J = 1, NRHS
134 BNORM = CABS1(B(IZAMAX( N, B( 1, J ), 1 ),J))
135 XNORM = CABS1(X(IZAMAX( N, X( 1, J ), 1 ),J))
136 IF( XNORM.LE.ZERO ) THEN
137 RESID = ONE / EPS
138 ELSE
139 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
140 END IF
141 10 CONTINUE
142 *
143 RETURN
144 *
145 * End of ZPOT06
146 *
147 END