LAPACK 3.3.1 Linear Algebra PACKage

# csyt01.f

Go to the documentation of this file.
```00001       SUBROUTINE CSYT01( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC,
00002      \$                   RWORK, RESID )
00003 *
00004 *  -- LAPACK test routine (version 3.1) --
00005 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            LDA, LDAFAC, LDC, N
00011       REAL               RESID
00012 *     ..
00013 *     .. Array Arguments ..
00014       INTEGER            IPIV( * )
00015       REAL               RWORK( * )
00016       COMPLEX            A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
00017 *     ..
00018 *
00019 *  Purpose
00020 *  =======
00021 *
00022 *  CSYT01 reconstructs a complex symmetric indefinite matrix A from its
00023 *  block L*D*L' or U*D*U' factorization and computes the residual
00024 *     norm( C - A ) / ( N * norm(A) * EPS ),
00025 *  where C is the reconstructed matrix, EPS is the machine epsilon,
00026 *  L' is the transpose of L, and U' is the transpose of U.
00027 *
00028 *  Arguments
00029 *  ==========
00030 *
00031 *  UPLO    (input) CHARACTER*1
00032 *          Specifies whether the upper or lower triangular part of the
00033 *          complex symmetric matrix A is stored:
00034 *          = 'U':  Upper triangular
00035 *          = 'L':  Lower triangular
00036 *
00037 *  N       (input) INTEGER
00038 *          The number of rows and columns of the matrix A.  N >= 0.
00039 *
00040 *  A       (input) COMPLEX array, dimension (LDA,N)
00041 *          The original complex symmetric matrix A.
00042 *
00043 *  LDA     (input) INTEGER
00044 *          The leading dimension of the array A.  LDA >= max(1,N)
00045 *
00046 *  AFAC    (input) COMPLEX array, dimension (LDAFAC,N)
00047 *          The factored form of the matrix A.  AFAC contains the block
00048 *          diagonal matrix D and the multipliers used to obtain the
00049 *          factor L or U from the block L*D*L' or U*D*U' factorization
00050 *          as computed by CSYTRF.
00051 *
00052 *  LDAFAC  (input) INTEGER
00053 *          The leading dimension of the array AFAC.  LDAFAC >= max(1,N).
00054 *
00055 *  IPIV    (input) INTEGER array, dimension (N)
00056 *          The pivot indices from CSYTRF.
00057 *
00058 *  C       (workspace) COMPLEX array, dimension (LDC,N)
00059 *
00060 *  LDC     (integer) INTEGER
00061 *          The leading dimension of the array C.  LDC >= max(1,N).
00062 *
00063 *  RWORK   (workspace) REAL array, dimension (N)
00064 *
00065 *  RESID   (output) REAL
00066 *          If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
00067 *          If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
00068 *
00069 *  =====================================================================
00070 *
00071 *     .. Parameters ..
00072       REAL               ZERO, ONE
00073       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00074       COMPLEX            CZERO, CONE
00075       PARAMETER          ( CZERO = ( 0.0E+0, 0.0E+0 ),
00076      \$                   CONE = ( 1.0E+0, 0.0E+0 ) )
00077 *     ..
00078 *     .. Local Scalars ..
00079       INTEGER            I, INFO, J
00080       REAL               ANORM, EPS
00081 *     ..
00082 *     .. External Functions ..
00083       LOGICAL            LSAME
00084       REAL               CLANSY, SLAMCH
00085       EXTERNAL           LSAME, CLANSY, SLAMCH
00086 *     ..
00087 *     .. External Subroutines ..
00088       EXTERNAL           CLAVSY, CLASET
00089 *     ..
00090 *     .. Intrinsic Functions ..
00091       INTRINSIC          REAL
00092 *     ..
00093 *     .. Executable Statements ..
00094 *
00095 *     Quick exit if N = 0.
00096 *
00097       IF( N.LE.0 ) THEN
00098          RESID = ZERO
00099          RETURN
00100       END IF
00101 *
00102 *     Determine EPS and the norm of A.
00103 *
00104       EPS = SLAMCH( 'Epsilon' )
00105       ANORM = CLANSY( '1', UPLO, N, A, LDA, RWORK )
00106 *
00107 *     Initialize C to the identity matrix.
00108 *
00109       CALL CLASET( 'Full', N, N, CZERO, CONE, C, LDC )
00110 *
00111 *     Call CLAVSY to form the product D * U' (or D * L' ).
00112 *
00113       CALL CLAVSY( UPLO, 'Transpose', 'Non-unit', N, N, AFAC, LDAFAC,
00114      \$             IPIV, C, LDC, INFO )
00115 *
00116 *     Call CLAVSY again to multiply by U (or L ).
00117 *
00118       CALL CLAVSY( UPLO, 'No transpose', 'Unit', N, N, AFAC, LDAFAC,
00119      \$             IPIV, C, LDC, INFO )
00120 *
00121 *     Compute the difference  C - A .
00122 *
00123       IF( LSAME( UPLO, 'U' ) ) THEN
00124          DO 20 J = 1, N
00125             DO 10 I = 1, J
00126                C( I, J ) = C( I, J ) - A( I, J )
00127    10       CONTINUE
00128    20    CONTINUE
00129       ELSE
00130          DO 40 J = 1, N
00131             DO 30 I = J, N
00132                C( I, J ) = C( I, J ) - A( I, J )
00133    30       CONTINUE
00134    40    CONTINUE
00135       END IF
00136 *
00137 *     Compute norm( C - A ) / ( N * norm(A) * EPS )
00138 *
00139       RESID = CLANSY( '1', UPLO, N, C, LDC, RWORK )
00140 *
00141       IF( ANORM.LE.ZERO ) THEN
00142          IF( RESID.NE.ZERO )
00143      \$      RESID = ONE / EPS
00144       ELSE
00145          RESID = ( ( RESID/REAL( N ) )/ANORM ) / EPS
00146       END IF
00147 *
00148       RETURN
00149 *
00150 *     End of CSYT01
00151 *
00152       END
```