qmat
qmat is a simple library for 2-dimensional matrices.
Usage
New matrix
There are three main ways to create a new matrix.
use *;
// Creates the matrix 2x3
// [0, 1, 2]
// [3, 4, 5]
// The generics are the data type, the number of rows, the
// number of cols then the lenth of the data (rows * cols)
let mat: = new.unwrap;
// Or,
let mat = new.unwrap;
use *;
// Creates the same matrix using the analagous macro pattern.
// Automatically unwraps the errors.
let mat = matrix!;
use *;
let mat = matrix!;
Matrices can also be created using Matrix::empty and Matrix::diag.
Retrieving a value
Using a [usize; 2]
use *;
let mat = matrix!;
println!; // 4
Using the position struct
use *;
let mat = matrix!;
let pos = Position;
println!; // 2
Matrix operations
Iterators
Todo
- Implement mutable row and col iterators
- Implement inverting for matrices that aren't of the shape (2, 2)
- Allow indexing for anything that can be converted into [usize; 2]
- Optimise
- Add examples for matrix operations and iterators to README.md