Crates.io | libmat |
lib.rs | libmat |
version | 0.2.0 |
source | src |
created_at | 2021-06-19 23:58:20.302631 |
updated_at | 2021-06-29 14:25:39.455922 |
description | This library provides tools for linear algebra. |
homepage | |
repository | https://github.com/wiebecommajonas/libmat |
max_upload_size | |
id | 412244 |
size | 53,116 |
This library provides tools for linear algebra. For a full documentation, please visit docs.rs.
To use this library, add this to your Cargo.toml
:
[dependencies]
libmat = "0.2.0"
And this to your crate root:
extern crate libmat;
This is a short example, for more examples check the documentation.
use libmat::mat::{Matrix, Vector};
use libmat::{matrix, vector}; // macros
let vec_a = vector![1,0,0];
let vec_b = vector![0,1,0];
let vec_c = vector![0,0,1];
// Are the vectors perpendicular to each other?
assert_eq!(&vec_a * &vec_b, 0);
assert_eq!(&vec_a * &vec_c, 0);
assert_eq!(&vec_c * &vec_b, 0);
let mat_a = Matrix::<u32>::one(3);
let mat_b = matrix!{
1, 2, 3;
3, 2, 1;
2, 1, 3;
};
// Are the matrices invertible?
assert_ne!(mat_a.det(), 0);
assert_ne!(mat_b.det(), 0);
A full changelog is available in CHANGELOG.md
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.