5 releases
0.0.4 | Aug 25, 2021 |
---|---|
0.0.3 | Feb 10, 2021 |
0.0.2 | Jan 25, 2021 |
0.0.1 | Jan 24, 2021 |
0.0.0 | Jan 24, 2021 |
#2111 in Algorithms
81KB
2K
SLoC
numb_rs
An experimental crate for numerical things in rust.
Linear Algebra Example
use numb_rs::{mat, solver::solve_dense, Dense, IntoCol};
// Use commas to dictate a new item in a row
// Use Semi-colons to indicate a new row
let a = mat![
21., 10., -3.;
14., 6., 0.;
17., 12., -6.
];
let b = mat![
122.;
91.;
110.
];
println!("\nSolving ax=b\na:\n{}\nb:\n{}", a, b);
let solution = solve_dense(a, b).unwrap();
println!("x:\n{}", solution.into_col());
Output
Solving ax=b
a:
21.00 10.00 -3.00
14.00 6.00 0.00
17.00 12.00 -6.00
b:
122.00
91.00
110.00
x:
2.00
10.50
8.33
Verification (matlab)
a = [21, 10, -3; 14, 6, 0; 17, 12, -6];
b = [122; 91; 110];
a \ b
ans =
2.0000
10.5000
8.3333