pub fn lu_decomposition<T, S>(
_matrix: &S,
pivotthreshold: f64,
) -> SparseResult<LUResult<T>>
Expand description
Compute sparse LU decomposition with partial pivoting (backward compatibility)
Computes the LU decomposition of a sparse matrix A such that PA = LU, where P is a permutation matrix, L is lower triangular, and U is upper triangular.
§Arguments
matrix
- The sparse matrix to decomposepivot_threshold
- Pivoting threshold for numerical stability (0.0 to 1.0)
§Returns
LU decomposition result
§Examples
use scirs2_sparse::linalg::lu_decomposition;
use scirs2_sparse::csr_array::CsrArray;
// Create a sparse matrix
let rows = vec![0, 0, 1, 2];
let cols = vec![0, 1, 1, 2];
let data = vec![2.0, 1.0, 3.0, 4.0];
let matrix = CsrArray::from_triplets(&rows, &cols, &data, (3, 3), false).unwrap();
let lu_result = lu_decomposition(&matrix, 0.1).unwrap();