pub fn rows_to_u_matrix<T: Scalar>(
r: &mut Matrix<T>,
p: &Matrix<T>,
_left_orthogonal: bool,
)Expand description
Convert R matrix to solve X * U = B given pivot matrix P
Modifies r in place so that the rows satisfy the triangular
system defined by p. The matrix r must have at least nrows(p)
rows.
ยงExamples
use tensor4all_tcicore::{from_vec2d, matrixlu::rows_to_u_matrix};
// Lower-triangular P (2x2)
let p = from_vec2d(vec![
vec![2.0_f64, 0.0],
vec![1.0, 3.0],
]);
// r has 2 rows (nrows >= nrows(p)), 3 columns
let mut r = from_vec2d(vec![
vec![4.0_f64, 6.0, 8.0],
vec![5.0, 9.0, 7.0],
]);
rows_to_u_matrix(&mut r, &p, true);
// After processing: r[0,:] was divided by p[0,0]=2
assert!((r[[0, 0]] - 2.0).abs() < 1e-10);
assert!((r[[0, 1]] - 3.0).abs() < 1e-10);
assert!((r[[0, 2]] - 4.0).abs() < 1e-10);