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

1.11      bertrand    1: *> \brief \b ZLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix.
1.8       bertrand    2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.8       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download ZLANTB + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlantb.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlantb.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlantb.f">
1.8       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.8       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       DOUBLE PRECISION FUNCTION ZLANTB( NORM, UPLO, DIAG, N, K, AB,
                     22: *                        LDAB, WORK )
1.15      bertrand   23: *
1.8       bertrand   24: *       .. Scalar Arguments ..
                     25: *       CHARACTER          DIAG, NORM, UPLO
                     26: *       INTEGER            K, LDAB, N
                     27: *       ..
                     28: *       .. Array Arguments ..
                     29: *       DOUBLE PRECISION   WORK( * )
                     30: *       COMPLEX*16         AB( LDAB, * )
                     31: *       ..
1.15      bertrand   32: *
1.8       bertrand   33: *
                     34: *> \par Purpose:
                     35: *  =============
                     36: *>
                     37: *> \verbatim
                     38: *>
                     39: *> ZLANTB  returns the value of the one norm,  or the Frobenius norm, or
                     40: *> the  infinity norm,  or the element of  largest absolute value  of an
                     41: *> n by n triangular band matrix A,  with ( k + 1 ) diagonals.
                     42: *> \endverbatim
                     43: *>
                     44: *> \return ZLANTB
                     45: *> \verbatim
                     46: *>
                     47: *>    ZLANTB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
                     48: *>             (
                     49: *>             ( norm1(A),         NORM = '1', 'O' or 'o'
                     50: *>             (
                     51: *>             ( normI(A),         NORM = 'I' or 'i'
                     52: *>             (
                     53: *>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
                     54: *>
                     55: *> where  norm1  denotes the  one norm of a matrix (maximum column sum),
                     56: *> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
                     57: *> normF  denotes the  Frobenius norm of a matrix (square root of sum of
                     58: *> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
                     59: *> \endverbatim
                     60: *
                     61: *  Arguments:
                     62: *  ==========
                     63: *
                     64: *> \param[in] NORM
                     65: *> \verbatim
                     66: *>          NORM is CHARACTER*1
                     67: *>          Specifies the value to be returned in ZLANTB as described
                     68: *>          above.
                     69: *> \endverbatim
                     70: *>
                     71: *> \param[in] UPLO
                     72: *> \verbatim
                     73: *>          UPLO is CHARACTER*1
                     74: *>          Specifies whether the matrix A is upper or lower triangular.
                     75: *>          = 'U':  Upper triangular
                     76: *>          = 'L':  Lower triangular
                     77: *> \endverbatim
                     78: *>
                     79: *> \param[in] DIAG
                     80: *> \verbatim
                     81: *>          DIAG is CHARACTER*1
                     82: *>          Specifies whether or not the matrix A is unit triangular.
                     83: *>          = 'N':  Non-unit triangular
                     84: *>          = 'U':  Unit triangular
                     85: *> \endverbatim
                     86: *>
                     87: *> \param[in] N
                     88: *> \verbatim
                     89: *>          N is INTEGER
                     90: *>          The order of the matrix A.  N >= 0.  When N = 0, ZLANTB is
                     91: *>          set to zero.
                     92: *> \endverbatim
                     93: *>
                     94: *> \param[in] K
                     95: *> \verbatim
                     96: *>          K is INTEGER
                     97: *>          The number of super-diagonals of the matrix A if UPLO = 'U',
                     98: *>          or the number of sub-diagonals of the matrix A if UPLO = 'L'.
                     99: *>          K >= 0.
                    100: *> \endverbatim
                    101: *>
                    102: *> \param[in] AB
                    103: *> \verbatim
                    104: *>          AB is COMPLEX*16 array, dimension (LDAB,N)
                    105: *>          The upper or lower triangular band matrix A, stored in the
                    106: *>          first k+1 rows of AB.  The j-th column of A is stored
                    107: *>          in the j-th column of the array AB as follows:
                    108: *>          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
                    109: *>          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
                    110: *>          Note that when DIAG = 'U', the elements of the array AB
                    111: *>          corresponding to the diagonal elements of the matrix A are
                    112: *>          not referenced, but are assumed to be one.
                    113: *> \endverbatim
                    114: *>
                    115: *> \param[in] LDAB
                    116: *> \verbatim
                    117: *>          LDAB is INTEGER
                    118: *>          The leading dimension of the array AB.  LDAB >= K+1.
                    119: *> \endverbatim
                    120: *>
                    121: *> \param[out] WORK
                    122: *> \verbatim
                    123: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
                    124: *>          where LWORK >= N when NORM = 'I'; otherwise, WORK is not
                    125: *>          referenced.
                    126: *> \endverbatim
                    127: *
                    128: *  Authors:
                    129: *  ========
                    130: *
1.15      bertrand  131: *> \author Univ. of Tennessee
                    132: *> \author Univ. of California Berkeley
                    133: *> \author Univ. of Colorado Denver
                    134: *> \author NAG Ltd.
1.8       bertrand  135: *
1.15      bertrand  136: *> \date December 2016
1.8       bertrand  137: *
                    138: *> \ingroup complex16OTHERauxiliary
                    139: *
                    140: *  =====================================================================
1.1       bertrand  141:       DOUBLE PRECISION FUNCTION ZLANTB( NORM, UPLO, DIAG, N, K, AB,
                    142:      $                 LDAB, WORK )
                    143: *
1.15      bertrand  144: *  -- LAPACK auxiliary routine (version 3.7.0) --
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..--
1.15      bertrand  147: *     December 2016
1.1       bertrand  148: *
1.18    ! bertrand  149:       IMPLICIT NONE
1.1       bertrand  150: *     .. Scalar Arguments ..
                    151:       CHARACTER          DIAG, NORM, UPLO
                    152:       INTEGER            K, LDAB, N
                    153: *     ..
                    154: *     .. Array Arguments ..
                    155:       DOUBLE PRECISION   WORK( * )
                    156:       COMPLEX*16         AB( LDAB, * )
                    157: *     ..
                    158: *
                    159: * =====================================================================
                    160: *
                    161: *     .. Parameters ..
                    162:       DOUBLE PRECISION   ONE, ZERO
                    163:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
                    164: *     ..
                    165: *     .. Local Scalars ..
                    166:       LOGICAL            UDIAG
                    167:       INTEGER            I, J, L
1.18    ! bertrand  168:       DOUBLE PRECISION   SUM, VALUE
        !           169: *     ..
        !           170: *     .. Local Arrays ..
        !           171:       DOUBLE PRECISION   SSQ( 2 ), COLSSQ( 2 )
1.1       bertrand  172: *     ..
                    173: *     .. External Functions ..
1.11      bertrand  174:       LOGICAL            LSAME, DISNAN
                    175:       EXTERNAL           LSAME, DISNAN
1.1       bertrand  176: *     ..
                    177: *     .. External Subroutines ..
1.18    ! bertrand  178:       EXTERNAL           ZLASSQ, DCOMBSSQ
1.1       bertrand  179: *     ..
                    180: *     .. Intrinsic Functions ..
                    181:       INTRINSIC          ABS, MAX, MIN, SQRT
                    182: *     ..
                    183: *     .. Executable Statements ..
                    184: *
                    185:       IF( N.EQ.0 ) THEN
                    186:          VALUE = ZERO
                    187:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
                    188: *
                    189: *        Find max(abs(A(i,j))).
                    190: *
                    191:          IF( LSAME( DIAG, 'U' ) ) THEN
                    192:             VALUE = ONE
                    193:             IF( LSAME( UPLO, 'U' ) ) THEN
                    194:                DO 20 J = 1, N
                    195:                   DO 10 I = MAX( K+2-J, 1 ), K
1.11      bertrand  196:                      SUM = ABS( AB( I, J ) )
                    197:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  198:    10             CONTINUE
                    199:    20          CONTINUE
                    200:             ELSE
                    201:                DO 40 J = 1, N
                    202:                   DO 30 I = 2, MIN( N+1-J, K+1 )
1.11      bertrand  203:                      SUM = ABS( AB( I, J ) )
                    204:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  205:    30             CONTINUE
                    206:    40          CONTINUE
                    207:             END IF
                    208:          ELSE
                    209:             VALUE = ZERO
                    210:             IF( LSAME( UPLO, 'U' ) ) THEN
                    211:                DO 60 J = 1, N
                    212:                   DO 50 I = MAX( K+2-J, 1 ), K + 1
1.11      bertrand  213:                      SUM = ABS( AB( I, J ) )
                    214:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  215:    50             CONTINUE
                    216:    60          CONTINUE
                    217:             ELSE
                    218:                DO 80 J = 1, N
                    219:                   DO 70 I = 1, MIN( N+1-J, K+1 )
1.11      bertrand  220:                      SUM = ABS( AB( I, J ) )
                    221:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  222:    70             CONTINUE
                    223:    80          CONTINUE
                    224:             END IF
                    225:          END IF
                    226:       ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
                    227: *
                    228: *        Find norm1(A).
                    229: *
                    230:          VALUE = ZERO
                    231:          UDIAG = LSAME( DIAG, 'U' )
                    232:          IF( LSAME( UPLO, 'U' ) ) THEN
                    233:             DO 110 J = 1, N
                    234:                IF( UDIAG ) THEN
                    235:                   SUM = ONE
                    236:                   DO 90 I = MAX( K+2-J, 1 ), K
                    237:                      SUM = SUM + ABS( AB( I, J ) )
                    238:    90             CONTINUE
                    239:                ELSE
                    240:                   SUM = ZERO
                    241:                   DO 100 I = MAX( K+2-J, 1 ), K + 1
                    242:                      SUM = SUM + ABS( AB( I, J ) )
                    243:   100             CONTINUE
                    244:                END IF
1.11      bertrand  245:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  246:   110       CONTINUE
                    247:          ELSE
                    248:             DO 140 J = 1, N
                    249:                IF( UDIAG ) THEN
                    250:                   SUM = ONE
                    251:                   DO 120 I = 2, MIN( N+1-J, K+1 )
                    252:                      SUM = SUM + ABS( AB( I, J ) )
                    253:   120             CONTINUE
                    254:                ELSE
                    255:                   SUM = ZERO
                    256:                   DO 130 I = 1, MIN( N+1-J, K+1 )
                    257:                      SUM = SUM + ABS( AB( I, J ) )
                    258:   130             CONTINUE
                    259:                END IF
1.11      bertrand  260:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  261:   140       CONTINUE
                    262:          END IF
                    263:       ELSE IF( LSAME( NORM, 'I' ) ) THEN
                    264: *
                    265: *        Find normI(A).
                    266: *
                    267:          VALUE = ZERO
                    268:          IF( LSAME( UPLO, 'U' ) ) THEN
                    269:             IF( LSAME( DIAG, 'U' ) ) THEN
                    270:                DO 150 I = 1, N
                    271:                   WORK( I ) = ONE
                    272:   150          CONTINUE
                    273:                DO 170 J = 1, N
                    274:                   L = K + 1 - J
                    275:                   DO 160 I = MAX( 1, J-K ), J - 1
                    276:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
                    277:   160             CONTINUE
                    278:   170          CONTINUE
                    279:             ELSE
                    280:                DO 180 I = 1, N
                    281:                   WORK( I ) = ZERO
                    282:   180          CONTINUE
                    283:                DO 200 J = 1, N
                    284:                   L = K + 1 - J
                    285:                   DO 190 I = MAX( 1, J-K ), J
                    286:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
                    287:   190             CONTINUE
                    288:   200          CONTINUE
                    289:             END IF
                    290:          ELSE
                    291:             IF( LSAME( DIAG, 'U' ) ) THEN
                    292:                DO 210 I = 1, N
                    293:                   WORK( I ) = ONE
                    294:   210          CONTINUE
                    295:                DO 230 J = 1, N
                    296:                   L = 1 - J
                    297:                   DO 220 I = J + 1, MIN( N, J+K )
                    298:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
                    299:   220             CONTINUE
                    300:   230          CONTINUE
                    301:             ELSE
                    302:                DO 240 I = 1, N
                    303:                   WORK( I ) = ZERO
                    304:   240          CONTINUE
                    305:                DO 260 J = 1, N
                    306:                   L = 1 - J
                    307:                   DO 250 I = J, MIN( N, J+K )
                    308:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
                    309:   250             CONTINUE
                    310:   260          CONTINUE
                    311:             END IF
                    312:          END IF
                    313:          DO 270 I = 1, N
1.11      bertrand  314:             SUM = WORK( I )
                    315:             IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  316:   270    CONTINUE
                    317:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
                    318: *
                    319: *        Find normF(A).
1.18    ! bertrand  320: *        SSQ(1) is scale
        !           321: *        SSQ(2) is sum-of-squares
        !           322: *        For better accuracy, sum each column separately.
1.1       bertrand  323: *
                    324:          IF( LSAME( UPLO, 'U' ) ) THEN
                    325:             IF( LSAME( DIAG, 'U' ) ) THEN
1.18    ! bertrand  326:                SSQ( 1 ) = ONE
        !           327:                SSQ( 2 ) = N
1.1       bertrand  328:                IF( K.GT.0 ) THEN
                    329:                   DO 280 J = 2, N
1.18    ! bertrand  330:                      COLSSQ( 1 ) = ZERO
        !           331:                      COLSSQ( 2 ) = ONE
1.1       bertrand  332:                      CALL ZLASSQ( MIN( J-1, K ),
1.18    ! bertrand  333:      $                            AB( MAX( K+2-J, 1 ), J ), 1,
        !           334:      $                            COLSSQ( 1 ), COLSSQ( 2 ) )
        !           335:                      CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  336:   280             CONTINUE
                    337:                END IF
                    338:             ELSE
1.18    ! bertrand  339:                SSQ( 1 ) = ZERO
        !           340:                SSQ( 2 ) = ONE
1.1       bertrand  341:                DO 290 J = 1, N
1.18    ! bertrand  342:                   COLSSQ( 1 ) = ZERO
        !           343:                   COLSSQ( 2 ) = ONE
1.1       bertrand  344:                   CALL ZLASSQ( MIN( J, K+1 ), AB( MAX( K+2-J, 1 ), J ),
1.18    ! bertrand  345:      $                         1, COLSSQ( 1 ), COLSSQ( 2 ) )
        !           346:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  347:   290          CONTINUE
                    348:             END IF
                    349:          ELSE
                    350:             IF( LSAME( DIAG, 'U' ) ) THEN
1.18    ! bertrand  351:                SSQ( 1 ) = ONE
        !           352:                SSQ( 2 ) = N
1.1       bertrand  353:                IF( K.GT.0 ) THEN
                    354:                   DO 300 J = 1, N - 1
1.18    ! bertrand  355:                      COLSSQ( 1 ) = ZERO
        !           356:                      COLSSQ( 2 ) = ONE
        !           357:                      CALL ZLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
        !           358:      $                            COLSSQ( 1 ), COLSSQ( 2 ) )
        !           359:                      CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  360:   300             CONTINUE
                    361:                END IF
                    362:             ELSE
1.18    ! bertrand  363:                SSQ( 1 ) = ZERO
        !           364:                SSQ( 2 ) = ONE
1.1       bertrand  365:                DO 310 J = 1, N
1.18    ! bertrand  366:                   COLSSQ( 1 ) = ZERO
        !           367:                   COLSSQ( 2 ) = ONE
        !           368:                   CALL ZLASSQ( MIN( N-J+1, K+1 ), AB( 1, J ), 1,
        !           369:      $                         COLSSQ( 1 ), COLSSQ( 2 ) )
        !           370:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  371:   310          CONTINUE
                    372:             END IF
                    373:          END IF
1.18    ! bertrand  374:          VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
1.1       bertrand  375:       END IF
                    376: *
                    377:       ZLANTB = VALUE
                    378:       RETURN
                    379: *
                    380: *     End of ZLANTB
                    381: *
                    382:       END

CVSweb interface <joel.bertrand@systella.fr>