Function extendr_api::prelude::modules::qr::col_pivoting::compute::qr_in_place
pub fn qr_in_place<'out, I, E>(
matrix: MatMut<'_, E>,
householder_factor: MatMut<'_, E>,
col_perm: &'out mut [I],
col_perm_inv: &'out mut [I],
parallelism: Parallelism<'_>,
stack: PodStack<'_>,
params: ColPivQrComputeParams,
) -> (ColPivQrInfo, PermRef<'out, I>)where
I: Index,
E: ComplexField,
Expand description
Computes the QR decomposition with pivoting of a rectangular matrix $A$, into a unitary matrix $Q$, represented as a block Householder sequence, and an upper trapezoidal matrix $R$, such that $$AP^\top = QR.$$
The Householder bases of $Q$ are stored in the strictly lower trapezoidal part of matrix
with
an implicit unit diagonal, and its upper triangular Householder factors are stored in
householder_factor
, blockwise in chunks of blocksize×blocksize
.
The block size is chosen as the number of rows of householder_factor
.
After the function returns, col_perm
contains the order of the columns after pivoting, i.e.
the result is the same as computing the non-pivoted QR decomposition of the matrix matrix[:, col_perm]
. col_perm_inv
contains its inverse permutation.
§Output
- The number of transpositions that constitute the permutation.
- a structure representing the permutation $P$.
§Panics
- Panics if the number of columns of the householder factor is not equal to the minimum of the number of rows and the number of columns of the input matrix.
- Panics if the block size is zero.
- Panics if the length of
col_perm
andcol_perm_inv
is not equal to the number of columns ofmatrix
. - Panics if the provided memory in
stack
is insufficient (seeqr_in_place_req
).