Skip to content
fn

strsm

void strsm(bool upper, bool unit_diag, int M, int N, const float * A, int lda, float * B, int ldb)

Single-precision triangular solve with a matrix right-hand side (TRSM).

Overwrites BB with X=A−1BX = A^{-1} B, where AA is an M×MM \times M triangular matrix on the left and BB is M×NM \times N, both row-major. Only the triangle named by upper is read; unit_diag treats the diagonal as ones without reading it. Dispatches to Accelerate's cblas_strsm with side Left, no transpose and α=1\alpha = 1.

Math

For upper AA, back substitution: xi=(bi−∑j>iAijxj)/Aiix_i = \Big(b_i - \sum_{j > i} A_{ij} x_j\Big) / A_{ii}

References

Accelerate.framework cblas_strsm.

Parameters

upperbool
Whether AA is upper (back substitution) or lower (forward substitution) triangular.
unit_diagbool
Treat the diagonal of AA as all ones.
M, Nint
A∈RM×MA \in \mathbb{R}^{M \times M}, B∈RM×NB \in \mathbb{R}^{M \times N}.
Aconst float*
Row-major triangular matrix buffer.
ldaint
Leading dimension (row stride) of AA.
Bfloat*
Row-major right-hand sides, replaced by the solution.
ldbint
Leading dimension (row stride) of BB.

Notes

No singularity check. An exactly-zero diagonal entry divides by zero, so the solution carries the IEEE result (±∞\pm\infty, or NaN for 0/00 / 0) — the reference framework's answer for a singular triangle. LAPACK's ?trtrs driver checks the diagonal first and reports info > 0 without solving; that is the difference that matters here.