TensorPlay
latest (dev)
Copy
View Markdown

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 Ax=bAx = b using the partially pivoted LU factorization of A from lu_factor().

This function supports float, double, cfloat and cdouble dtypes for input.

Warning

tensorplay.lu_solve() is deprecated in favor of tensorplay.linalg.lu_solve(). X = tensorplay.lu_solve(B, LU, pivots) should be replaced with

X = linalg.lu_solve(LU, pivots, B)
Parameters:
  • b (Tensor) – the RHS tensor of size (∗,m,k)(*, m, k), where ∗* is zero or more batch dimensions.

  • LU_data (Tensor) – the pivoted LU factorization of A from lu_factor() of size (∗,m,m)(*, m, m), where ∗* is zero or more batch dimensions.

  • LU_pivots (IntTensor) – the pivots of the LU factorization from lu_factor() of size (∗,m)(*, m), where ∗* is zero or more batch dimensions. The batch dimensions of LU_pivots must be equal to the batch dimensions of LU_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)

On this page

Ask DeepWiki