Annotation of rpl/lapack/blas/ztrmm.f, revision 1.10

1.8       bertrand    1: *> \brief \b ZTRMM
1.1       bertrand    2: *
1.8       bertrand    3: *  =========== DOCUMENTATION ===========
1.1       bertrand    4: *
1.8       bertrand    5: * Online html documentation available at 
                      6: *            http://www.netlib.org/lapack/explore-html/ 
1.1       bertrand    7: *
1.8       bertrand    8: *  Definition:
                      9: *  ===========
                     10: *
                     11: *       SUBROUTINE ZTRMM(SIDE,UPLO,TRANSA,DIAG,M,N,ALPHA,A,LDA,B,LDB)
                     12: * 
                     13: *       .. Scalar Arguments ..
                     14: *       COMPLEX*16 ALPHA
                     15: *       INTEGER LDA,LDB,M,N
                     16: *       CHARACTER DIAG,SIDE,TRANSA,UPLO
                     17: *       ..
                     18: *       .. Array Arguments ..
                     19: *       COMPLEX*16 A(LDA,*),B(LDB,*)
                     20: *       ..
                     21: *  
                     22: *
                     23: *> \par Purpose:
                     24: *  =============
                     25: *>
                     26: *> \verbatim
                     27: *>
                     28: *> ZTRMM  performs one of the matrix-matrix operations
                     29: *>
                     30: *>    B := alpha*op( A )*B,   or   B := alpha*B*op( A )
                     31: *>
                     32: *> where  alpha  is a scalar,  B  is an m by n matrix,  A  is a unit, or
                     33: *> non-unit,  upper or lower triangular matrix  and  op( A )  is one  of
                     34: *>
                     35: *>    op( A ) = A   or   op( A ) = A**T   or   op( A ) = A**H.
                     36: *> \endverbatim
1.1       bertrand   37: *
1.8       bertrand   38: *  Arguments:
1.1       bertrand   39: *  ==========
                     40: *
1.8       bertrand   41: *> \param[in] SIDE
                     42: *> \verbatim
                     43: *>          SIDE is CHARACTER*1
                     44: *>           On entry,  SIDE specifies whether  op( A ) multiplies B from
                     45: *>           the left or right as follows:
                     46: *>
                     47: *>              SIDE = 'L' or 'l'   B := alpha*op( A )*B.
                     48: *>
                     49: *>              SIDE = 'R' or 'r'   B := alpha*B*op( A ).
                     50: *> \endverbatim
                     51: *>
                     52: *> \param[in] UPLO
                     53: *> \verbatim
                     54: *>          UPLO is CHARACTER*1
                     55: *>           On entry, UPLO specifies whether the matrix A is an upper or
                     56: *>           lower triangular matrix as follows:
                     57: *>
                     58: *>              UPLO = 'U' or 'u'   A is an upper triangular matrix.
                     59: *>
                     60: *>              UPLO = 'L' or 'l'   A is a lower triangular matrix.
                     61: *> \endverbatim
                     62: *>
                     63: *> \param[in] TRANSA
                     64: *> \verbatim
                     65: *>          TRANSA is CHARACTER*1
                     66: *>           On entry, TRANSA specifies the form of op( A ) to be used in
                     67: *>           the matrix multiplication as follows:
                     68: *>
                     69: *>              TRANSA = 'N' or 'n'   op( A ) = A.
                     70: *>
                     71: *>              TRANSA = 'T' or 't'   op( A ) = A**T.
                     72: *>
                     73: *>              TRANSA = 'C' or 'c'   op( A ) = A**H.
                     74: *> \endverbatim
                     75: *>
                     76: *> \param[in] DIAG
                     77: *> \verbatim
                     78: *>          DIAG is CHARACTER*1
                     79: *>           On entry, DIAG specifies whether or not A is unit triangular
                     80: *>           as follows:
                     81: *>
                     82: *>              DIAG = 'U' or 'u'   A is assumed to be unit triangular.
                     83: *>
                     84: *>              DIAG = 'N' or 'n'   A is not assumed to be unit
                     85: *>                                  triangular.
                     86: *> \endverbatim
                     87: *>
                     88: *> \param[in] M
                     89: *> \verbatim
                     90: *>          M is INTEGER
                     91: *>           On entry, M specifies the number of rows of B. M must be at
                     92: *>           least zero.
                     93: *> \endverbatim
                     94: *>
                     95: *> \param[in] N
                     96: *> \verbatim
                     97: *>          N is INTEGER
                     98: *>           On entry, N specifies the number of columns of B.  N must be
                     99: *>           at least zero.
                    100: *> \endverbatim
                    101: *>
                    102: *> \param[in] ALPHA
                    103: *> \verbatim
                    104: *>          ALPHA is COMPLEX*16
                    105: *>           On entry,  ALPHA specifies the scalar  alpha. When  alpha is
                    106: *>           zero then  A is not referenced and  B need not be set before
                    107: *>           entry.
                    108: *> \endverbatim
                    109: *>
                    110: *> \param[in] A
                    111: *> \verbatim
                    112: *>          A is COMPLEX*16 array of DIMENSION ( LDA, k ), where k is m
                    113: *>           when  SIDE = 'L' or 'l'  and is  n  when  SIDE = 'R' or 'r'.
                    114: *>           Before entry  with  UPLO = 'U' or 'u',  the  leading  k by k
                    115: *>           upper triangular part of the array  A must contain the upper
                    116: *>           triangular matrix  and the strictly lower triangular part of
                    117: *>           A is not referenced.
                    118: *>           Before entry  with  UPLO = 'L' or 'l',  the  leading  k by k
                    119: *>           lower triangular part of the array  A must contain the lower
                    120: *>           triangular matrix  and the strictly upper triangular part of
                    121: *>           A is not referenced.
                    122: *>           Note that when  DIAG = 'U' or 'u',  the diagonal elements of
                    123: *>           A  are not referenced either,  but are assumed to be  unity.
                    124: *> \endverbatim
                    125: *>
                    126: *> \param[in] LDA
                    127: *> \verbatim
                    128: *>          LDA is INTEGER
                    129: *>           On entry, LDA specifies the first dimension of A as declared
                    130: *>           in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
                    131: *>           LDA  must be at least  max( 1, m ),  when  SIDE = 'R' or 'r'
                    132: *>           then LDA must be at least max( 1, n ).
                    133: *> \endverbatim
                    134: *>
                    135: *> \param[in] B
                    136: *> \verbatim
                    137: *>          B is (input/output) COMPLEX*16 array of DIMENSION ( LDB, n ).
                    138: *>           Before entry,  the leading  m by n part of the array  B must
                    139: *>           contain the matrix  B,  and  on exit  is overwritten  by the
                    140: *>           transformed matrix.
                    141: *> \endverbatim
                    142: *>
                    143: *> \param[in] LDB
                    144: *> \verbatim
                    145: *>          LDB is INTEGER
                    146: *>           On entry, LDB specifies the first dimension of B as declared
                    147: *>           in  the  calling  (sub)  program.   LDB  must  be  at  least
                    148: *>           max( 1, m ).
                    149: *> \endverbatim
                    150: *
                    151: *  Authors:
                    152: *  ========
                    153: *
                    154: *> \author Univ. of Tennessee 
                    155: *> \author Univ. of California Berkeley 
                    156: *> \author Univ. of Colorado Denver 
                    157: *> \author NAG Ltd. 
                    158: *
                    159: *> \date November 2011
                    160: *
                    161: *> \ingroup complex16_blas_level3
                    162: *
                    163: *> \par Further Details:
                    164: *  =====================
                    165: *>
                    166: *> \verbatim
                    167: *>
                    168: *>  Level 3 Blas routine.
                    169: *>
                    170: *>  -- Written on 8-February-1989.
                    171: *>     Jack Dongarra, Argonne National Laboratory.
                    172: *>     Iain Duff, AERE Harwell.
                    173: *>     Jeremy Du Croz, Numerical Algorithms Group Ltd.
                    174: *>     Sven Hammarling, Numerical Algorithms Group Ltd.
                    175: *> \endverbatim
                    176: *>
                    177: *  =====================================================================
                    178:       SUBROUTINE ZTRMM(SIDE,UPLO,TRANSA,DIAG,M,N,ALPHA,A,LDA,B,LDB)
1.1       bertrand  179: *
1.8       bertrand  180: *  -- Reference BLAS level3 routine (version 3.4.0) --
                    181: *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
                    182: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    183: *     November 2011
1.1       bertrand  184: *
1.8       bertrand  185: *     .. Scalar Arguments ..
                    186:       COMPLEX*16 ALPHA
                    187:       INTEGER LDA,LDB,M,N
                    188:       CHARACTER DIAG,SIDE,TRANSA,UPLO
                    189: *     ..
                    190: *     .. Array Arguments ..
                    191:       COMPLEX*16 A(LDA,*),B(LDB,*)
                    192: *     ..
1.1       bertrand  193: *
                    194: *  =====================================================================
                    195: *
                    196: *     .. External Functions ..
                    197:       LOGICAL LSAME
                    198:       EXTERNAL LSAME
                    199: *     ..
                    200: *     .. External Subroutines ..
                    201:       EXTERNAL XERBLA
                    202: *     ..
                    203: *     .. Intrinsic Functions ..
                    204:       INTRINSIC DCONJG,MAX
                    205: *     ..
                    206: *     .. Local Scalars ..
1.8       bertrand  207:       COMPLEX*16 TEMP
1.1       bertrand  208:       INTEGER I,INFO,J,K,NROWA
                    209:       LOGICAL LSIDE,NOCONJ,NOUNIT,UPPER
                    210: *     ..
                    211: *     .. Parameters ..
1.8       bertrand  212:       COMPLEX*16 ONE
1.1       bertrand  213:       PARAMETER (ONE= (1.0D+0,0.0D+0))
1.8       bertrand  214:       COMPLEX*16 ZERO
1.1       bertrand  215:       PARAMETER (ZERO= (0.0D+0,0.0D+0))
                    216: *     ..
                    217: *
                    218: *     Test the input parameters.
                    219: *
                    220:       LSIDE = LSAME(SIDE,'L')
                    221:       IF (LSIDE) THEN
                    222:           NROWA = M
                    223:       ELSE
                    224:           NROWA = N
                    225:       END IF
                    226:       NOCONJ = LSAME(TRANSA,'T')
                    227:       NOUNIT = LSAME(DIAG,'N')
                    228:       UPPER = LSAME(UPLO,'U')
                    229: *
                    230:       INFO = 0
                    231:       IF ((.NOT.LSIDE) .AND. (.NOT.LSAME(SIDE,'R'))) THEN
                    232:           INFO = 1
                    233:       ELSE IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN
                    234:           INFO = 2
                    235:       ELSE IF ((.NOT.LSAME(TRANSA,'N')) .AND.
                    236:      +         (.NOT.LSAME(TRANSA,'T')) .AND.
                    237:      +         (.NOT.LSAME(TRANSA,'C'))) THEN
                    238:           INFO = 3
                    239:       ELSE IF ((.NOT.LSAME(DIAG,'U')) .AND. (.NOT.LSAME(DIAG,'N'))) THEN
                    240:           INFO = 4
                    241:       ELSE IF (M.LT.0) THEN
                    242:           INFO = 5
                    243:       ELSE IF (N.LT.0) THEN
                    244:           INFO = 6
                    245:       ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
                    246:           INFO = 9
                    247:       ELSE IF (LDB.LT.MAX(1,M)) THEN
                    248:           INFO = 11
                    249:       END IF
                    250:       IF (INFO.NE.0) THEN
                    251:           CALL XERBLA('ZTRMM ',INFO)
                    252:           RETURN
                    253:       END IF
                    254: *
                    255: *     Quick return if possible.
                    256: *
                    257:       IF (M.EQ.0 .OR. N.EQ.0) RETURN
                    258: *
                    259: *     And when  alpha.eq.zero.
                    260: *
                    261:       IF (ALPHA.EQ.ZERO) THEN
                    262:           DO 20 J = 1,N
                    263:               DO 10 I = 1,M
                    264:                   B(I,J) = ZERO
                    265:    10         CONTINUE
                    266:    20     CONTINUE
                    267:           RETURN
                    268:       END IF
                    269: *
                    270: *     Start the operations.
                    271: *
                    272:       IF (LSIDE) THEN
                    273:           IF (LSAME(TRANSA,'N')) THEN
                    274: *
                    275: *           Form  B := alpha*A*B.
                    276: *
                    277:               IF (UPPER) THEN
                    278:                   DO 50 J = 1,N
                    279:                       DO 40 K = 1,M
                    280:                           IF (B(K,J).NE.ZERO) THEN
                    281:                               TEMP = ALPHA*B(K,J)
                    282:                               DO 30 I = 1,K - 1
                    283:                                   B(I,J) = B(I,J) + TEMP*A(I,K)
                    284:    30                         CONTINUE
                    285:                               IF (NOUNIT) TEMP = TEMP*A(K,K)
                    286:                               B(K,J) = TEMP
                    287:                           END IF
                    288:    40                 CONTINUE
                    289:    50             CONTINUE
                    290:               ELSE
                    291:                   DO 80 J = 1,N
                    292:                       DO 70 K = M,1,-1
                    293:                           IF (B(K,J).NE.ZERO) THEN
                    294:                               TEMP = ALPHA*B(K,J)
                    295:                               B(K,J) = TEMP
                    296:                               IF (NOUNIT) B(K,J) = B(K,J)*A(K,K)
                    297:                               DO 60 I = K + 1,M
                    298:                                   B(I,J) = B(I,J) + TEMP*A(I,K)
                    299:    60                         CONTINUE
                    300:                           END IF
                    301:    70                 CONTINUE
                    302:    80             CONTINUE
                    303:               END IF
                    304:           ELSE
                    305: *
1.7       bertrand  306: *           Form  B := alpha*A**T*B   or   B := alpha*A**H*B.
1.1       bertrand  307: *
                    308:               IF (UPPER) THEN
                    309:                   DO 120 J = 1,N
                    310:                       DO 110 I = M,1,-1
                    311:                           TEMP = B(I,J)
                    312:                           IF (NOCONJ) THEN
                    313:                               IF (NOUNIT) TEMP = TEMP*A(I,I)
                    314:                               DO 90 K = 1,I - 1
                    315:                                   TEMP = TEMP + A(K,I)*B(K,J)
                    316:    90                         CONTINUE
                    317:                           ELSE
                    318:                               IF (NOUNIT) TEMP = TEMP*DCONJG(A(I,I))
                    319:                               DO 100 K = 1,I - 1
                    320:                                   TEMP = TEMP + DCONJG(A(K,I))*B(K,J)
                    321:   100                         CONTINUE
                    322:                           END IF
                    323:                           B(I,J) = ALPHA*TEMP
                    324:   110                 CONTINUE
                    325:   120             CONTINUE
                    326:               ELSE
                    327:                   DO 160 J = 1,N
                    328:                       DO 150 I = 1,M
                    329:                           TEMP = B(I,J)
                    330:                           IF (NOCONJ) THEN
                    331:                               IF (NOUNIT) TEMP = TEMP*A(I,I)
                    332:                               DO 130 K = I + 1,M
                    333:                                   TEMP = TEMP + A(K,I)*B(K,J)
                    334:   130                         CONTINUE
                    335:                           ELSE
                    336:                               IF (NOUNIT) TEMP = TEMP*DCONJG(A(I,I))
                    337:                               DO 140 K = I + 1,M
                    338:                                   TEMP = TEMP + DCONJG(A(K,I))*B(K,J)
                    339:   140                         CONTINUE
                    340:                           END IF
                    341:                           B(I,J) = ALPHA*TEMP
                    342:   150                 CONTINUE
                    343:   160             CONTINUE
                    344:               END IF
                    345:           END IF
                    346:       ELSE
                    347:           IF (LSAME(TRANSA,'N')) THEN
                    348: *
                    349: *           Form  B := alpha*B*A.
                    350: *
                    351:               IF (UPPER) THEN
                    352:                   DO 200 J = N,1,-1
                    353:                       TEMP = ALPHA
                    354:                       IF (NOUNIT) TEMP = TEMP*A(J,J)
                    355:                       DO 170 I = 1,M
                    356:                           B(I,J) = TEMP*B(I,J)
                    357:   170                 CONTINUE
                    358:                       DO 190 K = 1,J - 1
                    359:                           IF (A(K,J).NE.ZERO) THEN
                    360:                               TEMP = ALPHA*A(K,J)
                    361:                               DO 180 I = 1,M
                    362:                                   B(I,J) = B(I,J) + TEMP*B(I,K)
                    363:   180                         CONTINUE
                    364:                           END IF
                    365:   190                 CONTINUE
                    366:   200             CONTINUE
                    367:               ELSE
                    368:                   DO 240 J = 1,N
                    369:                       TEMP = ALPHA
                    370:                       IF (NOUNIT) TEMP = TEMP*A(J,J)
                    371:                       DO 210 I = 1,M
                    372:                           B(I,J) = TEMP*B(I,J)
                    373:   210                 CONTINUE
                    374:                       DO 230 K = J + 1,N
                    375:                           IF (A(K,J).NE.ZERO) THEN
                    376:                               TEMP = ALPHA*A(K,J)
                    377:                               DO 220 I = 1,M
                    378:                                   B(I,J) = B(I,J) + TEMP*B(I,K)
                    379:   220                         CONTINUE
                    380:                           END IF
                    381:   230                 CONTINUE
                    382:   240             CONTINUE
                    383:               END IF
                    384:           ELSE
                    385: *
1.7       bertrand  386: *           Form  B := alpha*B*A**T   or   B := alpha*B*A**H.
1.1       bertrand  387: *
                    388:               IF (UPPER) THEN
                    389:                   DO 280 K = 1,N
                    390:                       DO 260 J = 1,K - 1
                    391:                           IF (A(J,K).NE.ZERO) THEN
                    392:                               IF (NOCONJ) THEN
                    393:                                   TEMP = ALPHA*A(J,K)
                    394:                               ELSE
                    395:                                   TEMP = ALPHA*DCONJG(A(J,K))
                    396:                               END IF
                    397:                               DO 250 I = 1,M
                    398:                                   B(I,J) = B(I,J) + TEMP*B(I,K)
                    399:   250                         CONTINUE
                    400:                           END IF
                    401:   260                 CONTINUE
                    402:                       TEMP = ALPHA
                    403:                       IF (NOUNIT) THEN
                    404:                           IF (NOCONJ) THEN
                    405:                               TEMP = TEMP*A(K,K)
                    406:                           ELSE
                    407:                               TEMP = TEMP*DCONJG(A(K,K))
                    408:                           END IF
                    409:                       END IF
                    410:                       IF (TEMP.NE.ONE) THEN
                    411:                           DO 270 I = 1,M
                    412:                               B(I,K) = TEMP*B(I,K)
                    413:   270                     CONTINUE
                    414:                       END IF
                    415:   280             CONTINUE
                    416:               ELSE
                    417:                   DO 320 K = N,1,-1
                    418:                       DO 300 J = K + 1,N
                    419:                           IF (A(J,K).NE.ZERO) THEN
                    420:                               IF (NOCONJ) THEN
                    421:                                   TEMP = ALPHA*A(J,K)
                    422:                               ELSE
                    423:                                   TEMP = ALPHA*DCONJG(A(J,K))
                    424:                               END IF
                    425:                               DO 290 I = 1,M
                    426:                                   B(I,J) = B(I,J) + TEMP*B(I,K)
                    427:   290                         CONTINUE
                    428:                           END IF
                    429:   300                 CONTINUE
                    430:                       TEMP = ALPHA
                    431:                       IF (NOUNIT) THEN
                    432:                           IF (NOCONJ) THEN
                    433:                               TEMP = TEMP*A(K,K)
                    434:                           ELSE
                    435:                               TEMP = TEMP*DCONJG(A(K,K))
                    436:                           END IF
                    437:                       END IF
                    438:                       IF (TEMP.NE.ONE) THEN
                    439:                           DO 310 I = 1,M
                    440:                               B(I,K) = TEMP*B(I,K)
                    441:   310                     CONTINUE
                    442:                       END IF
                    443:   320             CONTINUE
                    444:               END IF
                    445:           END IF
                    446:       END IF
                    447: *
                    448:       RETURN
                    449: *
                    450: *     End of ZTRMM .
                    451: *
                    452:       END

CVSweb interface <joel.bertrand@systella.fr>