extendr_api::prelude::modules::lu::partial_pivoting::compute

Function lu_in_place

pub fn lu_in_place<'out, I, E>(
    matrix: MatMut<'_, E>,
    perm: &'out mut [I],
    perm_inv: &'out mut [I],
    parallelism: Parallelism<'_>,
    stack: PodStack<'_>,
    params: PartialPivLuComputeParams,
) -> (PartialPivLuInfo, PermRef<'out, I>)
where I: Index, E: ComplexField,
Expand description

Computes the LU decomposition of the given matrix with partial pivoting, replacing the matrix with its factors in place.

The decomposition is such that: $$PA = LU,$$ where $P$ is a permutation matrix, $L$ is a unit lower triangular matrix, and $U$ is an upper triangular matrix.

$L$ is stored in the strictly lower triangular half of matrix, with an implicit unit diagonal, $U$ is stored in the upper triangular half of matrix, and the permutation representing $P$, as well as its inverse, are stored in perm and perm_inv respectively.

After the function returns, perm contains the order of the rows after pivoting, i.e. the result is the same as computing the non-pivoted LU decomposition of the matrix matrix[perm, :]. 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 length of the permutation slices is not equal to the number of rows of the matrix.
  • Panics if the provided memory in stack is insufficient (see lu_in_place_req).