Annotation of rpl/lapack/lapack/ztbcon.f, revision 1.18

1.9       bertrand    1: *> \brief \b ZTBCON
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.9       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download ZTBCON + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztbcon.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztbcon.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztbcon.f">
1.9       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.9       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZTBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
                     22: *                          RWORK, INFO )
1.15      bertrand   23: *
1.9       bertrand   24: *       .. Scalar Arguments ..
                     25: *       CHARACTER          DIAG, NORM, UPLO
                     26: *       INTEGER            INFO, KD, LDAB, N
                     27: *       DOUBLE PRECISION   RCOND
                     28: *       ..
                     29: *       .. Array Arguments ..
                     30: *       DOUBLE PRECISION   RWORK( * )
                     31: *       COMPLEX*16         AB( LDAB, * ), WORK( * )
                     32: *       ..
1.15      bertrand   33: *
1.9       bertrand   34: *
                     35: *> \par Purpose:
                     36: *  =============
                     37: *>
                     38: *> \verbatim
                     39: *>
                     40: *> ZTBCON estimates the reciprocal of the condition number of a
                     41: *> triangular band matrix A, in either the 1-norm or the infinity-norm.
                     42: *>
                     43: *> The norm of A is computed and an estimate is obtained for
                     44: *> norm(inv(A)), then the reciprocal of the condition number is
                     45: *> computed as
                     46: *>    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
                     47: *> \endverbatim
                     48: *
                     49: *  Arguments:
                     50: *  ==========
                     51: *
                     52: *> \param[in] NORM
                     53: *> \verbatim
                     54: *>          NORM is CHARACTER*1
                     55: *>          Specifies whether the 1-norm condition number or the
                     56: *>          infinity-norm condition number is required:
                     57: *>          = '1' or 'O':  1-norm;
                     58: *>          = 'I':         Infinity-norm.
                     59: *> \endverbatim
                     60: *>
                     61: *> \param[in] UPLO
                     62: *> \verbatim
                     63: *>          UPLO is CHARACTER*1
                     64: *>          = 'U':  A is upper triangular;
                     65: *>          = 'L':  A is lower triangular.
                     66: *> \endverbatim
                     67: *>
                     68: *> \param[in] DIAG
                     69: *> \verbatim
                     70: *>          DIAG is CHARACTER*1
                     71: *>          = 'N':  A is non-unit triangular;
                     72: *>          = 'U':  A is unit triangular.
                     73: *> \endverbatim
                     74: *>
                     75: *> \param[in] N
                     76: *> \verbatim
                     77: *>          N is INTEGER
                     78: *>          The order of the matrix A.  N >= 0.
                     79: *> \endverbatim
                     80: *>
                     81: *> \param[in] KD
                     82: *> \verbatim
                     83: *>          KD is INTEGER
                     84: *>          The number of superdiagonals or subdiagonals of the
                     85: *>          triangular band matrix A.  KD >= 0.
                     86: *> \endverbatim
                     87: *>
                     88: *> \param[in] AB
                     89: *> \verbatim
                     90: *>          AB is COMPLEX*16 array, dimension (LDAB,N)
                     91: *>          The upper or lower triangular band matrix A, stored in the
                     92: *>          first kd+1 rows of the array. The j-th column of A is stored
                     93: *>          in the j-th column of the array AB as follows:
                     94: *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
                     95: *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
                     96: *>          If DIAG = 'U', the diagonal elements of A are not referenced
                     97: *>          and are assumed to be 1.
                     98: *> \endverbatim
                     99: *>
                    100: *> \param[in] LDAB
                    101: *> \verbatim
                    102: *>          LDAB is INTEGER
                    103: *>          The leading dimension of the array AB.  LDAB >= KD+1.
                    104: *> \endverbatim
                    105: *>
                    106: *> \param[out] RCOND
                    107: *> \verbatim
                    108: *>          RCOND is DOUBLE PRECISION
                    109: *>          The reciprocal of the condition number of the matrix A,
                    110: *>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
                    111: *> \endverbatim
                    112: *>
                    113: *> \param[out] WORK
                    114: *> \verbatim
                    115: *>          WORK is COMPLEX*16 array, dimension (2*N)
                    116: *> \endverbatim
                    117: *>
                    118: *> \param[out] RWORK
                    119: *> \verbatim
                    120: *>          RWORK is DOUBLE PRECISION array, dimension (N)
                    121: *> \endverbatim
                    122: *>
                    123: *> \param[out] INFO
                    124: *> \verbatim
                    125: *>          INFO is INTEGER
                    126: *>          = 0:  successful exit
                    127: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
                    128: *> \endverbatim
                    129: *
                    130: *  Authors:
                    131: *  ========
                    132: *
1.15      bertrand  133: *> \author Univ. of Tennessee
                    134: *> \author Univ. of California Berkeley
                    135: *> \author Univ. of Colorado Denver
                    136: *> \author NAG Ltd.
1.9       bertrand  137: *
                    138: *> \ingroup complex16OTHERcomputational
                    139: *
                    140: *  =====================================================================
1.1       bertrand  141:       SUBROUTINE ZTBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
                    142:      $                   RWORK, INFO )
                    143: *
1.18    ! bertrand  144: *  -- LAPACK computational routine --
1.1       bertrand  145: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    146: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    147: *
                    148: *     .. Scalar Arguments ..
                    149:       CHARACTER          DIAG, NORM, UPLO
                    150:       INTEGER            INFO, KD, LDAB, N
                    151:       DOUBLE PRECISION   RCOND
                    152: *     ..
                    153: *     .. Array Arguments ..
                    154:       DOUBLE PRECISION   RWORK( * )
                    155:       COMPLEX*16         AB( LDAB, * ), WORK( * )
                    156: *     ..
                    157: *
                    158: *  =====================================================================
                    159: *
                    160: *     .. Parameters ..
                    161:       DOUBLE PRECISION   ONE, ZERO
                    162:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
                    163: *     ..
                    164: *     .. Local Scalars ..
                    165:       LOGICAL            NOUNIT, ONENRM, UPPER
                    166:       CHARACTER          NORMIN
                    167:       INTEGER            IX, KASE, KASE1
                    168:       DOUBLE PRECISION   AINVNM, ANORM, SCALE, SMLNUM, XNORM
                    169:       COMPLEX*16         ZDUM
                    170: *     ..
                    171: *     .. Local Arrays ..
                    172:       INTEGER            ISAVE( 3 )
                    173: *     ..
                    174: *     .. External Functions ..
                    175:       LOGICAL            LSAME
                    176:       INTEGER            IZAMAX
                    177:       DOUBLE PRECISION   DLAMCH, ZLANTB
                    178:       EXTERNAL           LSAME, IZAMAX, DLAMCH, ZLANTB
                    179: *     ..
                    180: *     .. External Subroutines ..
                    181:       EXTERNAL           XERBLA, ZDRSCL, ZLACN2, ZLATBS
                    182: *     ..
                    183: *     .. Intrinsic Functions ..
                    184:       INTRINSIC          ABS, DBLE, DIMAG, MAX
                    185: *     ..
                    186: *     .. Statement Functions ..
                    187:       DOUBLE PRECISION   CABS1
                    188: *     ..
                    189: *     .. Statement Function definitions ..
                    190:       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
                    191: *     ..
                    192: *     .. Executable Statements ..
                    193: *
                    194: *     Test the input parameters.
                    195: *
                    196:       INFO = 0
                    197:       UPPER = LSAME( UPLO, 'U' )
                    198:       ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
                    199:       NOUNIT = LSAME( DIAG, 'N' )
                    200: *
                    201:       IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
                    202:          INFO = -1
                    203:       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    204:          INFO = -2
                    205:       ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
                    206:          INFO = -3
                    207:       ELSE IF( N.LT.0 ) THEN
                    208:          INFO = -4
                    209:       ELSE IF( KD.LT.0 ) THEN
                    210:          INFO = -5
                    211:       ELSE IF( LDAB.LT.KD+1 ) THEN
                    212:          INFO = -7
                    213:       END IF
                    214:       IF( INFO.NE.0 ) THEN
                    215:          CALL XERBLA( 'ZTBCON', -INFO )
                    216:          RETURN
                    217:       END IF
                    218: *
                    219: *     Quick return if possible
                    220: *
                    221:       IF( N.EQ.0 ) THEN
                    222:          RCOND = ONE
                    223:          RETURN
                    224:       END IF
                    225: *
                    226:       RCOND = ZERO
                    227:       SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( N, 1 ) )
                    228: *
1.8       bertrand  229: *     Compute the 1-norm of the triangular matrix A or A**H.
1.1       bertrand  230: *
                    231:       ANORM = ZLANTB( NORM, UPLO, DIAG, N, KD, AB, LDAB, RWORK )
                    232: *
                    233: *     Continue only if ANORM > 0.
                    234: *
                    235:       IF( ANORM.GT.ZERO ) THEN
                    236: *
                    237: *        Estimate the 1-norm of the inverse of A.
                    238: *
                    239:          AINVNM = ZERO
                    240:          NORMIN = 'N'
                    241:          IF( ONENRM ) THEN
                    242:             KASE1 = 1
                    243:          ELSE
                    244:             KASE1 = 2
                    245:          END IF
                    246:          KASE = 0
                    247:    10    CONTINUE
                    248:          CALL ZLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
                    249:          IF( KASE.NE.0 ) THEN
                    250:             IF( KASE.EQ.KASE1 ) THEN
                    251: *
                    252: *              Multiply by inv(A).
                    253: *
                    254:                CALL ZLATBS( UPLO, 'No transpose', DIAG, NORMIN, N, KD,
                    255:      $                      AB, LDAB, WORK, SCALE, RWORK, INFO )
                    256:             ELSE
                    257: *
1.8       bertrand  258: *              Multiply by inv(A**H).
1.1       bertrand  259: *
                    260:                CALL ZLATBS( UPLO, 'Conjugate transpose', DIAG, NORMIN,
                    261:      $                      N, KD, AB, LDAB, WORK, SCALE, RWORK, INFO )
                    262:             END IF
                    263:             NORMIN = 'Y'
                    264: *
                    265: *           Multiply by 1/SCALE if doing so will not cause overflow.
                    266: *
                    267:             IF( SCALE.NE.ONE ) THEN
                    268:                IX = IZAMAX( N, WORK, 1 )
                    269:                XNORM = CABS1( WORK( IX ) )
                    270:                IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
                    271:      $            GO TO 20
                    272:                CALL ZDRSCL( N, SCALE, WORK, 1 )
                    273:             END IF
                    274:             GO TO 10
                    275:          END IF
                    276: *
                    277: *        Compute the estimate of the reciprocal condition number.
                    278: *
                    279:          IF( AINVNM.NE.ZERO )
                    280:      $      RCOND = ( ONE / ANORM ) / AINVNM
                    281:       END IF
                    282: *
                    283:    20 CONTINUE
                    284:       RETURN
                    285: *
                    286: *     End of ZTBCON
                    287: *
                    288:       END

CVSweb interface <joel.bertrand@systella.fr>