fn solve_matrix(a: &[f64], b: &[f64], n: usize, m: usize) -> Vec<f64>
Solve A X = B where A is n×n and B is n×m. Returns X (n×m, row-major).