PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
zpot06.f
Go to the documentation of this file.
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