File:  [local] / rpl / lapack / lapack / dlantb.f
Revision 1.19: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:55 2023 UTC (9 months, 1 week ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    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.
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    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">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       DOUBLE PRECISION FUNCTION DLANTB( NORM, UPLO, DIAG, N, K, AB,
   22: *                        LDAB, WORK )
   23: *
   24: *       .. Scalar Arguments ..
   25: *       CHARACTER          DIAG, NORM, UPLO
   26: *       INTEGER            K, LDAB, N
   27: *       ..
   28: *       .. Array Arguments ..
   29: *       DOUBLE PRECISION   AB( LDAB, * ), WORK( * )
   30: *       ..
   31: *
   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: *
  130: *> \author Univ. of Tennessee
  131: *> \author Univ. of California Berkeley
  132: *> \author Univ. of Colorado Denver
  133: *> \author NAG Ltd.
  134: *
  135: *> \ingroup doubleOTHERauxiliary
  136: *
  137: *  =====================================================================
  138:       DOUBLE PRECISION FUNCTION DLANTB( NORM, UPLO, DIAG, N, K, AB,
  139:      $                 LDAB, WORK )
  140: *
  141: *  -- LAPACK auxiliary routine --
  142: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  143: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  144: *
  145: *     .. Scalar Arguments ..
  146:       CHARACTER          DIAG, NORM, UPLO
  147:       INTEGER            K, LDAB, N
  148: *     ..
  149: *     .. Array Arguments ..
  150:       DOUBLE PRECISION   AB( LDAB, * ), WORK( * )
  151: *     ..
  152: *
  153: * =====================================================================
  154: *
  155: *     .. Parameters ..
  156:       DOUBLE PRECISION   ONE, ZERO
  157:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
  158: *     ..
  159: *     .. Local Scalars ..
  160:       LOGICAL            UDIAG
  161:       INTEGER            I, J, L
  162:       DOUBLE PRECISION   SCALE, SUM, VALUE
  163: *     ..
  164: *     .. External Subroutines ..
  165:       EXTERNAL           DLASSQ
  166: *     ..
  167: *     .. External Functions ..
  168:       LOGICAL            LSAME, DISNAN
  169:       EXTERNAL           LSAME, DISNAN
  170: *     ..
  171: *     .. Intrinsic Functions ..
  172:       INTRINSIC          ABS, MAX, MIN, SQRT
  173: *     ..
  174: *     .. Executable Statements ..
  175: *
  176:       IF( N.EQ.0 ) THEN
  177:          VALUE = ZERO
  178:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
  179: *
  180: *        Find max(abs(A(i,j))).
  181: *
  182:          IF( LSAME( DIAG, 'U' ) ) THEN
  183:             VALUE = ONE
  184:             IF( LSAME( UPLO, 'U' ) ) THEN
  185:                DO 20 J = 1, N
  186:                   DO 10 I = MAX( K+2-J, 1 ), K
  187:                      SUM = ABS( AB( I, J ) )
  188:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  189:    10             CONTINUE
  190:    20          CONTINUE
  191:             ELSE
  192:                DO 40 J = 1, N
  193:                   DO 30 I = 2, MIN( N+1-J, K+1 )
  194:                      SUM = ABS( AB( I, J ) )
  195:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  196:    30             CONTINUE
  197:    40          CONTINUE
  198:             END IF
  199:          ELSE
  200:             VALUE = ZERO
  201:             IF( LSAME( UPLO, 'U' ) ) THEN
  202:                DO 60 J = 1, N
  203:                   DO 50 I = MAX( K+2-J, 1 ), K + 1
  204:                      SUM = ABS( AB( I, J ) )
  205:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  206:    50             CONTINUE
  207:    60          CONTINUE
  208:             ELSE
  209:                DO 80 J = 1, N
  210:                   DO 70 I = 1, MIN( N+1-J, K+1 )
  211:                      SUM = ABS( AB( I, J ) )
  212:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  213:    70             CONTINUE
  214:    80          CONTINUE
  215:             END IF
  216:          END IF
  217:       ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
  218: *
  219: *        Find norm1(A).
  220: *
  221:          VALUE = ZERO
  222:          UDIAG = LSAME( DIAG, 'U' )
  223:          IF( LSAME( UPLO, 'U' ) ) THEN
  224:             DO 110 J = 1, N
  225:                IF( UDIAG ) THEN
  226:                   SUM = ONE
  227:                   DO 90 I = MAX( K+2-J, 1 ), K
  228:                      SUM = SUM + ABS( AB( I, J ) )
  229:    90             CONTINUE
  230:                ELSE
  231:                   SUM = ZERO
  232:                   DO 100 I = MAX( K+2-J, 1 ), K + 1
  233:                      SUM = SUM + ABS( AB( I, J ) )
  234:   100             CONTINUE
  235:                END IF
  236:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  237:   110       CONTINUE
  238:          ELSE
  239:             DO 140 J = 1, N
  240:                IF( UDIAG ) THEN
  241:                   SUM = ONE
  242:                   DO 120 I = 2, MIN( N+1-J, K+1 )
  243:                      SUM = SUM + ABS( AB( I, J ) )
  244:   120             CONTINUE
  245:                ELSE
  246:                   SUM = ZERO
  247:                   DO 130 I = 1, MIN( N+1-J, K+1 )
  248:                      SUM = SUM + ABS( AB( I, J ) )
  249:   130             CONTINUE
  250:                END IF
  251:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  252:   140       CONTINUE
  253:          END IF
  254:       ELSE IF( LSAME( NORM, 'I' ) ) THEN
  255: *
  256: *        Find normI(A).
  257: *
  258:          VALUE = ZERO
  259:          IF( LSAME( UPLO, 'U' ) ) THEN
  260:             IF( LSAME( DIAG, 'U' ) ) THEN
  261:                DO 150 I = 1, N
  262:                   WORK( I ) = ONE
  263:   150          CONTINUE
  264:                DO 170 J = 1, N
  265:                   L = K + 1 - J
  266:                   DO 160 I = MAX( 1, J-K ), J - 1
  267:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
  268:   160             CONTINUE
  269:   170          CONTINUE
  270:             ELSE
  271:                DO 180 I = 1, N
  272:                   WORK( I ) = ZERO
  273:   180          CONTINUE
  274:                DO 200 J = 1, N
  275:                   L = K + 1 - J
  276:                   DO 190 I = MAX( 1, J-K ), J
  277:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
  278:   190             CONTINUE
  279:   200          CONTINUE
  280:             END IF
  281:          ELSE
  282:             IF( LSAME( DIAG, 'U' ) ) THEN
  283:                DO 210 I = 1, N
  284:                   WORK( I ) = ONE
  285:   210          CONTINUE
  286:                DO 230 J = 1, N
  287:                   L = 1 - J
  288:                   DO 220 I = J + 1, MIN( N, J+K )
  289:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
  290:   220             CONTINUE
  291:   230          CONTINUE
  292:             ELSE
  293:                DO 240 I = 1, N
  294:                   WORK( I ) = ZERO
  295:   240          CONTINUE
  296:                DO 260 J = 1, N
  297:                   L = 1 - J
  298:                   DO 250 I = J, MIN( N, J+K )
  299:                      WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
  300:   250             CONTINUE
  301:   260          CONTINUE
  302:             END IF
  303:          END IF
  304:          DO 270 I = 1, N
  305:             SUM = WORK( I )
  306:             IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  307:   270    CONTINUE
  308:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
  309: *
  310: *        Find normF(A).
  311: *
  312:          IF( LSAME( UPLO, 'U' ) ) THEN
  313:             IF( LSAME( DIAG, 'U' ) ) THEN
  314:                SCALE = ONE
  315:                SUM = N
  316:                IF( K.GT.0 ) THEN
  317:                   DO 280 J = 2, N
  318:                      CALL DLASSQ( MIN( J-1, K ),
  319:      $                            AB( MAX( K+2-J, 1 ), J ), 1, SCALE,
  320:      $                            SUM )
  321:   280             CONTINUE
  322:                END IF
  323:             ELSE
  324:                SCALE = ZERO
  325:                SUM = ONE
  326:                DO 290 J = 1, N
  327:                   CALL DLASSQ( MIN( J, K+1 ), AB( MAX( K+2-J, 1 ), J ),
  328:      $                         1, SCALE, SUM )
  329:   290          CONTINUE
  330:             END IF
  331:          ELSE
  332:             IF( LSAME( DIAG, 'U' ) ) THEN
  333:                SCALE = ONE
  334:                SUM = N
  335:                IF( K.GT.0 ) THEN
  336:                   DO 300 J = 1, N - 1
  337:                      CALL DLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
  338:      $                            SUM )
  339:   300             CONTINUE
  340:                END IF
  341:             ELSE
  342:                SCALE = ZERO
  343:                SUM = ONE
  344:                DO 310 J = 1, N
  345:                   CALL DLASSQ( MIN( N-J+1, K+1 ), AB( 1, J ), 1, SCALE,
  346:      $                         SUM )
  347:   310          CONTINUE
  348:             END IF
  349:          END IF
  350:          VALUE = SCALE*SQRT( SUM )
  351:       END IF
  352: *
  353:       DLANTB = VALUE
  354:       RETURN
  355: *
  356: *     End of DLANTB
  357: *
  358:       END

CVSweb interface <joel.bertrand@systella.fr>