Skip to main content

solve

Function solve 

Source
pub fn solve(a: &Matrix, b: &[f64]) -> Result<Vec<f64>>
Expand description

Solves A x = b for a single right hand side (via lapack_dgesv).

use igraph::{linalg::solve, prelude::*};
let a = Matrix::from_rows(&[[4.0, -2.0], [1.0, 1.0]]).unwrap();
let x = solve(&a, &[2.0, 3.0]).unwrap();
assert!((x[0] - 4.0 / 3.0).abs() < 1e-12 && (x[1] - 5.0 / 3.0).abs() < 1e-12);