c@427: /* dtrmm.f -- translated by f2c (version 20061008). c@427: You must link the resulting object file with libf2c: c@427: on Microsoft Windows system, link with libf2c.lib; c@427: on Linux or Unix systems, link with .../path/to/libf2c.a -lm c@427: or, if you install libf2c.a in a standard place, with -lf2c -lm c@427: -- in that order, at the end of the command line, as in c@427: cc *.o -lf2c -lm c@427: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., c@427: c@427: http://www.netlib.org/f2c/libf2c.zip c@427: */ c@427: c@427: #include "f2c.h" c@427: #include "blaswrap.h" c@427: c@427: /* Subroutine */ int dtrmm_(char *side, char *uplo, char *transa, char *diag, c@427: integer *m, integer *n, doublereal *alpha, doublereal *a, integer * c@427: lda, doublereal *b, integer *ldb) c@427: { c@427: /* System generated locals */ c@427: integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3; c@427: c@427: /* Local variables */ c@427: integer i__, j, k, info; c@427: doublereal temp; c@427: logical lside; c@427: extern logical lsame_(char *, char *); c@427: integer nrowa; c@427: logical upper; c@427: extern /* Subroutine */ int xerbla_(char *, integer *); c@427: logical nounit; c@427: c@427: /* .. Scalar Arguments .. */ c@427: /* .. */ c@427: /* .. Array Arguments .. */ c@427: /* .. */ c@427: c@427: /* Purpose */ c@427: /* ======= */ c@427: c@427: /* DTRMM performs one of the matrix-matrix operations */ c@427: c@427: /* B := alpha*op( A )*B, or B := alpha*B*op( A ), */ c@427: c@427: /* where alpha is a scalar, B is an m by n matrix, A is a unit, or */ c@427: /* non-unit, upper or lower triangular matrix and op( A ) is one of */ c@427: c@427: /* op( A ) = A or op( A ) = A'. */ c@427: c@427: /* Arguments */ c@427: /* ========== */ c@427: c@427: /* SIDE - CHARACTER*1. */ c@427: /* On entry, SIDE specifies whether op( A ) multiplies B from */ c@427: /* the left or right as follows: */ c@427: c@427: /* SIDE = 'L' or 'l' B := alpha*op( A )*B. */ c@427: c@427: /* SIDE = 'R' or 'r' B := alpha*B*op( A ). */ c@427: c@427: /* Unchanged on exit. */ c@427: c@427: /* UPLO - CHARACTER*1. */ c@427: /* On entry, UPLO specifies whether the matrix A is an upper or */ c@427: /* lower triangular matrix as follows: */ c@427: c@427: /* UPLO = 'U' or 'u' A is an upper triangular matrix. */ c@427: c@427: /* UPLO = 'L' or 'l' A is a lower triangular matrix. */ c@427: c@427: /* Unchanged on exit. */ c@427: c@427: /* TRANSA - CHARACTER*1. */ c@427: /* On entry, TRANSA specifies the form of op( A ) to be used in */ c@427: /* the matrix multiplication as follows: */ c@427: c@427: /* TRANSA = 'N' or 'n' op( A ) = A. */ c@427: c@427: /* TRANSA = 'T' or 't' op( A ) = A'. */ c@427: c@427: /* TRANSA = 'C' or 'c' op( A ) = A'. */ c@427: c@427: /* Unchanged on exit. */ c@427: c@427: /* DIAG - CHARACTER*1. */ c@427: /* On entry, DIAG specifies whether or not A is unit triangular */ c@427: /* as follows: */ c@427: c@427: /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */ c@427: c@427: /* DIAG = 'N' or 'n' A is not assumed to be unit */ c@427: /* triangular. */ c@427: c@427: /* Unchanged on exit. */ c@427: c@427: /* M - INTEGER. */ c@427: /* On entry, M specifies the number of rows of B. M must be at */ c@427: /* least zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* N - INTEGER. */ c@427: /* On entry, N specifies the number of columns of B. N must be */ c@427: /* at least zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* ALPHA - DOUBLE PRECISION. */ c@427: /* On entry, ALPHA specifies the scalar alpha. When alpha is */ c@427: /* zero then A is not referenced and B need not be set before */ c@427: /* entry. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* A - DOUBLE PRECISION array of DIMENSION ( LDA, k ), where k is m */ c@427: /* when SIDE = 'L' or 'l' and is n when SIDE = 'R' or 'r'. */ c@427: /* Before entry with UPLO = 'U' or 'u', the leading k by k */ c@427: /* upper triangular part of the array A must contain the upper */ c@427: /* triangular matrix and the strictly lower triangular part of */ c@427: /* A is not referenced. */ c@427: /* Before entry with UPLO = 'L' or 'l', the leading k by k */ c@427: /* lower triangular part of the array A must contain the lower */ c@427: /* triangular matrix and the strictly upper triangular part of */ c@427: /* A is not referenced. */ c@427: /* Note that when DIAG = 'U' or 'u', the diagonal elements of */ c@427: /* A are not referenced either, but are assumed to be unity. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* LDA - INTEGER. */ c@427: /* On entry, LDA specifies the first dimension of A as declared */ c@427: /* in the calling (sub) program. When SIDE = 'L' or 'l' then */ c@427: /* LDA must be at least max( 1, m ), when SIDE = 'R' or 'r' */ c@427: /* then LDA must be at least max( 1, n ). */ c@427: /* Unchanged on exit. */ c@427: c@427: /* B - DOUBLE PRECISION array of DIMENSION ( LDB, n ). */ c@427: /* Before entry, the leading m by n part of the array B must */ c@427: /* contain the matrix B, and on exit is overwritten by the */ c@427: /* transformed matrix. */ c@427: c@427: /* LDB - INTEGER. */ c@427: /* On entry, LDB specifies the first dimension of B as declared */ c@427: /* in the calling (sub) program. LDB must be at least */ c@427: /* max( 1, m ). */ c@427: /* Unchanged on exit. */ c@427: c@427: c@427: /* Level 3 Blas routine. */ c@427: c@427: /* -- Written on 8-February-1989. */ c@427: /* Jack Dongarra, Argonne National Laboratory. */ c@427: /* Iain Duff, AERE Harwell. */ c@427: /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */ c@427: /* Sven Hammarling, Numerical Algorithms Group Ltd. */ c@427: c@427: c@427: /* .. External Functions .. */ c@427: /* .. */ c@427: /* .. External Subroutines .. */ c@427: /* .. */ c@427: /* .. Intrinsic Functions .. */ c@427: /* .. */ c@427: /* .. Local Scalars .. */ c@427: /* .. */ c@427: /* .. Parameters .. */ c@427: /* .. */ c@427: c@427: /* Test the input parameters. */ c@427: c@427: /* Parameter adjustments */ c@427: a_dim1 = *lda; c@427: a_offset = 1 + a_dim1; c@427: a -= a_offset; c@427: b_dim1 = *ldb; c@427: b_offset = 1 + b_dim1; c@427: b -= b_offset; c@427: c@427: /* Function Body */ c@427: lside = lsame_(side, "L"); c@427: if (lside) { c@427: nrowa = *m; c@427: } else { c@427: nrowa = *n; c@427: } c@427: nounit = lsame_(diag, "N"); c@427: upper = lsame_(uplo, "U"); c@427: c@427: info = 0; c@427: if (! lside && ! lsame_(side, "R")) { c@427: info = 1; c@427: } else if (! upper && ! lsame_(uplo, "L")) { c@427: info = 2; c@427: } else if (! lsame_(transa, "N") && ! lsame_(transa, c@427: "T") && ! lsame_(transa, "C")) { c@427: info = 3; c@427: } else if (! lsame_(diag, "U") && ! lsame_(diag, c@427: "N")) { c@427: info = 4; c@427: } else if (*m < 0) { c@427: info = 5; c@427: } else if (*n < 0) { c@427: info = 6; c@427: } else if (*lda < max(1,nrowa)) { c@427: info = 9; c@427: } else if (*ldb < max(1,*m)) { c@427: info = 11; c@427: } c@427: if (info != 0) { c@427: xerbla_("DTRMM ", &info); c@427: return 0; c@427: } c@427: c@427: /* Quick return if possible. */ c@427: c@427: if (*m == 0 || *n == 0) { c@427: return 0; c@427: } c@427: c@427: /* And when alpha.eq.zero. */ c@427: c@427: if (*alpha == 0.) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: b[i__ + j * b_dim1] = 0.; c@427: /* L10: */ c@427: } c@427: /* L20: */ c@427: } c@427: return 0; c@427: } c@427: c@427: /* Start the operations. */ c@427: c@427: if (lside) { c@427: if (lsame_(transa, "N")) { c@427: c@427: /* Form B := alpha*A*B. */ c@427: c@427: if (upper) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: i__2 = *m; c@427: for (k = 1; k <= i__2; ++k) { c@427: if (b[k + j * b_dim1] != 0.) { c@427: temp = *alpha * b[k + j * b_dim1]; c@427: i__3 = k - 1; c@427: for (i__ = 1; i__ <= i__3; ++i__) { c@427: b[i__ + j * b_dim1] += temp * a[i__ + k * c@427: a_dim1]; c@427: /* L30: */ c@427: } c@427: if (nounit) { c@427: temp *= a[k + k * a_dim1]; c@427: } c@427: b[k + j * b_dim1] = temp; c@427: } c@427: /* L40: */ c@427: } c@427: /* L50: */ c@427: } c@427: } else { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: for (k = *m; k >= 1; --k) { c@427: if (b[k + j * b_dim1] != 0.) { c@427: temp = *alpha * b[k + j * b_dim1]; c@427: b[k + j * b_dim1] = temp; c@427: if (nounit) { c@427: b[k + j * b_dim1] *= a[k + k * a_dim1]; c@427: } c@427: i__2 = *m; c@427: for (i__ = k + 1; i__ <= i__2; ++i__) { c@427: b[i__ + j * b_dim1] += temp * a[i__ + k * c@427: a_dim1]; c@427: /* L60: */ c@427: } c@427: } c@427: /* L70: */ c@427: } c@427: /* L80: */ c@427: } c@427: } c@427: } else { c@427: c@427: /* Form B := alpha*A'*B. */ c@427: c@427: if (upper) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: for (i__ = *m; i__ >= 1; --i__) { c@427: temp = b[i__ + j * b_dim1]; c@427: if (nounit) { c@427: temp *= a[i__ + i__ * a_dim1]; c@427: } c@427: i__2 = i__ - 1; c@427: for (k = 1; k <= i__2; ++k) { c@427: temp += a[k + i__ * a_dim1] * b[k + j * b_dim1]; c@427: /* L90: */ c@427: } c@427: b[i__ + j * b_dim1] = *alpha * temp; c@427: /* L100: */ c@427: } c@427: /* L110: */ c@427: } c@427: } else { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: temp = b[i__ + j * b_dim1]; c@427: if (nounit) { c@427: temp *= a[i__ + i__ * a_dim1]; c@427: } c@427: i__3 = *m; c@427: for (k = i__ + 1; k <= i__3; ++k) { c@427: temp += a[k + i__ * a_dim1] * b[k + j * b_dim1]; c@427: /* L120: */ c@427: } c@427: b[i__ + j * b_dim1] = *alpha * temp; c@427: /* L130: */ c@427: } c@427: /* L140: */ c@427: } c@427: } c@427: } c@427: } else { c@427: if (lsame_(transa, "N")) { c@427: c@427: /* Form B := alpha*B*A. */ c@427: c@427: if (upper) { c@427: for (j = *n; j >= 1; --j) { c@427: temp = *alpha; c@427: if (nounit) { c@427: temp *= a[j + j * a_dim1]; c@427: } c@427: i__1 = *m; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1]; c@427: /* L150: */ c@427: } c@427: i__1 = j - 1; c@427: for (k = 1; k <= i__1; ++k) { c@427: if (a[k + j * a_dim1] != 0.) { c@427: temp = *alpha * a[k + j * a_dim1]; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: b[i__ + j * b_dim1] += temp * b[i__ + k * c@427: b_dim1]; c@427: /* L160: */ c@427: } c@427: } c@427: /* L170: */ c@427: } c@427: /* L180: */ c@427: } c@427: } else { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: temp = *alpha; c@427: if (nounit) { c@427: temp *= a[j + j * a_dim1]; c@427: } c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1]; c@427: /* L190: */ c@427: } c@427: i__2 = *n; c@427: for (k = j + 1; k <= i__2; ++k) { c@427: if (a[k + j * a_dim1] != 0.) { c@427: temp = *alpha * a[k + j * a_dim1]; c@427: i__3 = *m; c@427: for (i__ = 1; i__ <= i__3; ++i__) { c@427: b[i__ + j * b_dim1] += temp * b[i__ + k * c@427: b_dim1]; c@427: /* L200: */ c@427: } c@427: } c@427: /* L210: */ c@427: } c@427: /* L220: */ c@427: } c@427: } c@427: } else { c@427: c@427: /* Form B := alpha*B*A'. */ c@427: c@427: if (upper) { c@427: i__1 = *n; c@427: for (k = 1; k <= i__1; ++k) { c@427: i__2 = k - 1; c@427: for (j = 1; j <= i__2; ++j) { c@427: if (a[j + k * a_dim1] != 0.) { c@427: temp = *alpha * a[j + k * a_dim1]; c@427: i__3 = *m; c@427: for (i__ = 1; i__ <= i__3; ++i__) { c@427: b[i__ + j * b_dim1] += temp * b[i__ + k * c@427: b_dim1]; c@427: /* L230: */ c@427: } c@427: } c@427: /* L240: */ c@427: } c@427: temp = *alpha; c@427: if (nounit) { c@427: temp *= a[k + k * a_dim1]; c@427: } c@427: if (temp != 1.) { c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1]; c@427: /* L250: */ c@427: } c@427: } c@427: /* L260: */ c@427: } c@427: } else { c@427: for (k = *n; k >= 1; --k) { c@427: i__1 = *n; c@427: for (j = k + 1; j <= i__1; ++j) { c@427: if (a[j + k * a_dim1] != 0.) { c@427: temp = *alpha * a[j + k * a_dim1]; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: b[i__ + j * b_dim1] += temp * b[i__ + k * c@427: b_dim1]; c@427: /* L270: */ c@427: } c@427: } c@427: /* L280: */ c@427: } c@427: temp = *alpha; c@427: if (nounit) { c@427: temp *= a[k + k * a_dim1]; c@427: } c@427: if (temp != 1.) { c@427: i__1 = *m; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1]; c@427: /* L290: */ c@427: } c@427: } c@427: /* L300: */ c@427: } c@427: } c@427: } c@427: } c@427: c@427: return 0; c@427: c@427: /* End of DTRMM . */ c@427: c@427: } /* dtrmm_ */