1 unstable release
0.1.0 | Mar 19, 2021 |
---|
#1351 in Math
23 downloads per month
20KB
188 lines
Mtrx
Matrix operations using Rust's new const generics feature. Matrix sizes are determined at compile time, allowing better type checking.
Supported Operations
- Addition
- Subtraction
- Scalar Multiplication
- Matrix Multiplication
- Matrix Vector Product
- Transposition
- Matrix Powers
Note: currently, mtrx requires Nightly to work, as it makes use of the
#![feature(const_fn)]
let matrix_a = Matrix::new(
[[1, 2, 3],
[4, 5, 6]]
);
let matrix_b = Matrix::new(
[[7, 8],
[9, 10],
[11, 12]]
);
let result: Matrix<i32, 2, 2> = matrix_a.multiply(matrix_b);
assert_eq!(result.inner,
[[58, 64],
[139, 154]]
);