mindspore.ops.ormqr

mindspore.ops.ormqr(input, tau, other, left=True, transpose=False)[source]

Calculates two matrices multiplication of a product of a general matrix with Householder matrices. Calculates the product of a matrix C(given by other) with dimensions (m, n) and a matrix Q which is represented using Householder reflectors (input, tau). Returns a Tensor.

Parameters
  • input (Tensor) – Tensor of shape \((*, mn, k)\), when left is True, mn equals to m, otherwise, mn equals to n. And * is zero or more batch dimensions.

  • tau (Tensor) – Tensor of shape \((*, min(mn, k))\) where * is zero or more batch dimensions, and its type is the same as input.

  • other (Tensor) – Tensor of shape \((*, m, n)\) where * is zero or more batch dimensions, and its type is the same as input.

  • left (bool, optional) – determines the order of multiplication. If True, computes op(Q) * other , otherwise, compute other * op(Q). Default: True .

  • transpose (bool, optional) – If True, the matrix Q is conjugate transposed, otherwise, not conjugate transposing matrix Q. Default: False .

Returns

Tensor, with the same type and shape as other.

Raises
  • TypeError – If input or tau or other is not Tensor.

  • TypeError – If dtype of input or tau or other is not one of: float64, float32, complex64, complex128.

  • ValueError – If the dimension of input or other is less than 2D.

  • ValueError – If rank(input) - rank(tau) != 1.

  • ValueError – If tau.shape[:-1] != input.shape[:-2]

  • ValueError – If other.shape[:-2] != input.shape[:-2]

  • ValueError – If left == true, other.shape[-2] < tau.shape[-1].

  • ValueError – If left == true, other.shape[-2] != input.shape[-2].

  • ValueError – If left == false, other.shape[-1] < tau.shape[-1].

  • ValueError – If left == false, other.shape[-1] != input.shape[-2].

Supported Platforms:

GPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input = Tensor(np.array([[-114.6, 10.9, 1.1], [-0.304, 38.07, 69.38], [-0.45, -0.17, 62]]),
...                mindspore.float32)
>>> tau = Tensor(np.array([1.55, 1.94, 3.0]), mindspore.float32)
>>> other = Tensor(np.array([[-114.6, 10.9, 1.1],
...                          [-0.304, 38.07, 69.38],
...                          [-0.45, -0.17, 62]]), mindspore.float32)
>>> output = ops.ormqr(input, tau, other)
>>> print(output)
[[  63.82713   -13.823125 -116.28614 ]
 [ -53.659264  -28.157839  -70.42702 ]
 [ -79.54292    24.00183   -41.34253 ]]