1*> \brief \b SSYT01_3 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 SSYT01_3( UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C, 12* LDC, 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* $ E( * ), RWORK( * ) 23* .. 24* 25* 26*> \par Purpose: 27* ============= 28*> 29*> \verbatim 30*> 31*> SSYT01_3 reconstructs a symmetric indefinite matrix A from its 32*> block L*D*L' or U*D*U' factorization computed by SSYTRF_RK 33*> (or SSYTRF_BK) and computes the residual 34*> norm( C - A ) / ( N * norm(A) * EPS ), 35*> where C is the reconstructed matrix and EPS is the machine epsilon. 36*> \endverbatim 37* 38* Arguments: 39* ========== 40* 41*> \param[in] UPLO 42*> \verbatim 43*> UPLO is CHARACTER*1 44*> Specifies whether the upper or lower triangular part of the 45*> symmetric matrix A is stored: 46*> = 'U': Upper triangular 47*> = 'L': Lower triangular 48*> \endverbatim 49*> 50*> \param[in] N 51*> \verbatim 52*> N is INTEGER 53*> The number of rows and columns of the matrix A. N >= 0. 54*> \endverbatim 55*> 56*> \param[in] A 57*> \verbatim 58*> A is DOUBLE PRECISION array, dimension (LDA,N) 59*> The original symmetric matrix A. 60*> \endverbatim 61*> 62*> \param[in] LDA 63*> \verbatim 64*> LDA is INTEGER 65*> The leading dimension of the array A. LDA >= max(1,N) 66*> \endverbatim 67*> 68*> \param[in] AFAC 69*> \verbatim 70*> AFAC is DOUBLE PRECISION array, dimension (LDAFAC,N) 71*> Diagonal of the block diagonal matrix D and factors U or L 72*> as computed by SSYTRF_RK and SSYTRF_BK: 73*> a) ONLY diagonal elements of the symmetric block diagonal 74*> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k); 75*> (superdiagonal (or subdiagonal) elements of D 76*> should be provided on entry in array E), and 77*> b) If UPLO = 'U': factor U in the superdiagonal part of A. 78*> If UPLO = 'L': factor L in the subdiagonal part of A. 79*> \endverbatim 80*> 81*> \param[in] LDAFAC 82*> \verbatim 83*> LDAFAC is INTEGER 84*> The leading dimension of the array AFAC. 85*> LDAFAC >= max(1,N). 86*> \endverbatim 87*> 88*> \param[in] E 89*> \verbatim 90*> E is DOUBLE PRECISION array, dimension (N) 91*> On entry, contains the superdiagonal (or subdiagonal) 92*> elements of the symmetric block diagonal matrix D 93*> with 1-by-1 or 2-by-2 diagonal blocks, where 94*> If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced; 95*> If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced. 96*> \endverbatim 97*> 98*> \param[in] IPIV 99*> \verbatim 100*> IPIV is INTEGER array, dimension (N) 101*> The pivot indices from SSYTRF_RK (or SSYTRF_BK). 102*> \endverbatim 103*> 104*> \param[out] C 105*> \verbatim 106*> C is DOUBLE PRECISION array, dimension (LDC,N) 107*> \endverbatim 108*> 109*> \param[in] LDC 110*> \verbatim 111*> LDC is INTEGER 112*> The leading dimension of the array C. LDC >= max(1,N). 113*> \endverbatim 114*> 115*> \param[out] RWORK 116*> \verbatim 117*> RWORK is DOUBLE PRECISION array, dimension (N) 118*> \endverbatim 119*> 120*> \param[out] RESID 121*> \verbatim 122*> RESID is DOUBLE PRECISION 123*> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS ) 124*> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS ) 125*> \endverbatim 126* 127* Authors: 128* ======== 129* 130*> \author Univ. of Tennessee 131*> \author Univ. of California Berkeley 132*> \author Univ. of Colorado Denver 133*> \author NAG Ltd. 134* 135*> \ingroup single_lin 136* 137* ===================================================================== 138 SUBROUTINE SSYT01_3( UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C, 139 $ LDC, RWORK, RESID ) 140* 141* -- LAPACK test routine -- 142* -- LAPACK is a software package provided by Univ. of Tennessee, -- 143* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 144* 145* .. Scalar Arguments .. 146 CHARACTER UPLO 147 INTEGER LDA, LDAFAC, LDC, N 148 REAL RESID 149* .. 150* .. Array Arguments .. 151 INTEGER IPIV( * ) 152 REAL A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ), 153 $ E( * ), RWORK( * ) 154* .. 155* 156* ===================================================================== 157* 158* .. Parameters .. 159 REAL ZERO, ONE 160 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 161* .. 162* .. Local Scalars .. 163 INTEGER I, INFO, J 164 REAL ANORM, EPS 165* .. 166* .. External Functions .. 167 LOGICAL LSAME 168 REAL SLAMCH, SLANSY 169 EXTERNAL LSAME, SLAMCH, SLANSY 170* .. 171* .. External Subroutines .. 172 EXTERNAL SLASET, SLAVSY_ROOK, SSYCONVF_ROOK 173* .. 174* .. Intrinsic Functions .. 175 INTRINSIC REAL 176* .. 177* .. Executable Statements .. 178* 179* Quick exit if N = 0. 180* 181 IF( N.LE.0 ) THEN 182 RESID = ZERO 183 RETURN 184 END IF 185* 186* a) Revert to multiplyers of L 187* 188 CALL SSYCONVF_ROOK( UPLO, 'R', N, AFAC, LDAFAC, E, IPIV, INFO ) 189* 190* 1) Determine EPS and the norm of A. 191* 192 EPS = SLAMCH( 'Epsilon' ) 193 ANORM = SLANSY( '1', UPLO, N, A, LDA, RWORK ) 194* 195* 2) Initialize C to the identity matrix. 196* 197 CALL SLASET( 'Full', N, N, ZERO, ONE, C, LDC ) 198* 199* 3) Call SLAVSY_ROOK to form the product D * U' (or D * L' ). 200* 201 CALL SLAVSY_ROOK( UPLO, 'Transpose', 'Non-unit', N, N, AFAC, 202 $ LDAFAC, IPIV, C, LDC, INFO ) 203* 204* 4) Call SLAVSY_ROOK again to multiply by U (or L ). 205* 206 CALL SLAVSY_ROOK( UPLO, 'No transpose', 'Unit', N, N, AFAC, 207 $ LDAFAC, IPIV, C, LDC, INFO ) 208* 209* 5) Compute the difference C - A. 210* 211 IF( LSAME( UPLO, 'U' ) ) THEN 212 DO J = 1, N 213 DO I = 1, J 214 C( I, J ) = C( I, J ) - A( I, J ) 215 END DO 216 END DO 217 ELSE 218 DO J = 1, N 219 DO I = J, N 220 C( I, J ) = C( I, J ) - A( I, J ) 221 END DO 222 END DO 223 END IF 224* 225* 6) Compute norm( C - A ) / ( N * norm(A) * EPS ) 226* 227 RESID = SLANSY( '1', UPLO, N, C, LDC, RWORK ) 228* 229 IF( ANORM.LE.ZERO ) THEN 230 IF( RESID.NE.ZERO ) 231 $ RESID = ONE / EPS 232 ELSE 233 RESID = ( ( RESID / REAL( N ) ) / ANORM ) / EPS 234 END IF 235 236* 237* b) Convert to factor of L (or U) 238* 239 CALL SSYCONVF_ROOK( UPLO, 'C', N, AFAC, LDAFAC, E, IPIV, INFO ) 240* 241 RETURN 242* 243* End of SSYT01_3 244* 245 END 246