LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ csyt01_aa()

subroutine csyt01_aa ( character uplo,
integer n,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( ldafac, * ) afac,
integer ldafac,
integer, dimension( * ) ipiv,
complex, dimension( ldc, * ) c,
integer ldc,
real, dimension( * ) rwork,
real resid )

CSYT01

Purpose:
!>
!> CSYT01 reconstructs a hermitian indefinite matrix A from its
!> block L*D*L' or U*D*U' factorization and computes the residual
!>    norm( C - A ) / ( N * norm(A) * EPS ),
!> where C is the reconstructed matrix and EPS is the machine epsilon.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the upper or lower triangular part of the
!>          hermitian matrix A is stored:
!>          = 'U':  Upper triangular
!>          = 'L':  Lower triangular
!> 
[in]N
!>          N is INTEGER
!>          The number of rows and columns of the matrix A.  N >= 0.
!> 
[in]A
!>          A is REAL array, dimension (LDA,N)
!>          The original hermitian matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N)
!> 
[in]AFAC
!>          AFAC is REAL array, dimension (LDAFAC,N)
!>          The factored form of the matrix A.  AFAC contains the block
!>          diagonal matrix D and the multipliers used to obtain the
!>          factor L or U from the block L*D*L' or U*D*U' factorization
!>          as computed by CSYTRF.
!> 
[in]LDAFAC
!>          LDAFAC is INTEGER
!>          The leading dimension of the array AFAC.  LDAFAC >= max(1,N).
!> 
[in]IPIV
!>          IPIV is INTEGER array, dimension (N)
!>          The pivot indices from CSYTRF.
!> 
[out]C
!>          C is REAL array, dimension (LDC,N)
!> 
[in]LDC
!>          LDC is INTEGER
!>          The leading dimension of the array C.  LDC >= max(1,N).
!> 
[out]RWORK
!>          RWORK is REAL array, dimension (N)
!> 
[out]RESID
!>          RESID is REAL
!>          If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
!>          If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 122 of file csyt01_aa.f.

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.0e+0, one = 1.0e+0 )
145 COMPLEX CZERO, CONE
146 parameter( czero = ( 0.0e+0, 0.0e+0 ),
147 $ cone = ( 1.0e+0, 0.0e+0 ) )
148* ..
149* .. Local Scalars ..
150 INTEGER I, J
151 REAL ANORM, EPS
152* ..
153* .. External Functions ..
154 LOGICAL LSAME
155 REAL SLAMCH, CLANSY
156 EXTERNAL lsame, slamch, clansy
157* ..
158* .. External Subroutines ..
159 EXTERNAL claset, clavsy
160* ..
161* .. Intrinsic Functions ..
162 INTRINSIC real
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 = slamch( 'Epsilon' )
176 anorm = clansy( '1', uplo, n, a, lda, rwork )
177*
178* Initialize C to the tridiagonal matrix T.
179*
180 CALL claset( 'Full', n, n, czero, czero, c, ldc )
181 CALL clacpy( '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 clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
185 $ ldc+1 )
186 CALL clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
187 $ ldc+1 )
188 ELSE
189 CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
190 $ ldc+1 )
191 CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
192 $ ldc+1 )
193 ENDIF
194*
195* Call CTRMM to form the product U' * D (or L * D ).
196*
197 IF( lsame( uplo, 'U' ) ) THEN
198 CALL ctrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
199 $ cone, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
200 ELSE
201 CALL ctrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
202 $ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
203 END IF
204*
205* Call CTRMM again to multiply by U (or L ).
206*
207 IF( lsame( uplo, 'U' ) ) THEN
208 CALL ctrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
209 $ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
210 ELSE
211 CALL ctrmm( '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 cswap( 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 cswap( 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 = clansy( '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 / real( n ) ) / anorm ) / eps
255 END IF
256*
257 RETURN
258*
259* End of CSYT01_AA
260*
subroutine clavsy(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
CLAVSY
Definition clavsy.f:153
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
Definition clacpy.f:101
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clansy(norm, uplo, n, a, lda, work)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clansy.f:121
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:104
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
Definition cswap.f:81
subroutine ctrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
CTRMM
Definition ctrmm.f:177
Here is the call graph for this function:
Here is the caller graph for this function: