[−][src]Function fitting::linalg::solve
pub fn solve(a: Array2<f64>, b: Array1<f64>) -> Option<Array1<f64>>
Solves a system of linear equations.
This function implements the Gaussian elimination.
Examples
Solves a * x = b
.
use approx::assert_abs_diff_eq; use fitting::linalg::solve; use ndarray::array; let a = array![[3., 2., -1.], [2., -2., 4.], [-2., 1., -2.]]; let b = array![1., -2., 0.]; let x = solve(a, b).unwrap(); assert_abs_diff_eq!(x, array![1., -2., -2.], epsilon = 1e-9);