Rate This Document
Findability
Accuracy
Completeness
Readability

?trsm

Solve a triangular matrix equation.

The equation is one of the following forms:

, or .

, or .

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

Interface Definition

C interface:

void cblas_strsm(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_dtrsm(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_ctrsm(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_ztrsm(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 STRSM(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)

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

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

CALL ZTRSM(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 op(A) is on the left or right of X.

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

Input

Uplo

Enumeration type CBLAS_UPLO

Indicates whether to use the upper triangle or lower triangle of matrix A.

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

Input

TransA

Enumeration type CBLAS_TRANSPOSE

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

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

Input

Diag

Enumeration type CBLAS_DIAG

Indicates whether A is a unit trigonometric matrix.

  • If Diag = CblasUnit, A is a unit triangular matrix.
  • If Diag = CblasNonUnit, A is not 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 strsm
  • Double-precision floating-point type for dtrsm
  • Single-precision complex type for ctrsm
  • Double-precision complex type for ztrsm

Multiplication coefficient.

Input

A

  • Single-precision floating-point type for strsm
  • Double-precision floating-point type for dtrsm
  • Single-precision complex type for ctrsm
  • Double-precision complex type for ztrsm

Triangular matrix A (lda, N).

Input

lda

Integer

Leading dimension of matrix A. The value of lda must be greater than or equal to max(1, N).

Input

B

  • Single-precision floating-point type for strsm
  • Double-precision floating-point type for dtrsm
  • Single-precision complex type for ctrsm
  • Double-precision complex type for ztrsm

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_strsm(CblasColMajor, CblasRight, CblasUpper, CblasNoTrans, CblasNonUnit, m, n, alpha, a, lda, b, ldb); 
    /** 
     * Output B 
     *         | 0.500000        2.500000        -7.500000| 
     *    B =  | 2.750000        -4.750000       10.750000| 
     *         | 0.250000        0.750000        3.250000 | 
     */

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 STRSM 
      CALL STRSM('R', 'U', 'N', 'N', M, N, ALPHA, A, LDA, B, LDB) 
 
*     Output B 
*             | 0.500000        2.500000        -7.500000| 
*        B =  | 2.750000        -4.750000       10.750000| 
*             | 0.250000        0.750000        3.250000 |