# ?trsm

Solves a matrix equation (one matrix operand is triangular).

## Syntax

FORTRAN 77:

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 )

Fortran 95:

call trsm(a, b [,side] [, uplo] [,transa][,diag] [,alpha])

## Description

The ?trsm routines solve one of the following matrix equations:
`op(A)*X = alpha*B,`

or
`X*op(A) = alpha*B,`

where:

alpha is a scalar,

X and B are m-by-n matrices,

A is a unit, or non-unit, upper or lower triangular matrix

`op(A)` is one of `op(A) = A`, or `op(A) = A'`, or `op(A) = conjg(A')`.

The matrix B is overwritten by the solution matrix X.

## Input Parameters

side

  CHARACTER*1. Specifies whether `op(A)` appears on the left or right of X in the equation:

  if `side = 'L'` or 'l', then `op(A)*X = alpha*B`;

  if `side = 'R'` or 'r', then `X*op(A) = alpha*B`.

uplo

  CHARACTER*1. Specifies whether the matrix A is upper or lower triangular:

  if `uplo = 'U'` or 'u', then the matrix is upper triangular;

  if `uplo = 'L'` or 'l', then the matrix is low triangular.

transa

  CHARACTER*1. Specifies the form of `op(A)` used in the matrix multiplication:

  if `transa = 'N'` or `'n'`, then `op(A) = A`;

  if `transa = 'T'` or `'t'`, then `op(A) = A'`;

  if `transa = 'C'` or `'c'`, then `op(A) = conjg(A')`.

diag

  CHARACTER*1. Specifies whether the matrix A is unit triangular:

  if `diag = 'U'` or 'u' then the matrix is unit triangular;

  if `diag = 'N'` or 'n', then the matrix is not unit triangular.

m

  INTEGER. Specifies the number of rows of B. The value of m must be at least zero.

n

  INTEGER. Specifies the number of columns of B. The value of n must be at least zero.

alpha

  REAL for strsm

  DOUBLE PRECISION for dtrsm

  COMPLEX for ctrsm

  DOUBLE COMPLEX for ztrsm

  Specifies the scalar alpha.

  When alpha is zero, then a is not referenced and b need not be set before entry.

a

  REAL for strsm

  DOUBLE PRECISION for dtrsm

  COMPLEX for ctrsm

  DOUBLE COMPLEX for ztrsm

  Array, DIMENSION `(lda, k)`, where k is m when `side = 'L'` or 'l' and is n when `side = 'R'` or 'r'. Before entry with `uplo = 'U'` or 'u', the leading k by k upper triangular part of the array a must contain the upper triangular matrix and the strictly lower triangular part of a is not referenced.

  Before entry with `uplo = 'L'` or 'l', the leading k by k lower triangular part of the array a must contain the lower triangular matrix and the strictly upper triangular part of a is not referenced.

  When `diag = 'U'` or 'u', the diagonal elements of a are not referenced either, but are assumed to be unity.

lda

  INTEGER. Specifies the first dimension of a as declared in the calling (sub)program. When `side = 'L'` or 'l', then lda must be at least `max(1, m)`, when `side = 'R'` or 'r', then lda must be at least `max(1, n)`.

b

  REAL for strsm

  DOUBLE PRECISION for dtrsm

  COMPLEX for ctrsm

  DOUBLE COMPLEX for ztrsm

  Array, DIMENSION `(ldb,n)`. Before entry, the leading m-by-n part of the array b must contain the right-hand side matrix B.

ldb

  INTEGER. Specifies the first dimension of b as declared in the calling (sub)program. The value of ldb must be at least `max(1, +m)`.

## Output Parameters

b

  Overwritten by the solution matrix X.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine trsm interface are the following:

a

  Holds the matrix A of size (k,k) where `k = m` if `side = 'L'`, `k = n` otherwise.

b

  Holds the matrix B of size (m,n).

side

  Must be 'L' or 'R'. The default value is 'L'.

uplo

  Must be 'U' or 'L'. The default value is 'U'.

transa

  Must be 'N', 'C', or 'T'.

  The default value is 'N'.

diag

  Must be 'N' or 'U'. The default value is 'N'.

alpha

  The default value is 1.

Parent topic: BLAS Level 3 Routines