latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.lu_solve
- tensorplay.functional.lu_solve(b, LU_data, LU_pivots, *, out=None) Tensor[source]
Returns the LU solve of the linear system using the partially pivoted LU factorization of A from
lu_factor().This function supports
float,double,cfloatandcdoubledtypes forinput.Warning
tensorplay.lu_solve()is deprecated in favor oftensorplay.linalg.lu_solve().X = tensorplay.lu_solve(B, LU, pivots)should be replaced withX = linalg.lu_solve(LU, pivots, B)- Parameters:
b (Tensor) – the RHS tensor of size , where is zero or more batch dimensions.
LU_data (Tensor) – the pivoted LU factorization of A from
lu_factor()of size , where is zero or more batch dimensions.LU_pivots (IntTensor) – the pivots of the LU factorization from
lu_factor()of size , where is zero or more batch dimensions. The batch dimensions ofLU_pivotsmust be equal to the batch dimensions ofLU_data.
- Keyword Arguments:
out (Tensor, optional) – the output tensor.
Example:
>>> A = tensorplay.randn(2, 3, 3) >>> b = tensorplay.randn(2, 3, 1) >>> LU, pivots = tensorplay.linalg.lu_factor(A) >>> x = tensorplay.lu_solve(b, LU, pivots) >>> tensorplay.dist(A @ x, b) tensor(1.00000e-07 * 2.8312)
Help improve this page
Found an error, an unclear step, or a missing example?

