mindspore.ops.cholesky_solve

View Source On Gitee
mindspore.ops.cholesky_solve(input, input2, upper=False)[source]

Computes the solution of a set of linear equations with a positive definite matrix, according to its Cholesky decomposition factor input2 .

If upper is set to True and input2 is upper triangular, the output tensor is that:

output=(input2Tinput2)1input

If upper is set to False and input2 is lower triangular, the output is that:

output=(input2input2T)1input

Warning

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

Parameters
  • input (Tensor) – The input tensor of shape (,N,M).

  • input2 (Tensor) – The tensor of shape (,N,N) , composed of upper or lower triangular Cholesky factor.

  • upper (bool, optional) – Whether to treat the Cholesky factor as an upper triangular matrix. Default False .

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input1 = mindspore.tensor([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
>>> input2 = mindspore.tensor([[2., 0., 0.], [4., 1., 0.], [-1., 1., 2.]])
>>> out = mindspore.ops.cholesky_solve(input1, input2, upper=False)
>>> print(out)
[[ 5.8125 -2.625   0.625 ]
 [-2.625   1.25   -0.25  ]
 [ 0.625  -0.25    0.25  ]]