Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.lu_solve

mindspore.ops.lu_solve(b, LU_data, LU_pivots)[source]

Computes the solution y to the system of linear equations Ay=b , given LU decomposition A and column vector b.

LU decomposition of a matrix can be generated from mindspore.scipy.linalg.lu_factor() .

Warning

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

Parameters
  • b (Tensor) – Column vector b in the above equation. It has shape (,m,k), where is batch dimensions, with data type float32, float16.

  • LU_data (Tensor) – LU decomposition. It has shape (,m,m), where is batch dimensions, that can be decomposed into an upper triangular matrix U and a lower triangular matrix L, with data type float32, float16.

  • LU_pivots (Tensor) – Permutation matrix P of LU decomposition. It has shape (,m), where is batch dimensions, that can be converted to a permutation matrix P, with data type int32.

Returns

Tensor, the same data type as the b and LU_data.

Raises
  • TypeError – If dtype of b or LU_data is not one of: float32, float16.

  • TypeError – If dtype of LU_pivots is not: int32.

  • TypeError – If b, LU_data or LU_pivots is not Tensor.

  • TypeError – If dtype of b is not same as dtype of LU_data.

  • ValueError – If the batch dimensions of LU_pivots does not match the batch dimensions of LU_data.

  • ValueError – If b dimension less than 2, LU_data dimension less than 2 or LU_pivots dimension less than 1.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> b = Tensor(np.array([[1], [3], [3]]), mindspore.float32)
>>> LU_data = Tensor(np.array([[2, 1, 1], [0.5, 1, 1.5], [0.5, 0, 2.5]]), mindspore.float32)
>>> LU_pivots = Tensor(np.array([2, 2, 3]), mindspore.int32)
>>> y = ops.lu_solve(b, LU_data, LU_pivots)
>>> print(y)
[[ 1.9000002]
 [-1.4000001]
 [ 0.6      ]]