6 releases
0.2.0 | Oct 27, 2020 |
---|---|
0.1.4 | Oct 15, 2020 |
#878 in Math
26KB
456 lines
mtrs
A library for handling mathematical matrices in Rust
Quick example
#[macro_use]
extern crate mtrs;
use mtrs::Matrix;
fn main() {
let mat1 = Matrix::identity(2);
let mat2 = matrix![(2, 2); 1, 2; 3, 4];
assert_eq!(mat1 * mat2, mat2);
println!("{}", mat2);
}
lib.rs
:
A library for creating, using, and printing matrices.
Matrices can be defined using the public struct, mtrs::Matrix
, or the macro matrix!
.
Currently the Matrix
struct does not internally support floats. This may change in the future.
#[macro_use] extern crate mtrs;
use mtrs::Matrix;
fn main() {
let matrix = matrix![f32; (2, 2); 1, 2; 3, 4.1];
println!("{}", matrix.scalar_add(4.1));
}
The Matrix
struct supports addition, subtraction, and multiplication with eachother,
along with implementations for basic operations between a scalar value and a Matrix
Dependencies
~155KB