LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 128 of file dsyt01_aa.f.

128 *
129 * -- LAPACK test routine (version 3.7.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * December 2016
133 *
134 * .. Scalar Arguments ..
135  CHARACTER uplo
136  INTEGER lda, ldafac, ldc, n
137  DOUBLE PRECISION resid
138 * ..
139 * .. Array Arguments ..
140  INTEGER ipiv( * )
141  DOUBLE PRECISION a( lda, * ), afac( ldafac, * ), c( ldc, * ),
142  $ rwork( * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  DOUBLE PRECISION zero, one
149  parameter( zero = 0.0d+0, one = 1.0d+0 )
150 * ..
151 * .. Local Scalars ..
152  INTEGER i, j
153  DOUBLE PRECISION anorm, eps
154 * ..
155 * .. External Functions ..
156  LOGICAL lsame
157  DOUBLE PRECISION dlamch, dlansy
158  EXTERNAL lsame, dlamch, dlansy
159 * ..
160 * .. External Subroutines ..
161  EXTERNAL dlaset, dlavsy
162 * ..
163 * .. Intrinsic Functions ..
164  INTRINSIC dble
165 * ..
166 * .. Executable Statements ..
167 *
168 * Quick exit if N = 0.
169 *
170  IF( n.LE.0 ) THEN
171  resid = zero
172  RETURN
173  END IF
174 *
175 * Determine EPS and the norm of A.
176 *
177  eps = dlamch( 'Epsilon' )
178  anorm = dlansy( '1', uplo, n, a, lda, rwork )
179 *
180 * Initialize C to the tridiagonal matrix T.
181 *
182  CALL dlaset( 'Full', n, n, zero, zero, c, ldc )
183  CALL dlacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
184  IF( n.GT.1 ) THEN
185  IF( lsame( uplo, 'U' ) ) THEN
186  CALL dlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
187  $ ldc+1 )
188  CALL dlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
189  $ ldc+1 )
190  ELSE
191  CALL dlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
192  $ ldc+1 )
193  CALL dlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
194  $ ldc+1 )
195  ENDIF
196 *
197 * Call DTRMM to form the product U' * D (or L * D ).
198 *
199  IF( lsame( uplo, 'U' ) ) THEN
200  CALL dtrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
201  $ one, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
202  ELSE
203  CALL dtrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
204  $ one, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
205  END IF
206 *
207 * Call DTRMM again to multiply by U (or L ).
208 *
209  IF( lsame( uplo, 'U' ) ) THEN
210  CALL dtrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
211  $ one, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
212  ELSE
213  CALL dtrmm( 'Right', uplo, 'Transpose', 'Unit', n, n-1,
214  $ one, afac( 2, 1 ), ldafac, c( 1, 2 ), ldc )
215  END IF
216  ENDIF
217 *
218 * Apply symmetric pivots
219 *
220  DO j = n, 1, -1
221  i = ipiv( j )
222  IF( i.NE.j )
223  $ CALL dswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
224  END DO
225  DO j = n, 1, -1
226  i = ipiv( j )
227  IF( i.NE.j )
228  $ CALL dswap( n, c( 1, j ), 1, c( 1, i ), 1 )
229  END DO
230 *
231 *
232 * Compute the difference C - A .
233 *
234  IF( lsame( uplo, 'U' ) ) THEN
235  DO j = 1, n
236  DO i = 1, j
237  c( i, j ) = c( i, j ) - a( i, j )
238  END DO
239  END DO
240  ELSE
241  DO j = 1, n
242  DO i = j, n
243  c( i, j ) = c( i, j ) - a( i, j )
244  END DO
245  END DO
246  END IF
247 *
248 * Compute norm( C - A ) / ( N * norm(A) * EPS )
249 *
250  resid = dlansy( '1', uplo, n, c, ldc, rwork )
251 *
252  IF( anorm.LE.zero ) THEN
253  IF( resid.NE.zero )
254  $ resid = one / eps
255  ELSE
256  resid = ( ( resid / dble( n ) ) / anorm ) / eps
257  END IF
258 *
259  RETURN
260 *
261 * End of DSYT01
262 *
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
Definition: dlacpy.f:105
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
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, or the element of largest absolute value of a real symmetric matrix.
Definition: dlansy.f:124
subroutine dtrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRMM
Definition: dtrmm.f:179
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:112
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:84
subroutine dlavsy(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
DLAVSY
Definition: dlavsy.f:157
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: