Rate This Document
Findability
Accuracy
Completeness
Readability

?trsm

Solve a triangular matrix equation.

, or

, , or

Alpha is a multiplication coefficient, X and B are general m x 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

The matrix A is a conventional matrix, a transposed matrix, or a conjugate matrix.

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

Input

Diag

Enumeration type CBLAS_DIAG

Indicates whether A is a unit trigonometric array.

  • If Diag=CblasUnit, A is a unit triangular matrix.
  • If Diag=CblasNonUnit, A is not a unit triangular matrix.

Input

N

Integer

Order of matrix A. The value of N must be greater than or equal to 0.

Input

A

  • For strsm, A is of the single-precision floating-point type.
  • For dtrsm, A is of the double-precision floating-point type.
  • For ctrsm, A is of the single-precision complex type.
  • For ztrsm, A is of the double-precision complex type.

Triangular matrix A (lda, N)

Input

lda

Integer

Leading dimension of matrix A. The value of lda must be at least max(1, N).

Input

X

  • For strsm, X is of the single-precision floating-point type.
  • For dtrsm, X is of the double-precision floating-point type.
  • For ctrsm, X is of the single-precision complex type.
  • For ztrsm, X is of the double-precision complex type.

Vector X. The vector scale is at least (1+(N-1)*abs(incX)).

The output is updated after the equation is solved.

Input/Output

incX

Integer

Increment for elements in X. The value cannot be 0.

Input

Dependencies

#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 C 
     *         | 0.500000        2.500000        -7.500000| 
     *    C =  | 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 C 
*             | 0.500000        2.500000        -7.500000| 
*        C =  | 2.750000        -4.750000       10.750000| 
*             | 0.250000        0.750000        3.250000 |