LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ 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.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  IF( n.GT.1 ) 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  IF( i.NE.j )
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  IF( i.NE.j )
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  IF( anorm.LE.zero ) THEN
250  IF( resid.NE.zero )
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 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
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
subroutine clavsy(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CLAVSY
Definition: clavsy.f:153
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 clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103
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:123
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: