LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zspt02.f
Go to the documentation of this file.
00001 *> \brief \b ZSPT02
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       SUBROUTINE ZSPT02( UPLO, N, NRHS, A, X, LDX, B, LDB, RWORK,
00012 *                          RESID )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER          UPLO
00016 *       INTEGER            LDB, LDX, N, NRHS
00017 *       DOUBLE PRECISION   RESID
00018 *       ..
00019 *       .. Array Arguments ..
00020 *       DOUBLE PRECISION   RWORK( * )
00021 *       COMPLEX*16         A( * ), B( LDB, * ), X( LDX, * )
00022 *       ..
00023 *  
00024 *
00025 *> \par Purpose:
00026 *  =============
00027 *>
00028 *> \verbatim
00029 *>
00030 *> ZSPT02 computes the residual in the solution of a complex symmetric
00031 *> system of linear equations  A*x = b  when packed storage is used for
00032 *> the coefficient matrix.  The ratio computed is
00033 *>
00034 *>    RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS).
00035 *>
00036 *> where EPS is the machine precision.
00037 *> \endverbatim
00038 *
00039 *  Arguments:
00040 *  ==========
00041 *
00042 *> \param[in] UPLO
00043 *> \verbatim
00044 *>          UPLO is CHARACTER*1
00045 *>          Specifies whether the upper or lower triangular part of the
00046 *>          complex symmetric matrix A is stored:
00047 *>          = 'U':  Upper triangular
00048 *>          = 'L':  Lower triangular
00049 *> \endverbatim
00050 *>
00051 *> \param[in] N
00052 *> \verbatim
00053 *>          N is INTEGER
00054 *>          The number of rows and columns of the matrix A.  N >= 0.
00055 *> \endverbatim
00056 *>
00057 *> \param[in] NRHS
00058 *> \verbatim
00059 *>          NRHS is INTEGER
00060 *>          The number of columns of B, the matrix of right hand sides.
00061 *>          NRHS >= 0.
00062 *> \endverbatim
00063 *>
00064 *> \param[in] A
00065 *> \verbatim
00066 *>          A is COMPLEX*16 array, dimension (N*(N+1)/2)
00067 *>          The original complex symmetric matrix A, stored as a packed
00068 *>          triangular matrix.
00069 *> \endverbatim
00070 *>
00071 *> \param[in] X
00072 *> \verbatim
00073 *>          X is COMPLEX*16 array, dimension (LDX,NRHS)
00074 *>          The computed solution vectors for the system of linear
00075 *>          equations.
00076 *> \endverbatim
00077 *>
00078 *> \param[in] LDX
00079 *> \verbatim
00080 *>          LDX is INTEGER
00081 *>          The leading dimension of the array X.   LDX >= max(1,N).
00082 *> \endverbatim
00083 *>
00084 *> \param[in,out] B
00085 *> \verbatim
00086 *>          B is COMPLEX*16 array, dimension (LDB,NRHS)
00087 *>          On entry, the right hand side vectors for the system of
00088 *>          linear equations.
00089 *>          On exit, B is overwritten with the difference B - A*X.
00090 *> \endverbatim
00091 *>
00092 *> \param[in] LDB
00093 *> \verbatim
00094 *>          LDB is INTEGER
00095 *>          The leading dimension of the array B.  LDB >= max(1,N).
00096 *> \endverbatim
00097 *>
00098 *> \param[out] RWORK
00099 *> \verbatim
00100 *>          RWORK is DOUBLE PRECISION array, dimension (N)
00101 *> \endverbatim
00102 *>
00103 *> \param[out] RESID
00104 *> \verbatim
00105 *>          RESID is DOUBLE PRECISION
00106 *>          The maximum over the number of right hand sides of
00107 *>          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
00108 *> \endverbatim
00109 *
00110 *  Authors:
00111 *  ========
00112 *
00113 *> \author Univ. of Tennessee 
00114 *> \author Univ. of California Berkeley 
00115 *> \author Univ. of Colorado Denver 
00116 *> \author NAG Ltd. 
00117 *
00118 *> \date November 2011
00119 *
00120 *> \ingroup complex16_lin
00121 *
00122 *  =====================================================================
00123       SUBROUTINE ZSPT02( UPLO, N, NRHS, A, X, LDX, B, LDB, RWORK,
00124      $                   RESID )
00125 *
00126 *  -- LAPACK test routine (version 3.4.0) --
00127 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00128 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00129 *     November 2011
00130 *
00131 *     .. Scalar Arguments ..
00132       CHARACTER          UPLO
00133       INTEGER            LDB, LDX, N, NRHS
00134       DOUBLE PRECISION   RESID
00135 *     ..
00136 *     .. Array Arguments ..
00137       DOUBLE PRECISION   RWORK( * )
00138       COMPLEX*16         A( * ), B( LDB, * ), X( LDX, * )
00139 *     ..
00140 *
00141 *  =====================================================================
00142 *
00143 *     .. Parameters ..
00144       DOUBLE PRECISION   ZERO, ONE
00145       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00146       COMPLEX*16         CONE
00147       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
00148 *     ..
00149 *     .. Local Scalars ..
00150       INTEGER            J
00151       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00152 *     ..
00153 *     .. External Functions ..
00154       DOUBLE PRECISION   DLAMCH, DZASUM, ZLANSP
00155       EXTERNAL           DLAMCH, DZASUM, ZLANSP
00156 *     ..
00157 *     .. External Subroutines ..
00158       EXTERNAL           ZSPMV
00159 *     ..
00160 *     .. Intrinsic Functions ..
00161       INTRINSIC          MAX
00162 *     ..
00163 *     .. Executable Statements ..
00164 *
00165 *     Quick exit if N = 0 or NRHS = 0
00166 *
00167       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00168          RESID = ZERO
00169          RETURN
00170       END IF
00171 *
00172 *     Exit with RESID = 1/EPS if ANORM = 0.
00173 *
00174       EPS = DLAMCH( 'Epsilon' )
00175       ANORM = ZLANSP( '1', UPLO, N, A, RWORK )
00176       IF( ANORM.LE.ZERO ) THEN
00177          RESID = ONE / EPS
00178          RETURN
00179       END IF
00180 *
00181 *     Compute  B - A*X  for the matrix of right hand sides B.
00182 *
00183       DO 10 J = 1, NRHS
00184          CALL ZSPMV( UPLO, N, -CONE, A, X( 1, J ), 1, CONE, B( 1, J ),
00185      $               1 )
00186    10 CONTINUE
00187 *
00188 *     Compute the maximum over the number of right hand sides of
00189 *        norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) .
00190 *
00191       RESID = ZERO
00192       DO 20 J = 1, NRHS
00193          BNORM = DZASUM( N, B( 1, J ), 1 )
00194          XNORM = DZASUM( N, X( 1, J ), 1 )
00195          IF( XNORM.LE.ZERO ) THEN
00196             RESID = ONE / EPS
00197          ELSE
00198             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00199          END IF
00200    20 CONTINUE
00201 *
00202       RETURN
00203 *
00204 *     End of ZSPT02
00205 *
00206       END
 All Files Functions