mindspore.ops.orgqr

View Source On Gitee
mindspore.ops.orgqr(input, input2)[source]

Compute the first \(N\) columns of a product of Householder matrices.

Usually used to calculate the explicit representation of the orthogonal matrix \(Q\) returned by mindspore.ops.Geqrf.

Take the case of input without batch dimension as an example: Suppose input input is a matrix of size \((M, N)\) after householder transformation. When the diagonal of input is set to 1, every column of lower triangular in input is denoted as \(w_j\) for \(j\) for \(j=1, \ldots, M\), this function returns the first \(N\) columns of the matrix

\[H_{1} H_{2} \ldots H_{k} \quad \text { with } \quad H_{j}=\mathrm{I}_{M}-\tau_{j} w_{j} w_{j}^{\mathrm{H}}\]

where \(\mathrm{I}_{M}\) is the \(M\)-dimensional identity matrix. And when \(w\) is complex, \(w^{\mathrm{H}}\) is the conjugate transpose, otherwise the transpose. The output matrix is the same size as the input matrix input. \(tau\) is corresponding to input2.

Parameters
  • input (Tensor) – 2-D or 3-D input tensor, householder vectors, shape \((*, M, N)\).

  • input2 (Tensor) – 1-D or 2-D input tensor, householder reflection coefficients, shape \((*, K)\), where K is less than or equal to N, indicating.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([[-2.0, -1.0], [1.0, 2.0]])
>>> y, tau = mindspore.ops.geqrf(input)
>>> mindspore.ops.orgqr(y, tau)
Tensor(shape=[2, 2], dtype=Float32, value=
[[-8.94427061e-01,  4.47213590e-01],
 [ 4.47213590e-01,  8.94427180e-01]])