Skip to content
fn

lu_solve_op

→TensorImplPtr
int lu_solve_op(const int & LU, const int & pivots, const int & b)

Python wrappers

Public Python APIs implemented by this engine symbol.

Solve Ax=bAx = b given the packed LU factors and pivot vector.

Shape

  • LU: (*, n, n).
  • pivots: LU.shape[:-1].
  • b: (*, n, k), or (n,) (vector RHS).
  • Output: the broadcast batch followed by (n, k), or by (n,) for a vector RHS.

References

LAPACK sgetrs/dgetrs; LAPACK Users' Guide §2.5.1.

See Also

[[lu_factor_op]] : Produce the packed factors consumed here. [[solve_op]] : Differentiable one-shot solve (factor + apply).

Parameters

LUconst TensorImplPtr&
Packed LU matrix of shape (..., n, n) as returned by [[lu_factor_op]] — upper triangle holds UU, strict lower triangle holds the off-diagonal entries of LL.
pivotsconst TensorImplPtr&
1-based pivot indices of shape LU.shape[:-1] and dtype I32.
bconst TensorImplPtr&
Right-hand side — see Shape.

Returns

TensorImplPtr

Solution tensor with the dtype of b.

Raises

ShapeMismatch
When pivots is not LU.shape[:-1] or b breaks the right-hand-side contract — before any LAPACK call.
LinAlgError
When LU or b is not a float dtype, or when any argument is null.