Skip to content

MrGibus/numb_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numb_rs

An experimental crate for numerical things in rust. This is my maths crate. There are many like it, but this one is mine.

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

About

Experimenting with numerical operations in rust.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages