pub fn cols_to_l_matrix<T: Scalar>(
c: &mut Matrix<T>,
p: &Matrix<T>,
_left_orthogonal: bool,
) -> Result<()>Expand description
Convert L matrix to solve L * X = B given pivot matrix P
Modifies c in place so that the columns satisfy the triangular
system defined by p. The matrix c must have at least p.nrows()
columns.
§Errors
Returns MatrixCIError::InvalidArgument when p is not square or
c has too few columns, and MatrixCIError::SingularMatrix for a zero
diagonal pivot.
§Examples
use tensor4all_core::matrixlu::cols_to_l_matrix;
use tensor4all_tensorbackend::from_vec2d;
// Upper-triangular P (2x2)
let p = from_vec2d(vec![
vec![2.0_f64, 1.0],
vec![0.0, 3.0],
]);
// c has 3 rows, 2 columns (ncols >= p.nrows())
let mut c = from_vec2d(vec![
vec![4.0_f64, 5.0],
vec![6.0, 9.0],
vec![8.0, 7.0],
]);
cols_to_l_matrix(&mut c, &p, true).unwrap();
// After processing: c[:,0] was divided by p[0,0]=2
assert!((c[[0, 0]] - 2.0).abs() < 1e-10);
assert!((c[[1, 0]] - 3.0).abs() < 1e-10);
assert!((c[[2, 0]] - 4.0).abs() < 1e-10);