Solves a system of linear equations with a triangular coefficient matrix.
When left_side is TRUE, solves op(a) %*% x = b for x.
When left_side is FALSE, solves x %*% op(a) = b for x.
Axes before the last two are batch axes and must match
between a and b (no broadcasting).
Here op is A or A^T depending on transpose_a.
Arguments
- a
(
arrayish)
Triangular coefficient matrix of data type floating-point with at least 2 axes. The last two axes must be equal (square matrix); any leading axes are batch axes.- b
(
arrayish)
Right-hand side. Same data type and rank asa(rank >= 2), with matching leading batch axes. The size ofa's last two (square) axes must equalb's second-to-last axis whenleft_side = TRUE, orb's last axis whenleft_side = FALSE.- left_side
(
logical(1))
IfTRUE, solveop(a) %*% x = b. IfFALSE, solvex %*% op(a) = b.- lower
(
logical(1))
IfTRUE,ais lower triangular. IfFALSE,ais upper triangular.- unit_diagonal
(
logical(1))
IfTRUE, assume diagonal elements ofaare 1.- transpose_a
(
logical(1))
IfTRUE, solve witht(a)in place ofa. Defaults toFALSE.
Value
arrayish
Has the same shape and data type as b.
It is ambiguous if both a and b are ambiguous.
StableHLO
Lowers to hlo_triangular_solve().
References
Giles M (2008). “An extended collection of matrix derivative results for forward and reverse mode automatic differentiation.” Oxford University Computing Laboratory.