LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ztbcon.f
Go to the documentation of this file.
00001 *> \brief \b ZTBCON
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download ZTBCON + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztbcon.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztbcon.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztbcon.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE ZTBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
00022 *                          RWORK, INFO )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          DIAG, NORM, UPLO
00026 *       INTEGER            INFO, KD, LDAB, N
00027 *       DOUBLE PRECISION   RCOND
00028 *       ..
00029 *       .. Array Arguments ..
00030 *       DOUBLE PRECISION   RWORK( * )
00031 *       COMPLEX*16         AB( LDAB, * ), WORK( * )
00032 *       ..
00033 *  
00034 *
00035 *> \par Purpose:
00036 *  =============
00037 *>
00038 *> \verbatim
00039 *>
00040 *> ZTBCON estimates the reciprocal of the condition number of a
00041 *> triangular band matrix A, in either the 1-norm or the infinity-norm.
00042 *>
00043 *> The norm of A is computed and an estimate is obtained for
00044 *> norm(inv(A)), then the reciprocal of the condition number is
00045 *> computed as
00046 *>    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] NORM
00053 *> \verbatim
00054 *>          NORM is CHARACTER*1
00055 *>          Specifies whether the 1-norm condition number or the
00056 *>          infinity-norm condition number is required:
00057 *>          = '1' or 'O':  1-norm;
00058 *>          = 'I':         Infinity-norm.
00059 *> \endverbatim
00060 *>
00061 *> \param[in] UPLO
00062 *> \verbatim
00063 *>          UPLO is CHARACTER*1
00064 *>          = 'U':  A is upper triangular;
00065 *>          = 'L':  A is lower triangular.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] DIAG
00069 *> \verbatim
00070 *>          DIAG is CHARACTER*1
00071 *>          = 'N':  A is non-unit triangular;
00072 *>          = 'U':  A is unit triangular.
00073 *> \endverbatim
00074 *>
00075 *> \param[in] N
00076 *> \verbatim
00077 *>          N is INTEGER
00078 *>          The order of the matrix A.  N >= 0.
00079 *> \endverbatim
00080 *>
00081 *> \param[in] KD
00082 *> \verbatim
00083 *>          KD is INTEGER
00084 *>          The number of superdiagonals or subdiagonals of the
00085 *>          triangular band matrix A.  KD >= 0.
00086 *> \endverbatim
00087 *>
00088 *> \param[in] AB
00089 *> \verbatim
00090 *>          AB is COMPLEX*16 array, dimension (LDAB,N)
00091 *>          The upper or lower triangular band matrix A, stored in the
00092 *>          first kd+1 rows of the array. The j-th column of A is stored
00093 *>          in the j-th column of the array AB as follows:
00094 *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00095 *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00096 *>          If DIAG = 'U', the diagonal elements of A are not referenced
00097 *>          and are assumed to be 1.
00098 *> \endverbatim
00099 *>
00100 *> \param[in] LDAB
00101 *> \verbatim
00102 *>          LDAB is INTEGER
00103 *>          The leading dimension of the array AB.  LDAB >= KD+1.
00104 *> \endverbatim
00105 *>
00106 *> \param[out] RCOND
00107 *> \verbatim
00108 *>          RCOND is DOUBLE PRECISION
00109 *>          The reciprocal of the condition number of the matrix A,
00110 *>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
00111 *> \endverbatim
00112 *>
00113 *> \param[out] WORK
00114 *> \verbatim
00115 *>          WORK is COMPLEX*16 array, dimension (2*N)
00116 *> \endverbatim
00117 *>
00118 *> \param[out] RWORK
00119 *> \verbatim
00120 *>          RWORK is DOUBLE PRECISION array, dimension (N)
00121 *> \endverbatim
00122 *>
00123 *> \param[out] INFO
00124 *> \verbatim
00125 *>          INFO is INTEGER
00126 *>          = 0:  successful exit
00127 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00128 *> \endverbatim
00129 *
00130 *  Authors:
00131 *  ========
00132 *
00133 *> \author Univ. of Tennessee 
00134 *> \author Univ. of California Berkeley 
00135 *> \author Univ. of Colorado Denver 
00136 *> \author NAG Ltd. 
00137 *
00138 *> \date November 2011
00139 *
00140 *> \ingroup complex16OTHERcomputational
00141 *
00142 *  =====================================================================
00143       SUBROUTINE ZTBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
00144      $                   RWORK, INFO )
00145 *
00146 *  -- LAPACK computational routine (version 3.4.0) --
00147 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00148 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00149 *     November 2011
00150 *
00151 *     .. Scalar Arguments ..
00152       CHARACTER          DIAG, NORM, UPLO
00153       INTEGER            INFO, KD, LDAB, N
00154       DOUBLE PRECISION   RCOND
00155 *     ..
00156 *     .. Array Arguments ..
00157       DOUBLE PRECISION   RWORK( * )
00158       COMPLEX*16         AB( LDAB, * ), WORK( * )
00159 *     ..
00160 *
00161 *  =====================================================================
00162 *
00163 *     .. Parameters ..
00164       DOUBLE PRECISION   ONE, ZERO
00165       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00166 *     ..
00167 *     .. Local Scalars ..
00168       LOGICAL            NOUNIT, ONENRM, UPPER
00169       CHARACTER          NORMIN
00170       INTEGER            IX, KASE, KASE1
00171       DOUBLE PRECISION   AINVNM, ANORM, SCALE, SMLNUM, XNORM
00172       COMPLEX*16         ZDUM
00173 *     ..
00174 *     .. Local Arrays ..
00175       INTEGER            ISAVE( 3 )
00176 *     ..
00177 *     .. External Functions ..
00178       LOGICAL            LSAME
00179       INTEGER            IZAMAX
00180       DOUBLE PRECISION   DLAMCH, ZLANTB
00181       EXTERNAL           LSAME, IZAMAX, DLAMCH, ZLANTB
00182 *     ..
00183 *     .. External Subroutines ..
00184       EXTERNAL           XERBLA, ZDRSCL, ZLACN2, ZLATBS
00185 *     ..
00186 *     .. Intrinsic Functions ..
00187       INTRINSIC          ABS, DBLE, DIMAG, MAX
00188 *     ..
00189 *     .. Statement Functions ..
00190       DOUBLE PRECISION   CABS1
00191 *     ..
00192 *     .. Statement Function definitions ..
00193       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00194 *     ..
00195 *     .. Executable Statements ..
00196 *
00197 *     Test the input parameters.
00198 *
00199       INFO = 0
00200       UPPER = LSAME( UPLO, 'U' )
00201       ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
00202       NOUNIT = LSAME( DIAG, 'N' )
00203 *
00204       IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
00205          INFO = -1
00206       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00207          INFO = -2
00208       ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
00209          INFO = -3
00210       ELSE IF( N.LT.0 ) THEN
00211          INFO = -4
00212       ELSE IF( KD.LT.0 ) THEN
00213          INFO = -5
00214       ELSE IF( LDAB.LT.KD+1 ) THEN
00215          INFO = -7
00216       END IF
00217       IF( INFO.NE.0 ) THEN
00218          CALL XERBLA( 'ZTBCON', -INFO )
00219          RETURN
00220       END IF
00221 *
00222 *     Quick return if possible
00223 *
00224       IF( N.EQ.0 ) THEN
00225          RCOND = ONE
00226          RETURN
00227       END IF
00228 *
00229       RCOND = ZERO
00230       SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( N, 1 ) )
00231 *
00232 *     Compute the 1-norm of the triangular matrix A or A**H.
00233 *
00234       ANORM = ZLANTB( NORM, UPLO, DIAG, N, KD, AB, LDAB, RWORK )
00235 *
00236 *     Continue only if ANORM > 0.
00237 *
00238       IF( ANORM.GT.ZERO ) THEN
00239 *
00240 *        Estimate the 1-norm of the inverse of A.
00241 *
00242          AINVNM = ZERO
00243          NORMIN = 'N'
00244          IF( ONENRM ) THEN
00245             KASE1 = 1
00246          ELSE
00247             KASE1 = 2
00248          END IF
00249          KASE = 0
00250    10    CONTINUE
00251          CALL ZLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
00252          IF( KASE.NE.0 ) THEN
00253             IF( KASE.EQ.KASE1 ) THEN
00254 *
00255 *              Multiply by inv(A).
00256 *
00257                CALL ZLATBS( UPLO, 'No transpose', DIAG, NORMIN, N, KD,
00258      $                      AB, LDAB, WORK, SCALE, RWORK, INFO )
00259             ELSE
00260 *
00261 *              Multiply by inv(A**H).
00262 *
00263                CALL ZLATBS( UPLO, 'Conjugate transpose', DIAG, NORMIN,
00264      $                      N, KD, AB, LDAB, WORK, SCALE, RWORK, INFO )
00265             END IF
00266             NORMIN = 'Y'
00267 *
00268 *           Multiply by 1/SCALE if doing so will not cause overflow.
00269 *
00270             IF( SCALE.NE.ONE ) THEN
00271                IX = IZAMAX( N, WORK, 1 )
00272                XNORM = CABS1( WORK( IX ) )
00273                IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
00274      $            GO TO 20
00275                CALL ZDRSCL( N, SCALE, WORK, 1 )
00276             END IF
00277             GO TO 10
00278          END IF
00279 *
00280 *        Compute the estimate of the reciprocal condition number.
00281 *
00282          IF( AINVNM.NE.ZERO )
00283      $      RCOND = ( ONE / ANORM ) / AINVNM
00284       END IF
00285 *
00286    20 CONTINUE
00287       RETURN
00288 *
00289 *     End of ZTBCON
00290 *
00291       END
 All Files Functions