mtrx

Crates.iomtrx
lib.rsmtrx
version0.1.0
sourcesrc
created_at2021-03-19 23:47:08.965612
updated_at2021-03-19 23:47:08.965612
descriptionProvides type-safe matrix operations using const generics
homepagehttps://github.com/MayorMonty/mtrx
repositoryhttps://github.com/MayorMonty/mtrx
max_upload_size
id371201
size19,590
Brendan McGuire (MayorMonty)

documentation

https://docs.rs/mtrx

README

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]]
); 

Commit count: 22

cargo fmt