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

◆ dsyt01_aa()

subroutine dsyt01_aa ( character  uplo,
integer  n,
double precision, dimension( lda, * )  a,
integer  lda,
double precision, dimension( ldafac, * )  afac,
integer  ldafac,
integer, dimension( * )  ipiv,
double precision, dimension( ldc, * )  c,
integer  ldc,
double precision, dimension( * )  rwork,
double precision  resid 
)

DSYT01

Purpose:
 DSYT01 reconstructs a symmetric 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
          symmetric 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 DOUBLE PRECISION array, dimension (LDA,N)
          The original symmetric matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N)
[in]AFAC
          AFAC is DOUBLE PRECISION 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 DSYTRF.
[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 DSYTRF.
[out]C
          C is DOUBLE PRECISION array, dimension (LDC,N)
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C.  LDC >= max(1,N).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          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 dsyt01_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 DOUBLE PRECISION RESID
133* ..
134* .. Array Arguments ..
135 INTEGER IPIV( * )
136 DOUBLE PRECISION A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ),
137 $ RWORK( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 DOUBLE PRECISION ZERO, ONE
144 parameter( zero = 0.0d+0, one = 1.0d+0 )
145* ..
146* .. Local Scalars ..
147 INTEGER I, J
148 DOUBLE PRECISION ANORM, EPS
149* ..
150* .. External Functions ..
151 LOGICAL LSAME
152 DOUBLE PRECISION DLAMCH, DLANSY
153 EXTERNAL lsame, dlamch, dlansy
154* ..
155* .. External Subroutines ..
156 EXTERNAL dlaset, dlavsy
157* ..
158* .. Intrinsic Functions ..
159 INTRINSIC dble
160* ..
161* .. Executable Statements ..
162*
163* Quick exit if N = 0.
164*
165 IF( n.LE.0 ) THEN
166 resid = zero
167 RETURN
168 END IF
169*
170* Determine EPS and the norm of A.
171*
172 eps = dlamch( 'Epsilon' )
173 anorm = dlansy( '1', uplo, n, a, lda, rwork )
174*
175* Initialize C to the tridiagonal matrix T.
176*
177 CALL dlaset( 'Full', n, n, zero, zero, c, ldc )
178 CALL dlacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
179 IF( n.GT.1 ) THEN
180 IF( lsame( uplo, 'U' ) ) THEN
181 CALL dlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
182 $ ldc+1 )
183 CALL dlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
184 $ ldc+1 )
185 ELSE
186 CALL dlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
187 $ ldc+1 )
188 CALL dlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
189 $ ldc+1 )
190 ENDIF
191*
192* Call DTRMM to form the product U' * D (or L * D ).
193*
194 IF( lsame( uplo, 'U' ) ) THEN
195 CALL dtrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
196 $ one, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
197 ELSE
198 CALL dtrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
199 $ one, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
200 END IF
201*
202* Call DTRMM again to multiply by U (or L ).
203*
204 IF( lsame( uplo, 'U' ) ) THEN
205 CALL dtrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
206 $ one, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
207 ELSE
208 CALL dtrmm( 'Right', uplo, 'Transpose', 'Unit', n, n-1,
209 $ one, afac( 2, 1 ), ldafac, c( 1, 2 ), ldc )
210 END IF
211 ENDIF
212*
213* Apply symmetric pivots
214*
215 DO j = n, 1, -1
216 i = ipiv( j )
217 IF( i.NE.j )
218 $ CALL dswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
219 END DO
220 DO j = n, 1, -1
221 i = ipiv( j )
222 IF( i.NE.j )
223 $ CALL dswap( n, c( 1, j ), 1, c( 1, i ), 1 )
224 END DO
225*
226*
227* Compute the difference C - A .
228*
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO j = 1, n
231 DO i = 1, j
232 c( i, j ) = c( i, j ) - a( i, j )
233 END DO
234 END DO
235 ELSE
236 DO j = 1, n
237 DO i = j, n
238 c( i, j ) = c( i, j ) - a( i, j )
239 END DO
240 END DO
241 END IF
242*
243* Compute norm( C - A ) / ( N * norm(A) * EPS )
244*
245 resid = dlansy( '1', uplo, n, c, ldc, rwork )
246*
247 IF( anorm.LE.zero ) THEN
248 IF( resid.NE.zero )
249 $ resid = one / eps
250 ELSE
251 resid = ( ( resid / dble( n ) ) / anorm ) / eps
252 END IF
253*
254 RETURN
255*
256* End of DSYT01_AA
257*
subroutine dlavsy(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
DLAVSY
Definition dlavsy.f:155
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
Definition dlacpy.f:103
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlansy(norm, uplo, n, a, lda, work)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlansy.f:122
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition dlaset.f:110
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
Definition dswap.f:82
subroutine dtrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
DTRMM
Definition dtrmm.f:177
Here is the call graph for this function:
Here is the caller graph for this function: