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

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

CVSweb interface <joel.bertrand@systella.fr>