LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zsyt01_aa.f
Go to the documentation of this file.
1*> \brief \b ZSYT01
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 ZSYT01_AA( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC,
12* RWORK, RESID )
13*
14* .. Scalar Arguments ..
15* CHARACTER UPLO
16* INTEGER LDA, LDAFAC, LDC, N
17* DOUBLE PRECISION RESID
18* ..
19* .. Array Arguments ..
20* INTEGER IPIV( * )
21* DOUBLE PRECISION RWORK( * )
22* COMPLEX*16 A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ),
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> ZSYT01 reconstructs a hermitian indefinite matrix A from its
32*> block L*D*L' or U*D*U' factorization and computes the residual
33*> norm( C - A ) / ( N * norm(A) * EPS ),
34*> where C is the reconstructed matrix and 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*> hermitian 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*16 array, dimension (LDA,N)
58*> The original hermitian 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] AFAC
68*> \verbatim
69*> AFAC is COMPLEX*16 array, dimension (LDAFAC,N)
70*> The factored form of the matrix A. AFAC contains the block
71*> diagonal matrix D and the multipliers used to obtain the
72*> factor L or U from the block L*D*L' or U*D*U' factorization
73*> as computed by ZSYTRF.
74*> \endverbatim
75*>
76*> \param[in] LDAFAC
77*> \verbatim
78*> LDAFAC is INTEGER
79*> The leading dimension of the array AFAC. LDAFAC >= max(1,N).
80*> \endverbatim
81*>
82*> \param[in] IPIV
83*> \verbatim
84*> IPIV is INTEGER array, dimension (N)
85*> The pivot indices from ZSYTRF.
86*> \endverbatim
87*>
88*> \param[out] C
89*> \verbatim
90*> C is COMPLEX*16 array, dimension (LDC,N)
91*> \endverbatim
92*>
93*> \param[in] LDC
94*> \verbatim
95*> LDC is INTEGER
96*> The leading dimension of the array C. LDC >= max(1,N).
97*> \endverbatim
98*>
99*> \param[out] RWORK
100*> \verbatim
101*> RWORK is COMPLEX*16 array, dimension (N)
102*> \endverbatim
103*>
104*> \param[out] RESID
105*> \verbatim
106*> RESID is COMPLEX*16
107*> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
108*> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
109*> \endverbatim
110*
111* Authors:
112* ========
113*
114*> \author Univ. of Tennessee
115*> \author Univ. of California Berkeley
116*> \author Univ. of Colorado Denver
117*> \author NAG Ltd.
118*
119*> \ingroup complex16_lin
120*
121* =====================================================================
122 SUBROUTINE zsyt01_aa( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C,
123 $ LDC, RWORK, RESID )
124*
125* -- LAPACK test routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 CHARACTER UPLO
131 INTEGER LDA, LDAFAC, LDC, N
132 DOUBLE PRECISION RESID
133* ..
134* .. Array Arguments ..
135 INTEGER IPIV( * )
136 COMPLEX*16 A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
137 DOUBLE PRECISION RWORK( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 DOUBLE PRECISION ZERO, ONE
144 parameter( zero = 0.0d+0, one = 1.0d+0 )
145 COMPLEX*16 CZERO, CONE
146 parameter( czero = ( 0.0d+0, 0.0d+0 ),
147 $ cone = ( 1.0d+0, 0.0d+0 ) )
148* ..
149* .. Local Scalars ..
150 INTEGER I, J
151 DOUBLE PRECISION ANORM, EPS
152* ..
153* .. External Functions ..
154 LOGICAL LSAME
155 DOUBLE PRECISION DLAMCH, ZLANSY
156 EXTERNAL lsame, dlamch, zlansy
157* ..
158* .. External Subroutines ..
159 EXTERNAL zlaset, zlavsy
160* ..
161* .. Intrinsic Functions ..
162 INTRINSIC dble
163* ..
164* .. Executable Statements ..
165*
166* Quick exit if N = 0.
167*
168 IF( n.LE.0 ) THEN
169 resid = zero
170 RETURN
171 END IF
172*
173* Determine EPS and the norm of A.
174*
175 eps = dlamch( 'Epsilon' )
176 anorm = zlansy( '1', uplo, n, a, lda, rwork )
177*
178* Initialize C to the tridiagonal matrix T.
179*
180 CALL zlaset( 'Full', n, n, czero, czero, c, ldc )
181 CALL zlacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
182 IF( n.GT.1 ) THEN
183 IF( lsame( uplo, 'U' ) ) THEN
184 CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
185 $ ldc+1 )
186 CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
187 $ ldc+1 )
188 ELSE
189 CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
190 $ ldc+1 )
191 CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
192 $ ldc+1 )
193 ENDIF
194*
195* Call ZTRMM to form the product U' * D (or L * D ).
196*
197 IF( lsame( uplo, 'U' ) ) THEN
198 CALL ztrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
199 $ cone, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
200 ELSE
201 CALL ztrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
202 $ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
203 END IF
204*
205* Call ZTRMM again to multiply by U (or L ).
206*
207 IF( lsame( uplo, 'U' ) ) THEN
208 CALL ztrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
209 $ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
210 ELSE
211 CALL ztrmm( 'Right', uplo, 'Transpose', 'Unit', n, n-1,
212 $ cone, afac( 2, 1 ), ldafac, c( 1, 2 ), ldc )
213 END IF
214 ENDIF
215*
216* Apply symmetric pivots
217*
218 DO j = n, 1, -1
219 i = ipiv( j )
220 IF( i.NE.j )
221 $ CALL zswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
222 END DO
223 DO j = n, 1, -1
224 i = ipiv( j )
225 IF( i.NE.j )
226 $ CALL zswap( n, c( 1, j ), 1, c( 1, i ), 1 )
227 END DO
228*
229*
230* Compute the difference C - A .
231*
232 IF( lsame( uplo, 'U' ) ) THEN
233 DO j = 1, n
234 DO i = 1, j
235 c( i, j ) = c( i, j ) - a( i, j )
236 END DO
237 END DO
238 ELSE
239 DO j = 1, n
240 DO i = j, n
241 c( i, j ) = c( i, j ) - a( i, j )
242 END DO
243 END DO
244 END IF
245*
246* Compute norm( C - A ) / ( N * norm(A) * EPS )
247*
248 resid = zlansy( '1', uplo, n, c, ldc, rwork )
249*
250 IF( anorm.LE.zero ) THEN
251 IF( resid.NE.zero )
252 $ resid = one / eps
253 ELSE
254 resid = ( ( resid / dble( n ) ) / anorm ) / eps
255 END IF
256*
257 RETURN
258*
259* End of ZSYT01_AA
260*
261 END
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
Definition: zswap.f:81
subroutine ztrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRMM
Definition: ztrmm.f:177
subroutine zsyt01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
ZSYT01
Definition: zsyt01_aa.f:124
subroutine zlavsy(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
ZLAVSY
Definition: zlavsy.f:153
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:103
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: zlaset.f:106