Annotation of rpl/lapack/lapack/zlantr.f, revision 1.19

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

CVSweb interface <joel.bertrand@systella.fr>