LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
csyt03.f
Go to the documentation of this file.
1 *> \brief \b CSYT03
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE CSYT03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
12 * RWORK, RCOND, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER LDA, LDAINV, LDWORK, N
17 * REAL RCOND, RESID
18 * ..
19 * .. Array Arguments ..
20 * REAL RWORK( * )
21 * COMPLEX A( LDA, * ), AINV( LDAINV, * ),
22 * $ WORK( LDWORK, * )
23 * ..
24 *
25 *
26 *> \par Purpose:
27 * =============
28 *>
29 *> \verbatim
30 *>
31 *> CSYT03 computes the residual for a complex symmetric matrix times
32 *> its inverse:
33 *> norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS )
34 *> where EPS is the machine epsilon.
35 *> \endverbatim
36 *
37 * Arguments:
38 * ==========
39 *
40 *> \param[in] UPLO
41 *> \verbatim
42 *> UPLO is CHARACTER*1
43 *> Specifies whether the upper or lower triangular part of the
44 *> complex symmetric matrix A is stored:
45 *> = 'U': Upper triangular
46 *> = 'L': Lower triangular
47 *> \endverbatim
48 *>
49 *> \param[in] N
50 *> \verbatim
51 *> N is INTEGER
52 *> The number of rows and columns of the matrix A. N >= 0.
53 *> \endverbatim
54 *>
55 *> \param[in] A
56 *> \verbatim
57 *> A is COMPLEX array, dimension (LDA,N)
58 *> The original complex symmetric matrix A.
59 *> \endverbatim
60 *>
61 *> \param[in] LDA
62 *> \verbatim
63 *> LDA is INTEGER
64 *> The leading dimension of the array A. LDA >= max(1,N)
65 *> \endverbatim
66 *>
67 *> \param[in,out] AINV
68 *> \verbatim
69 *> AINV is COMPLEX array, dimension (LDAINV,N)
70 *> On entry, the inverse of the matrix A, stored as a symmetric
71 *> matrix in the same format as A.
72 *> In this version, AINV is expanded into a full matrix and
73 *> multiplied by A, so the opposing triangle of AINV will be
74 *> changed; i.e., if the upper triangular part of AINV is
75 *> stored, the lower triangular part will be used as work space.
76 *> \endverbatim
77 *>
78 *> \param[in] LDAINV
79 *> \verbatim
80 *> LDAINV is INTEGER
81 *> The leading dimension of the array AINV. LDAINV >= max(1,N).
82 *> \endverbatim
83 *>
84 *> \param[out] WORK
85 *> \verbatim
86 *> WORK is COMPLEX array, dimension (LDWORK,N)
87 *> \endverbatim
88 *>
89 *> \param[in] LDWORK
90 *> \verbatim
91 *> LDWORK is INTEGER
92 *> The leading dimension of the array WORK. LDWORK >= max(1,N).
93 *> \endverbatim
94 *>
95 *> \param[out] RWORK
96 *> \verbatim
97 *> RWORK is REAL array, dimension (N)
98 *> \endverbatim
99 *>
100 *> \param[out] RCOND
101 *> \verbatim
102 *> RCOND is REAL
103 *> The reciprocal of the condition number of A, computed as
104 *> RCOND = 1/ (norm(A) * norm(AINV)).
105 *> \endverbatim
106 *>
107 *> \param[out] RESID
108 *> \verbatim
109 *> RESID is REAL
110 *> norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
111 *> \endverbatim
112 *
113 * Authors:
114 * ========
115 *
116 *> \author Univ. of Tennessee
117 *> \author Univ. of California Berkeley
118 *> \author Univ. of Colorado Denver
119 *> \author NAG Ltd.
120 *
121 *> \date November 2011
122 *
123 *> \ingroup complex_lin
124 *
125 * =====================================================================
126  SUBROUTINE csyt03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
127  $ rwork, rcond, resid )
128 *
129 * -- LAPACK test routine (version 3.4.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * November 2011
133 *
134 * .. Scalar Arguments ..
135  CHARACTER UPLO
136  INTEGER LDA, LDAINV, LDWORK, N
137  REAL RCOND, RESID
138 * ..
139 * .. Array Arguments ..
140  REAL RWORK( * )
141  COMPLEX A( lda, * ), AINV( ldainv, * ),
142  $ work( ldwork, * )
143 * ..
144 *
145 * =====================================================================
146 *
147 *
148 * .. Parameters ..
149  REAL ZERO, ONE
150  parameter ( zero = 0.0e+0, one = 1.0e+0 )
151  COMPLEX CZERO, CONE
152  parameter ( czero = ( 0.0e+0, 0.0e+0 ),
153  $ cone = ( 1.0e+0, 0.0e+0 ) )
154 * ..
155 * .. Local Scalars ..
156  INTEGER I, J
157  REAL AINVNM, ANORM, EPS
158 * ..
159 * .. External Functions ..
160  LOGICAL LSAME
161  REAL CLANGE, CLANSY, SLAMCH
162  EXTERNAL lsame, clange, clansy, slamch
163 * ..
164 * .. External Subroutines ..
165  EXTERNAL csymm
166 * ..
167 * .. Intrinsic Functions ..
168  INTRINSIC real
169 * ..
170 * .. Executable Statements ..
171 *
172 * Quick exit if N = 0
173 *
174  IF( n.LE.0 ) THEN
175  rcond = one
176  resid = zero
177  RETURN
178  END IF
179 *
180 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
181 *
182  eps = slamch( 'Epsilon' )
183  anorm = clansy( '1', uplo, n, a, lda, rwork )
184  ainvnm = clansy( '1', uplo, n, ainv, ldainv, rwork )
185  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
186  rcond = zero
187  resid = one / eps
188  RETURN
189  END IF
190  rcond = ( one/anorm ) / ainvnm
191 *
192 * Expand AINV into a full matrix and call CSYMM to multiply
193 * AINV on the left by A (store the result in WORK).
194 *
195  IF( lsame( uplo, 'U' ) ) THEN
196  DO 20 j = 1, n
197  DO 10 i = 1, j - 1
198  ainv( j, i ) = ainv( i, j )
199  10 CONTINUE
200  20 CONTINUE
201  ELSE
202  DO 40 j = 1, n
203  DO 30 i = j + 1, n
204  ainv( j, i ) = ainv( i, j )
205  30 CONTINUE
206  40 CONTINUE
207  END IF
208  CALL csymm( 'Left', uplo, n, n, -cone, a, lda, ainv, ldainv,
209  $ czero, work, ldwork )
210 *
211 * Add the identity matrix to WORK .
212 *
213  DO 50 i = 1, n
214  work( i, i ) = work( i, i ) + cone
215  50 CONTINUE
216 *
217 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
218 *
219  resid = clange( '1', n, n, work, ldwork, rwork )
220 *
221  resid = ( ( resid*rcond )/eps ) / REAL( n )
222 *
223  RETURN
224 *
225 * End of CSYT03
226 *
227  END
subroutine csymm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CSYMM
Definition: csymm.f:191
subroutine csyt03(UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK, RWORK, RCOND, RESID)
CSYT03
Definition: csyt03.f:128