Skip to contents

Letting be or , for a matrix with columns with and a vector with , this function computes the first columns of the matrix

Usage

linalg_householder_product(A, tau)

Arguments

A

(Tensor): tensor of shape (*, m, n) where * is zero or more batch dimensions.

tau

(Tensor): tensor of shape (*, k) where * is zero or more batch dimensions.

Details

H1H2...HkwithHi=ImτiviviH H_1H_2 ... H_k \qquad with \qquad H_i = \mathrm{I}_m - \tau_i v_i v_i^{H}

where is the m-dimensional identity matrix and is the conjugate transpose when is complex, and the transpose when is real-valued. See Representation of Orthogonal or Unitary Matrices for further details.

Supports inputs of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if the inputs are batches of matrices then the output has the same batch dimensions.

Note

This function only uses the values strictly below the main diagonal of A. The other values are ignored.

See also

  • torch_geqrf() can be used together with this function to form the Q from the linalg_qr() decomposition.

  • torch_ormqr() is a related function that computes the matrix multiplication of a product of Householder matrices with another matrix. However, that function is not supported by autograd.

Other linalg: linalg_cholesky_ex(), linalg_cholesky(), linalg_det(), linalg_eigh(), linalg_eigvalsh(), linalg_eigvals(), linalg_eig(), linalg_inv_ex(), linalg_inv(), linalg_lstsq(), linalg_matrix_norm(), linalg_matrix_power(), linalg_matrix_rank(), linalg_multi_dot(), linalg_norm(), linalg_pinv(), linalg_qr(), linalg_slogdet(), linalg_solve_triangular(), linalg_solve(), linalg_svdvals(), linalg_svd(), linalg_tensorinv(), linalg_tensorsolve(), linalg_vector_norm()

Examples

if (torch_is_installed()) {
A <- torch_randn(2, 2)
h_tau <- torch_geqrf(A)
Q <- linalg_householder_product(h_tau[[1]], h_tau[[2]])
torch_allclose(Q, linalg_qr(A)[[1]])
}
#> [1] TRUE