Function lu_decomposition
pub fn lu_decomposition<B>(
tensor: Tensor<B, 2>,
) -> (Tensor<B, 2>, Tensor<B, 1, Int>)where
B: Backend,Expand description
Performs PLU decomposition of a square matrix.
The function decomposes a given square matrix A into three matrices: a permutation vector p,
a lower triangular matrix L, and an upper triangular matrix U, such that PA = LU.
The permutation vector p represents the row swaps made during the decomposition process.
The lower triangular matrix L has ones on its diagonal and contains the multipliers used
during the elimination process below the diagonal. The upper triangular matrix U contains
the resulting upper triangular form of the matrix after the elimination process.
§Arguments
tensor- A square matrix to decompose, represented as a 2D tensor.
§Returns
A tuple containing:
- A 2D tensor representing the combined
LandUmatrices. - A 1D tensor representing the permutation vector
p.
§Panics and numerical issues
- The function will panic if the input matrix is singular or near-singular.
- The function will panic if the input matrix is not square.
§Performance note (synchronization / device transfers)
This function may involve multiple synchronizations and device transfers, especially when determining pivot elements and performing row swaps. This can impact performance,