File:  [local] / rpl / lapack / lapack / dlantr.f
Revision 1.19: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:55 2023 UTC (9 months 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 DLANTR returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a trapezoidal or triangular matrix.
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    9: *> Download DLANTR + dependencies
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlantr.f">
   11: *> [TGZ]</a>
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlantr.f">
   13: *> [ZIP]</a>
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlantr.f">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       DOUBLE PRECISION FUNCTION DLANTR( NORM, UPLO, DIAG, M, N, A, LDA,
   22: *                        WORK )
   23: *
   24: *       .. Scalar Arguments ..
   25: *       CHARACTER          DIAG, NORM, UPLO
   26: *       INTEGER            LDA, M, N
   27: *       ..
   28: *       .. Array Arguments ..
   29: *       DOUBLE PRECISION   A( LDA, * ), WORK( * )
   30: *       ..
   31: *
   32: *
   33: *> \par Purpose:
   34: *  =============
   35: *>
   36: *> \verbatim
   37: *>
   38: *> DLANTR  returns the value of the one norm,  or the Frobenius norm, or
   39: *> the  infinity norm,  or the  element of  largest absolute value  of a
   40: *> trapezoidal or triangular matrix A.
   41: *> \endverbatim
   42: *>
   43: *> \return DLANTR
   44: *> \verbatim
   45: *>
   46: *>    DLANTR = ( 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 DLANTR 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 trapezoidal.
   74: *>          = 'U':  Upper trapezoidal
   75: *>          = 'L':  Lower trapezoidal
   76: *>          Note that A is triangular instead of trapezoidal if M = N.
   77: *> \endverbatim
   78: *>
   79: *> \param[in] DIAG
   80: *> \verbatim
   81: *>          DIAG is CHARACTER*1
   82: *>          Specifies whether or not the matrix A has unit diagonal.
   83: *>          = 'N':  Non-unit diagonal
   84: *>          = 'U':  Unit diagonal
   85: *> \endverbatim
   86: *>
   87: *> \param[in] M
   88: *> \verbatim
   89: *>          M is INTEGER
   90: *>          The number of rows of the matrix A.  M >= 0, and if
   91: *>          UPLO = 'U', M <= N.  When M = 0, DLANTR is set to zero.
   92: *> \endverbatim
   93: *>
   94: *> \param[in] N
   95: *> \verbatim
   96: *>          N is INTEGER
   97: *>          The number of columns of the matrix A.  N >= 0, and if
   98: *>          UPLO = 'L', N <= M.  When N = 0, DLANTR is set to zero.
   99: *> \endverbatim
  100: *>
  101: *> \param[in] A
  102: *> \verbatim
  103: *>          A is DOUBLE PRECISION array, dimension (LDA,N)
  104: *>          The trapezoidal matrix A (A is triangular if M = N).
  105: *>          If UPLO = 'U', the leading m by n upper trapezoidal part of
  106: *>          the array A contains the upper trapezoidal matrix, and the
  107: *>          strictly lower triangular part of A is not referenced.
  108: *>          If UPLO = 'L', the leading m by n lower trapezoidal part of
  109: *>          the array A contains the lower trapezoidal matrix, and the
  110: *>          strictly upper triangular part of A is not referenced.  Note
  111: *>          that when DIAG = 'U', the diagonal elements of A are not
  112: *>          referenced and are assumed to be one.
  113: *> \endverbatim
  114: *>
  115: *> \param[in] LDA
  116: *> \verbatim
  117: *>          LDA is INTEGER
  118: *>          The leading dimension of the array A.  LDA >= max(M,1).
  119: *> \endverbatim
  120: *>
  121: *> \param[out] WORK
  122: *> \verbatim
  123: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
  124: *>          where LWORK >= M when NORM = 'I'; otherwise, WORK is not
  125: *>          referenced.
  126: *> \endverbatim
  127: *
  128: *  Authors:
  129: *  ========
  130: *
  131: *> \author Univ. of Tennessee
  132: *> \author Univ. of California Berkeley
  133: *> \author Univ. of Colorado Denver
  134: *> \author NAG Ltd.
  135: *
  136: *> \ingroup doubleOTHERauxiliary
  137: *
  138: *  =====================================================================
  139:       DOUBLE PRECISION FUNCTION DLANTR( NORM, UPLO, DIAG, M, N, A, LDA,
  140:      $                 WORK )
  141: *
  142: *  -- LAPACK auxiliary routine --
  143: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  144: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  145: *
  146: *     .. Scalar Arguments ..
  147:       CHARACTER          DIAG, NORM, UPLO
  148:       INTEGER            LDA, M, N
  149: *     ..
  150: *     .. Array Arguments ..
  151:       DOUBLE PRECISION   A( LDA, * ), WORK( * )
  152: *     ..
  153: *
  154: * =====================================================================
  155: *
  156: *     .. Parameters ..
  157:       DOUBLE PRECISION   ONE, ZERO
  158:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
  159: *     ..
  160: *     .. Local Scalars ..
  161:       LOGICAL            UDIAG
  162:       INTEGER            I, J
  163:       DOUBLE PRECISION   SCALE, SUM, VALUE
  164: *     ..
  165: *     .. External Subroutines ..
  166:       EXTERNAL           DLASSQ
  167: *     ..
  168: *     .. External Functions ..
  169:       LOGICAL            LSAME, DISNAN
  170:       EXTERNAL           LSAME, DISNAN
  171: *     ..
  172: *     .. Intrinsic Functions ..
  173:       INTRINSIC          ABS, MIN, SQRT
  174: *     ..
  175: *     .. Executable Statements ..
  176: *
  177:       IF( MIN( M, N ).EQ.0 ) THEN
  178:          VALUE = ZERO
  179:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
  180: *
  181: *        Find max(abs(A(i,j))).
  182: *
  183:          IF( LSAME( DIAG, 'U' ) ) THEN
  184:             VALUE = ONE
  185:             IF( LSAME( UPLO, 'U' ) ) THEN
  186:                DO 20 J = 1, N
  187:                   DO 10 I = 1, MIN( M, J-1 )
  188:                      SUM = ABS( A( I, J ) )
  189:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  190:    10             CONTINUE
  191:    20          CONTINUE
  192:             ELSE
  193:                DO 40 J = 1, N
  194:                   DO 30 I = J + 1, M
  195:                      SUM = ABS( A( I, J ) )
  196:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  197:    30             CONTINUE
  198:    40          CONTINUE
  199:             END IF
  200:          ELSE
  201:             VALUE = ZERO
  202:             IF( LSAME( UPLO, 'U' ) ) THEN
  203:                DO 60 J = 1, N
  204:                   DO 50 I = 1, MIN( M, J )
  205:                      SUM = ABS( A( I, J ) )
  206:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  207:    50             CONTINUE
  208:    60          CONTINUE
  209:             ELSE
  210:                DO 80 J = 1, N
  211:                   DO 70 I = J, M
  212:                      SUM = ABS( A( I, J ) )
  213:                      IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  214:    70             CONTINUE
  215:    80          CONTINUE
  216:             END IF
  217:          END IF
  218:       ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
  219: *
  220: *        Find norm1(A).
  221: *
  222:          VALUE = ZERO
  223:          UDIAG = LSAME( DIAG, 'U' )
  224:          IF( LSAME( UPLO, 'U' ) ) THEN
  225:             DO 110 J = 1, N
  226:                IF( ( UDIAG ) .AND. ( J.LE.M ) ) THEN
  227:                   SUM = ONE
  228:                   DO 90 I = 1, J - 1
  229:                      SUM = SUM + ABS( A( I, J ) )
  230:    90             CONTINUE
  231:                ELSE
  232:                   SUM = ZERO
  233:                   DO 100 I = 1, MIN( M, J )
  234:                      SUM = SUM + ABS( A( I, J ) )
  235:   100             CONTINUE
  236:                END IF
  237:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  238:   110       CONTINUE
  239:          ELSE
  240:             DO 140 J = 1, N
  241:                IF( UDIAG ) THEN
  242:                   SUM = ONE
  243:                   DO 120 I = J + 1, M
  244:                      SUM = SUM + ABS( A( I, J ) )
  245:   120             CONTINUE
  246:                ELSE
  247:                   SUM = ZERO
  248:                   DO 130 I = J, M
  249:                      SUM = SUM + ABS( A( I, J ) )
  250:   130             CONTINUE
  251:                END IF
  252:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  253:   140       CONTINUE
  254:          END IF
  255:       ELSE IF( LSAME( NORM, 'I' ) ) THEN
  256: *
  257: *        Find normI(A).
  258: *
  259:          IF( LSAME( UPLO, 'U' ) ) THEN
  260:             IF( LSAME( DIAG, 'U' ) ) THEN
  261:                DO 150 I = 1, M
  262:                   WORK( I ) = ONE
  263:   150          CONTINUE
  264:                DO 170 J = 1, N
  265:                   DO 160 I = 1, MIN( M, J-1 )
  266:                      WORK( I ) = WORK( I ) + ABS( A( I, J ) )
  267:   160             CONTINUE
  268:   170          CONTINUE
  269:             ELSE
  270:                DO 180 I = 1, M
  271:                   WORK( I ) = ZERO
  272:   180          CONTINUE
  273:                DO 200 J = 1, N
  274:                   DO 190 I = 1, MIN( M, J )
  275:                      WORK( I ) = WORK( I ) + ABS( A( I, J ) )
  276:   190             CONTINUE
  277:   200          CONTINUE
  278:             END IF
  279:          ELSE
  280:             IF( LSAME( DIAG, 'U' ) ) THEN
  281:                DO 210 I = 1, MIN( M, N )
  282:                   WORK( I ) = ONE
  283:   210          CONTINUE
  284:                DO 220 I = N + 1, M
  285:                   WORK( I ) = ZERO
  286:   220          CONTINUE
  287:                DO 240 J = 1, N
  288:                   DO 230 I = J + 1, M
  289:                      WORK( I ) = WORK( I ) + ABS( A( I, J ) )
  290:   230             CONTINUE
  291:   240          CONTINUE
  292:             ELSE
  293:                DO 250 I = 1, M
  294:                   WORK( I ) = ZERO
  295:   250          CONTINUE
  296:                DO 270 J = 1, N
  297:                   DO 260 I = J, M
  298:                      WORK( I ) = WORK( I ) + ABS( A( I, J ) )
  299:   260             CONTINUE
  300:   270          CONTINUE
  301:             END IF
  302:          END IF
  303:          VALUE = ZERO
  304:          DO 280 I = 1, M
  305:             SUM = WORK( I )
  306:             IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  307:   280    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 = MIN( M, N )
  316:                DO 290 J = 2, N
  317:                   CALL DLASSQ( MIN( M, J-1 ), A( 1, J ), 1, SCALE, SUM )
  318:   290          CONTINUE
  319:             ELSE
  320:                SCALE = ZERO
  321:                SUM = ONE
  322:                DO 300 J = 1, N
  323:                   CALL DLASSQ( MIN( M, J ), A( 1, J ), 1, SCALE, SUM )
  324:   300          CONTINUE
  325:             END IF
  326:          ELSE
  327:             IF( LSAME( DIAG, 'U' ) ) THEN
  328:                SCALE = ONE
  329:                SUM = MIN( M, N )
  330:                DO 310 J = 1, N
  331:                   CALL DLASSQ( M-J, A( MIN( M, J+1 ), J ), 1, SCALE,
  332:      $                         SUM )
  333:   310          CONTINUE
  334:             ELSE
  335:                SCALE = ZERO
  336:                SUM = ONE
  337:                DO 320 J = 1, N
  338:                   CALL DLASSQ( M-J+1, A( J, J ), 1, SCALE, SUM )
  339:   320          CONTINUE
  340:             END IF
  341:          END IF
  342:          VALUE = SCALE*SQRT( SUM )
  343:       END IF
  344: *
  345:       DLANTR = VALUE
  346:       RETURN
  347: *
  348: *     End of DLANTR
  349: *
  350:       END

CVSweb interface <joel.bertrand@systella.fr>