mindspore.ops.lu_solve

View Source On Gitee
mindspore.ops.lu_solve(b, LU_data, LU_pivots)[source]

Compute the solution to a system of linear equations Ay=b.

Note

  • b of shape (,m,k) , LU_data of shape (,m,m) , LU_pivots of shape (,m) , where means batch dimensions.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • b (Tensor) – Column vector b in the above equation.

  • LU_data (Tensor) – LU decomposition. The A in the formula above.

  • LU_pivots (Tensor) – Permutation matrix P of LU decomposition.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> b = mindspore.tensor([[1.], [3.], [3.]])
>>> LU_data = mindspore.tensor([[2., 1., 1.], [0.5, 1., 1.5], [0.5, 0., 2.5]])
>>> LU_pivots = mindspore.tensor(([2, 2, 3]), mindspore.int32)
>>> y = mindspore.ops.lu_solve(b, LU_data, LU_pivots)
>>> print(y)
[[ 1.9000001]
 [-1.4000001]
 [ 0.6      ]]