OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
csyt01_aa.f
Go to the documentation of this file.
1*> \brief \b CSYT01
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 CSYT01_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* REAL RESID
18* ..
19* .. Array Arguments ..
20* INTEGER IPIV( * )
21* REAL RWORK( * )
22* COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> CSYT01 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 REAL 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 REAL 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 CSYTRF.
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 CSYTRF.
86*> \endverbatim
87*>
88*> \param[out] C
89*> \verbatim
90*> C is REAL 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 REAL array, dimension (N)
102*> \endverbatim
103*>
104*> \param[out] RESID
105*> \verbatim
106*> RESID is REAL
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 complex_lin
120*
121* =====================================================================
122 SUBROUTINE csyt01_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 REAL RESID
133* ..
134* .. Array Arguments ..
135 INTEGER IPIV( * )
136 COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
137 REAL RWORK( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 REAL ZERO, ONE
144 parameter( zero = 0.0d+0, one = 1.0d+0 )
145 COMPLEX CZERO, CONE
146 parameter( czero = 0.0e+0, cone = 1.0e+0 )
147* ..
148* .. Local Scalars ..
149 INTEGER I, J
150 REAL ANORM, EPS
151* ..
152* .. External Functions ..
153 LOGICAL LSAME
154 REAL SLAMCH, CLANSY
155 EXTERNAL lsame, slamch, clansy
156* ..
157* .. External Subroutines ..
158 EXTERNAL claset, clavsy
159* ..
160* .. Intrinsic Functions ..
161 INTRINSIC dble
162* ..
163* .. Executable Statements ..
164*
165* Quick exit if N = 0.
166*
167 IF( n.LE.0 ) THEN
168 resid = zero
169 RETURN
170 END IF
171*
172* Determine EPS and the norm of A.
173*
174 eps = slamch( 'Epsilon' )
175 anorm = clansy( '1', uplo, n, a, lda, rwork )
176*
177* Initialize C to the tridiagonal matrix T.
178*
179 CALL claset( 'full', N, N, CZERO, CZERO, C, LDC )
180 CALL CLACPY( 'f', 1, N, AFAC( 1, 1 ), LDAFAC+1, C( 1, 1 ), LDC+1 )
181.GT. IF( N1 ) THEN
182 IF( LSAME( UPLO, 'u' ) ) THEN
183 CALL CLACPY( 'f', 1, N-1, AFAC( 1, 2 ), LDAFAC+1, C( 1, 2 ),
184 $ LDC+1 )
185 CALL CLACPY( 'f', 1, N-1, AFAC( 1, 2 ), LDAFAC+1, C( 2, 1 ),
186 $ LDC+1 )
187 ELSE
188 CALL CLACPY( 'f', 1, N-1, AFAC( 2, 1 ), LDAFAC+1, C( 1, 2 ),
189 $ LDC+1 )
190 CALL CLACPY( 'f', 1, N-1, AFAC( 2, 1 ), LDAFAC+1, C( 2, 1 ),
191 $ LDC+1 )
192 ENDIF
193*
194* Call CTRMM to form the product U' * D (or L * D ).
195*
196 IF( LSAME( UPLO, 'u' ) ) THEN
197 CALL CTRMM( 'left', UPLO, 'transpose', 'unit', N-1, N,
198 $ CONE, AFAC( 1, 2 ), LDAFAC, C( 2, 1 ), LDC )
199 ELSE
200 CALL CTRMM( 'left', UPLO, 'no transpose', 'unit', N-1, N,
201 $ CONE, AFAC( 2, 1 ), LDAFAC, C( 2, 1 ), LDC )
202 END IF
203*
204* Call CTRMM again to multiply by U (or L ).
205*
206 IF( LSAME( UPLO, 'u' ) ) THEN
207 CALL CTRMM( 'right', UPLO, 'no transpose', 'unit', N, N-1,
208 $ CONE, AFAC( 1, 2 ), LDAFAC, C( 1, 2 ), LDC )
209 ELSE
210 CALL CTRMM( 'right', UPLO, 'transpose', 'unit', N, N-1,
211 $ CONE, AFAC( 2, 1 ), LDAFAC, C( 1, 2 ), LDC )
212 END IF
213 ENDIF
214*
215* Apply symmetric pivots
216*
217 DO J = N, 1, -1
218 I = IPIV( J )
219.NE. IF( IJ )
220 $ CALL CSWAP( N, C( J, 1 ), LDC, C( I, 1 ), LDC )
221 END DO
222 DO J = N, 1, -1
223 I = IPIV( J )
224.NE. IF( IJ )
225 $ CALL CSWAP( N, C( 1, J ), 1, C( 1, I ), 1 )
226 END DO
227*
228*
229* Compute the difference C - A .
230*
231 IF( LSAME( UPLO, 'u' ) ) THEN
232 DO J = 1, N
233 DO I = 1, J
234 C( I, J ) = C( I, J ) - A( I, J )
235 END DO
236 END DO
237 ELSE
238 DO J = 1, N
239 DO I = J, N
240 C( I, J ) = C( I, J ) - A( I, J )
241 END DO
242 END DO
243 END IF
244*
245* Compute norm( C - A ) / ( N * norm(A) * EPS )
246*
247 RESID = CLANSY( '1', UPLO, N, C, LDC, RWORK )
248*
249.LE. IF( ANORMZERO ) THEN
250.NE. IF( RESIDZERO )
251 $ RESID = ONE / EPS
252 ELSE
253 RESID = ( ( RESID / DBLE( N ) ) / ANORM ) / EPS
254 END IF
255*
256 RETURN
257*
258* End of CSYT01_AA
259*
260 END
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition claset.f:106
subroutine csyt01_aa(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
CSYT01
Definition csyt01_aa.f:124
subroutine clavsy(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
CLAVSY
Definition clavsy.f:153