Computes the first n
columns of a product of Householder matrices.
Source: R/linalg.R
linalg_householder_product.Rd
Letting K be R or C, for a matrix V K^m n with columns v_i K^m with m n and a vector K^k with k n, this function computes the first n columns of the matrix
Details
where I_m is the m
-dimensional identity matrix and
v^H is the conjugate transpose when v is complex, and the transpose when v 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 theQ
from thelinalg_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()
,
linalg_cholesky_ex()
,
linalg_det()
,
linalg_eig()
,
linalg_eigh()
,
linalg_eigvals()
,
linalg_eigvalsh()
,
linalg_inv()
,
linalg_inv_ex()
,
linalg_lstsq()
,
linalg_matrix_norm()
,
linalg_matrix_power()
,
linalg_matrix_rank()
,
linalg_multi_dot()
,
linalg_norm()
,
linalg_pinv()
,
linalg_qr()
,
linalg_slogdet()
,
linalg_solve()
,
linalg_solve_triangular()
,
linalg_svd()
,
linalg_svdvals()
,
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