Rate This Document
Findability
Accuracy
Completeness
Readability

?trmm

Compute a matrix-matrix product where one input matrix is triangular.

That is, or .

alpha is a multiplication coefficient, B is a general m*n matrix, and A is a triangular matrix.

Interface Definition

C interface:

void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const BLASINT M, const BLASINT N, const float alpha, const float *A, const BLASINT lda, float *B, const BLASINT ldb);

void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const BLASINT M, const BLASINT N, const double alpha, const double *A, const BLASINT lda, double *B, const BLASINT ldb);

void cblas_ctrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const BLASINT M, const BLASINT N, const void *alpha, const void *A, const BLASINT lda, void *B, const BLASINT ldb);

void cblas_ztrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const BLASINT M, const BLASINT N, const void *alpha, const void *A, const BLASINT lda, void *B, const BLASINT ldb);

Fortran interface:

CALL STRMM(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)

CALL DTRMM(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)

CALL CTRMM(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)

CALL ZTRMM(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

Indicates whether the matrix is in row- or column-major order.

Input

Side

Enumeration type CBLAS_SIDE

Indicates whether matrix A is on the left or right of matrix B.

  • If Side = CblasLeft, .
  • If Side = CblasRight, .

Input

Uplo

Enumeration type CBLAS_UPLO

Indicates whether the upper triangle or the lower triangle of the matrix A is used.

  • If Uplo=CblasUpper, the upper triangular part of A is used.
  • If Uplo=CblasLower, the lower triangular part of A is used.

Input

TranA

Enumeration type CBLAS_TRANSPOSE

Indicates whether matrix A is a conventional matrix, a transpose matrix, or a conjugate matrix.

  • If TranA = CblasNoTrans, .
  • If TranA = CblasTrans, .
  • If TranA = CblasConjTrans, .

Input

Diag

Enumeration type CBLAS_DIAG

Indicates whether the matrix is a unit triangular matrix.

Input

M

Integer

Number of rows of matrix B.

Input

N

Integer

Number of columns of matrix B.

Input

alpha

  • Single-precision floating-point type for strmm
  • Double-precision floating-point type for dtrmm
  • Single-precision complex type for ctrmm
  • Double-precision complex type for ztrmm

Multiplication coefficient.

Input

A

  • Single-precision floating-point type for strmm
  • Double-precision floating-point type for dtrmm
  • Single-precision complex type for ctrmm
  • Double-precision complex type for ztrmm

Matrix (lda, k).

  • If Side = CblasLeft, k = m.
  • If Side = CblasRight, k = n.

Input

lda

Integer

  • If the matrix is column store and side = CblasLeft, lda must be at least max(1, m). Otherwise, lda must be at least max(1, n).
  • If the matrix is row store and Trans = CblasNoTrans, lda must be at least max(1, n). Otherwise, lda must be at least max(1, m).

Input

B

  • Single-precision floating-point type for strmm
  • Double-precision floating-point type for dtrmm
  • Single-precision complex type for ctrmm
  • Double-precision complex type for ztrmm

Matrix B.

Input/Output

ldb

Integer

If the matrix is column store, ldb must be at least max(1, m). Otherwise, ldb must be at least max(1, n).

Input

Dependency

#include "kblas.h"

Examples

C interface:

    int m = 3, n = 3, lda = 3, ldb = 3; 
    float alpha = 1.0; 
    /** 
     *            | 4.0   1.0  2.0 | 
     *    A    =  |  .    1.0  3.0 | 
     *            |  .     .   1.0 | 
     * 
     *     B    =  | 2.0   3.0  1.0| 
     *             | 11.0  -2.0 2.0| 
     *             | 1.0   1.0  6.0| 
     */ 
    float a[9] = {4.0, 0, 0, 1.0, 1.0, 0, 2.0, 3.0, 1.0}; 
    float b[9] = {2.0, 11.0, 1.0, 3.0, -2.0, 1.0, 1.0, 2.0, 6.0}; 
 
    cblas_strmm(CblasColMajor, CblasRight, CblasUpper, CblasNoTrans, CblasNonUnit, m, n, alpha, a, lda, b, ldb); 
    /** 
     * Output B 
     *        | 8.000000        5.000000        14.000000| 
     *    B = | 44.000000       9.000000        18.000000| 
     *        | 4.000000        2.000000        11.000000| 
     */

Fortran interface:

      INTEGER :: M=3, N=3 
      INTEGER :: LDA=3, LDB=3 
      REAL(4) :: ALPHA=1.0 
      REAL(4) :: A(3, 3), B(3, 3) 
      DATA A/4.0, 0, 0, 1.0, 1.0, 0, 2.0, 3.0, 1.0/ 
      DATA B/2.0, 11.0, 1.0, 3.0, -2.0, 1.0, 1.0, 2.0, 6.0/ 
      EXTERNAL STRMM 
      CALL STRMM('R', 'U', 'N', 'N', M, N, ALPHA, A, LDA, B, LDB) 
 
*     Output B 
*            | 8.000000        5.000000        14.000000| 
*        B = | 44.000000       9.000000        18.000000| 
*            | 4.000000        2.000000        11.000000|