kusano 2b45e8
      SUBROUTINE STRMMF ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,
kusano 2b45e8
     $                   B, LDB )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      CHARACTER*1        SIDE, UPLO, TRANSA, DIAG
kusano 2b45e8
      INTEGER            M, N, LDA, LDB
kusano 2b45e8
      REAL               ALPHA
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      REAL               A( LDA, * ), B( LDB, * )
kusano 2b45e8
*     ..
kusano 2b45e8
*
kusano 2b45e8
*  Purpose
kusano 2b45e8
*  =======
kusano 2b45e8
*
kusano 2b45e8
*  STRMM  performs one of the matrix-matrix operations
kusano 2b45e8
*
kusano 2b45e8
*     B := alpha*op( A )*B,   or   B := alpha*B*op( A ),
kusano 2b45e8
*
kusano 2b45e8
*  where  alpha  is a scalar,  B  is an m by n matrix,  A  is a unit, or
kusano 2b45e8
*  non-unit,  upper or lower triangular matrix  and  op( A )  is one  of
kusano 2b45e8
*
kusano 2b45e8
*     op( A ) = A   or   op( A ) = A'.
kusano 2b45e8
*
kusano 2b45e8
*  Parameters
kusano 2b45e8
*  ==========
kusano 2b45e8
*
kusano 2b45e8
*  SIDE   - CHARACTER*1.
kusano 2b45e8
*           On entry,  SIDE specifies whether  op( A ) multiplies B from
kusano 2b45e8
*           the left or right as follows:
kusano 2b45e8
*
kusano 2b45e8
*              SIDE = 'L' or 'l'   B := alpha*op( A )*B.
kusano 2b45e8
*
kusano 2b45e8
*              SIDE = 'R' or 'r'   B := alpha*B*op( A ).
kusano 2b45e8
*
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  UPLO   - CHARACTER*1.
kusano 2b45e8
*           On entry, UPLO specifies whether the matrix A is an upper or
kusano 2b45e8
*           lower triangular matrix as follows:
kusano 2b45e8
*
kusano 2b45e8
*              UPLO = 'U' or 'u'   A is an upper triangular matrix.
kusano 2b45e8
*
kusano 2b45e8
*              UPLO = 'L' or 'l'   A is a lower triangular matrix.
kusano 2b45e8
*
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  TRANSA - CHARACTER*1.
kusano 2b45e8
*           On entry, TRANSA specifies the form of op( A ) to be used in
kusano 2b45e8
*           the matrix multiplication as follows:
kusano 2b45e8
*
kusano 2b45e8
*              TRANSA = 'N' or 'n'   op( A ) = A.
kusano 2b45e8
*
kusano 2b45e8
*              TRANSA = 'T' or 't'   op( A ) = A'.
kusano 2b45e8
*
kusano 2b45e8
*              TRANSA = 'C' or 'c'   op( A ) = A'.
kusano 2b45e8
*
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  DIAG   - CHARACTER*1.
kusano 2b45e8
*           On entry, DIAG specifies whether or not A is unit triangular
kusano 2b45e8
*           as follows:
kusano 2b45e8
*
kusano 2b45e8
*              DIAG = 'U' or 'u'   A is assumed to be unit triangular.
kusano 2b45e8
*
kusano 2b45e8
*              DIAG = 'N' or 'n'   A is not assumed to be unit
kusano 2b45e8
*                                  triangular.
kusano 2b45e8
*
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  M      - INTEGER.
kusano 2b45e8
*           On entry, M specifies the number of rows of B. M must be at
kusano 2b45e8
*           least zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  N      - INTEGER.
kusano 2b45e8
*           On entry, N specifies the number of columns of B.  N must be
kusano 2b45e8
*           at least zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  ALPHA  - REAL            .
kusano 2b45e8
*           On entry,  ALPHA specifies the scalar  alpha. When  alpha is
kusano 2b45e8
*           zero then  A is not referenced and  B need not be set before
kusano 2b45e8
*           entry.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  A      - REAL             array of DIMENSION ( LDA, k ), where k is m
kusano 2b45e8
*           when  SIDE = 'L' or 'l'  and is  n  when  SIDE = 'R' or 'r'.
kusano 2b45e8
*           Before entry  with  UPLO = 'U' or 'u',  the  leading  k by k
kusano 2b45e8
*           upper triangular part of the array  A must contain the upper
kusano 2b45e8
*           triangular matrix  and the strictly lower triangular part of
kusano 2b45e8
*           A is not referenced.
kusano 2b45e8
*           Before entry  with  UPLO = 'L' or 'l',  the  leading  k by k
kusano 2b45e8
*           lower triangular part of the array  A must contain the lower
kusano 2b45e8
*           triangular matrix  and the strictly upper triangular part of
kusano 2b45e8
*           A is not referenced.
kusano 2b45e8
*           Note that when  DIAG = 'U' or 'u',  the diagonal elements of
kusano 2b45e8
*           A  are not referenced either,  but are assumed to be  unity.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  LDA    - INTEGER.
kusano 2b45e8
*           On entry, LDA specifies the first dimension of A as declared
kusano 2b45e8
*           in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
kusano 2b45e8
*           LDA  must be at least  max( 1, m ),  when  SIDE = 'R' or 'r'
kusano 2b45e8
*           then LDA must be at least max( 1, n ).
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  B      - REAL             array of DIMENSION ( LDB, n ).
kusano 2b45e8
*           Before entry,  the leading  m by n part of the array  B must
kusano 2b45e8
*           contain the matrix  B,  and  on exit  is overwritten  by the
kusano 2b45e8
*           transformed matrix.
kusano 2b45e8
*
kusano 2b45e8
*  LDB    - INTEGER.
kusano 2b45e8
*           On entry, LDB specifies the first dimension of B as declared
kusano 2b45e8
*           in  the  calling  (sub)  program.   LDB  must  be  at  least
kusano 2b45e8
*           max( 1, m ).
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*  Level 3 Blas routine.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LSAME
kusano 2b45e8
      EXTERNAL           LSAME
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           XERBLA
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      LOGICAL            LSIDE, NOUNIT, UPPER
kusano 2b45e8
      INTEGER            I, INFO, J, K, NROWA
kusano 2b45e8
      REAL               TEMP
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      REAL               ONE         , ZERO
kusano 2b45e8
      PARAMETER        ( ONE = 1.0E+0, ZERO = 0.0E+0 )
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
*     Test the input parameters.
kusano 2b45e8
*
kusano 2b45e8
      LSIDE  = LSAME( SIDE  , 'L' )
kusano 2b45e8
      IF( LSIDE )THEN
kusano 2b45e8
         NROWA = M
kusano 2b45e8
      ELSE
kusano 2b45e8
         NROWA = N
kusano 2b45e8
      END IF
kusano 2b45e8
      NOUNIT = LSAME( DIAG  , 'N' )
kusano 2b45e8
      UPPER  = LSAME( UPLO  , 'U' )
kusano 2b45e8
*
kusano 2b45e8
      INFO   = 0
kusano 2b45e8
      IF(      ( .NOT.LSIDE                ).AND.
kusano 2b45e8
     $         ( .NOT.LSAME( SIDE  , 'R' ) )      )THEN
kusano 2b45e8
         INFO = 1
kusano 2b45e8
      ELSE IF( ( .NOT.UPPER                ).AND.
kusano 2b45e8
     $         ( .NOT.LSAME( UPLO  , 'L' ) )      )THEN
kusano 2b45e8
         INFO = 2
kusano 2b45e8
      ELSE IF( ( .NOT.LSAME( TRANSA, 'N' ) ).AND.
kusano 2b45e8
     $         ( .NOT.LSAME( TRANSA, 'T' ) ).AND.
kusano 2b45e8
     $         ( .NOT.LSAME( TRANSA, 'C' ) )      )THEN
kusano 2b45e8
         INFO = 3
kusano 2b45e8
      ELSE IF( ( .NOT.LSAME( DIAG  , 'U' ) ).AND.
kusano 2b45e8
     $         ( .NOT.LSAME( DIAG  , 'N' ) )      )THEN
kusano 2b45e8
         INFO = 4
kusano 2b45e8
      ELSE IF( M  .LT.0               )THEN
kusano 2b45e8
         INFO = 5
kusano 2b45e8
      ELSE IF( N  .LT.0               )THEN
kusano 2b45e8
         INFO = 6
kusano 2b45e8
      ELSE IF( LDA.LT.MAX( 1, NROWA ) )THEN
kusano 2b45e8
         INFO = 9
kusano 2b45e8
      ELSE IF( LDB.LT.MAX( 1, M     ) )THEN
kusano 2b45e8
         INFO = 11
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INFO.NE.0 )THEN
kusano 2b45e8
         CALL XERBLA( 'STRMM ', INFO )
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Quick return if possible.
kusano 2b45e8
*
kusano 2b45e8
      IF( N.EQ.0 )
kusano 2b45e8
     $   RETURN
kusano 2b45e8
*
kusano 2b45e8
*     And when  alpha.eq.zero.
kusano 2b45e8
*
kusano 2b45e8
      IF( ALPHA.EQ.ZERO )THEN
kusano 2b45e8
         DO 20, J = 1, N
kusano 2b45e8
            DO 10, I = 1, M
kusano 2b45e8
               B( I, J ) = ZERO
kusano 2b45e8
   10       CONTINUE
kusano 2b45e8
   20    CONTINUE
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Start the operations.
kusano 2b45e8
*
kusano 2b45e8
      IF( LSIDE )THEN
kusano 2b45e8
         IF( LSAME( TRANSA, 'N' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*           Form  B := alpha*A*B.
kusano 2b45e8
*
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               DO 50, J = 1, N
kusano 2b45e8
                  DO 40, K = 1, M
kusano 2b45e8
                     IF( B( K, J ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP = ALPHA*B( K, J )
kusano 2b45e8
                        DO 30, I = 1, K - 1
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*A( I, K )
kusano 2b45e8
   30                   CONTINUE
kusano 2b45e8
                        IF( NOUNIT )
kusano 2b45e8
     $                     TEMP = TEMP*A( K, K )
kusano 2b45e8
                        B( K, J ) = TEMP
kusano 2b45e8
                     END IF
kusano 2b45e8
   40             CONTINUE
kusano 2b45e8
   50          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 80, J = 1, N
kusano 2b45e8
                  DO 70 K = M, 1, -1
kusano 2b45e8
                     IF( B( K, J ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP      = ALPHA*B( K, J )
kusano 2b45e8
                        B( K, J ) = TEMP
kusano 2b45e8
                        IF( NOUNIT )
kusano 2b45e8
     $                     B( K, J ) = B( K, J )*A( K, K )
kusano 2b45e8
                        DO 60, I = K + 1, M
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*A( I, K )
kusano 2b45e8
   60                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
   70             CONTINUE
kusano 2b45e8
   80          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         ELSE
kusano 2b45e8
*
kusano 2b45e8
*           Form  B := alpha*A'*B.
kusano 2b45e8
*
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               DO 110, J = 1, N
kusano 2b45e8
                  DO 100, I = M, 1, -1
kusano 2b45e8
                     TEMP = B( I, J )
kusano 2b45e8
                     IF( NOUNIT )
kusano 2b45e8
     $                  TEMP = TEMP*A( I, I )
kusano 2b45e8
                     DO 90, K = 1, I - 1
kusano 2b45e8
                        TEMP = TEMP + A( K, I )*B( K, J )
kusano 2b45e8
   90                CONTINUE
kusano 2b45e8
                     B( I, J ) = ALPHA*TEMP
kusano 2b45e8
  100             CONTINUE
kusano 2b45e8
  110          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 140, J = 1, N
kusano 2b45e8
                  DO 130, I = 1, M
kusano 2b45e8
                     TEMP = B( I, J )
kusano 2b45e8
                     IF( NOUNIT )
kusano 2b45e8
     $                  TEMP = TEMP*A( I, I )
kusano 2b45e8
                     DO 120, K = I + 1, M
kusano 2b45e8
                        TEMP = TEMP + A( K, I )*B( K, J )
kusano 2b45e8
  120                CONTINUE
kusano 2b45e8
                     B( I, J ) = ALPHA*TEMP
kusano 2b45e8
  130             CONTINUE
kusano 2b45e8
  140          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         END IF
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF( LSAME( TRANSA, 'N' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*           Form  B := alpha*B*A.
kusano 2b45e8
*
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               DO 180, J = N, 1, -1
kusano 2b45e8
                  TEMP = ALPHA
kusano 2b45e8
                  IF( NOUNIT )
kusano 2b45e8
     $               TEMP = TEMP*A( J, J )
kusano 2b45e8
                  DO 150, I = 1, M
kusano 2b45e8
                     B( I, J ) = TEMP*B( I, J )
kusano 2b45e8
  150             CONTINUE
kusano 2b45e8
                  DO 170, K = 1, J - 1
kusano 2b45e8
                     IF( A( K, J ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP = ALPHA*A( K, J )
kusano 2b45e8
                        DO 160, I = 1, M
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*B( I, K )
kusano 2b45e8
  160                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
  170             CONTINUE
kusano 2b45e8
  180          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 220, J = 1, N
kusano 2b45e8
                  TEMP = ALPHA
kusano 2b45e8
                  IF( NOUNIT )
kusano 2b45e8
     $               TEMP = TEMP*A( J, J )
kusano 2b45e8
                  DO 190, I = 1, M
kusano 2b45e8
                     B( I, J ) = TEMP*B( I, J )
kusano 2b45e8
  190             CONTINUE
kusano 2b45e8
                  DO 210, K = J + 1, N
kusano 2b45e8
                     IF( A( K, J ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP = ALPHA*A( K, J )
kusano 2b45e8
                        DO 200, I = 1, M
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*B( I, K )
kusano 2b45e8
  200                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
  210             CONTINUE
kusano 2b45e8
  220          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         ELSE
kusano 2b45e8
*
kusano 2b45e8
*           Form  B := alpha*B*A'.
kusano 2b45e8
*
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               DO 260, K = 1, N
kusano 2b45e8
                  DO 240, J = 1, K - 1
kusano 2b45e8
                     IF( A( J, K ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP = ALPHA*A( J, K )
kusano 2b45e8
                        DO 230, I = 1, M
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*B( I, K )
kusano 2b45e8
  230                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
  240             CONTINUE
kusano 2b45e8
                  TEMP = ALPHA
kusano 2b45e8
                  IF( NOUNIT )
kusano 2b45e8
     $               TEMP = TEMP*A( K, K )
kusano 2b45e8
                  IF( TEMP.NE.ONE )THEN
kusano 2b45e8
                     DO 250, I = 1, M
kusano 2b45e8
                        B( I, K ) = TEMP*B( I, K )
kusano 2b45e8
  250                CONTINUE
kusano 2b45e8
                  END IF
kusano 2b45e8
  260          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 300, K = N, 1, -1
kusano 2b45e8
                  DO 280, J = K + 1, N
kusano 2b45e8
                     IF( A( J, K ).NE.ZERO )THEN
kusano 2b45e8
                        TEMP = ALPHA*A( J, K )
kusano 2b45e8
                        DO 270, I = 1, M
kusano 2b45e8
                           B( I, J ) = B( I, J ) + TEMP*B( I, K )
kusano 2b45e8
  270                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
  280             CONTINUE
kusano 2b45e8
                  TEMP = ALPHA
kusano 2b45e8
                  IF( NOUNIT )
kusano 2b45e8
     $               TEMP = TEMP*A( K, K )
kusano 2b45e8
                  IF( TEMP.NE.ONE )THEN
kusano 2b45e8
                     DO 290, I = 1, M
kusano 2b45e8
                        B( I, K ) = TEMP*B( I, K )
kusano 2b45e8
  290                CONTINUE
kusano 2b45e8
                  END IF
kusano 2b45e8
  300          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         END IF
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of STRMM .
kusano 2b45e8
*
kusano 2b45e8
      END