### 3 releases

0.1.2 | May 7, 2021 |
---|---|

0.1.1 | May 7, 2021 |

0.1.0 | May 7, 2021 |

#**2196** in Rust patterns

**MIT**license

32KB

820 lines

# Rusty Matrix

A generic matrix implementation for Rust.

Matrix implementations use the trait

and the default implementations are:`Matrix <T>`

- A stack-based matrix implementation where`StackMatrix``<`T, X, Y`>`

is the type,`T`

is the amount of columns and`X`

is the amount of rows. The advantage of this implementation is the ability to check mathematical operations at compile time against other`Y`

's.`StackMatrix`

- A heap-based matrix implementation where`HeapMatrix``<`T`>`

is the type of the matrix. Due to the limitations of the heap-based solution, it is not possible to check mathematical operations at compile time. However,`T`

s are able to be grown and shrank (TODO) during runtime.`HeapMatrix`

Regardless of which implementation you use, both implementations can use the mathematical operators on each other. For example:

`let` stack_mat `=` `StackMatrix``::`new`(``[``1``,` `2``]``,` `[``3``,` `4``]``,` `[``5``,` `6``]``)``;`
`let` heap_mat `=` `HeapMatrix``::`new_owned_2d`(``[``1``,` `2``,` `3``]``,` `[``4``,` `5``,` `6``]``)``;`
stack_mat `*` heap_mat `//` Is equal to:
`//` Ok(HeapMatrix::new_owned_2d([
`//` [9, 12, 15],
`//` [19, 26, 33],
`//` [29, 40, 51]
`//` ]))

This crate requires a nightly version of Rust >= 1.53.

The GitHub repository is a mirror of my self-hosted Gitea instance.