1*> \brief \b DSYT01_ROOK 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 DSYT01_ROOK( 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* DOUBLE PRECISION RESID 18* .. 19* .. Array Arguments .. 20* INTEGER IPIV( * ) 21* DOUBLE PRECISION A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ), 22* $ RWORK( * ) 23* .. 24* 25* 26*> \par Purpose: 27* ============= 28*> 29*> \verbatim 30*> 31*> DSYT01_ROOK reconstructs a symmetric 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*> symmetric 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 DOUBLE PRECISION array, dimension (LDA,N) 58*> The original symmetric 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 DOUBLE PRECISION 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 DSYTRF_ROOK. 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 DSYTRF_ROOK. 86*> \endverbatim 87*> 88*> \param[out] C 89*> \verbatim 90*> C is DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (N) 102*> \endverbatim 103*> 104*> \param[out] RESID 105*> \verbatim 106*> RESID is DOUBLE PRECISION 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 double_lin 120* 121* ===================================================================== 122 SUBROUTINE DSYT01_ROOK( 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 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, INFO, 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_ROOK 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 identity matrix. 176* 177 CALL DLASET( 'Full', N, N, ZERO, ONE, C, LDC ) 178* 179* Call DLAVSY_ROOK to form the product D * U' (or D * L' ). 180* 181 CALL DLAVSY_ROOK( UPLO, 'Transpose', 'Non-unit', N, N, AFAC, 182 $ LDAFAC, IPIV, C, LDC, INFO ) 183* 184* Call DLAVSY_ROOK again to multiply by U (or L ). 185* 186 CALL DLAVSY_ROOK( UPLO, 'No transpose', 'Unit', N, N, AFAC, 187 $ LDAFAC, IPIV, C, LDC, INFO ) 188* 189* Compute the difference C - A . 190* 191 IF( LSAME( UPLO, 'U' ) ) THEN 192 DO 20 J = 1, N 193 DO 10 I = 1, J 194 C( I, J ) = C( I, J ) - A( I, J ) 195 10 CONTINUE 196 20 CONTINUE 197 ELSE 198 DO 40 J = 1, N 199 DO 30 I = J, N 200 C( I, J ) = C( I, J ) - A( I, J ) 201 30 CONTINUE 202 40 CONTINUE 203 END IF 204* 205* Compute norm( C - A ) / ( N * norm(A) * EPS ) 206* 207 RESID = DLANSY( '1', UPLO, N, C, LDC, RWORK ) 208* 209 IF( ANORM.LE.ZERO ) THEN 210 IF( RESID.NE.ZERO ) 211 $ RESID = ONE / EPS 212 ELSE 213 RESID = ( ( RESID / DBLE( N ) ) / ANORM ) / EPS 214 END IF 215* 216 RETURN 217* 218* End of DSYT01_ROOK 219* 220 END 221