# Crate mat [−] [src]

Statically sized matrices for `no_std`

applications

This library provides support for creating and performing mathematical operations on *statically
sized* matrices. That is matrices whose dimensions are known at compile time. The main use case
for this library are `no_std`

programs where a memory allocator is not available.

Since the matrices are statically allocated the dimensions of the matrix are stored in the type system and used to prevent invalid operations (e.g. adding a 3x4 matrix to a 4x3 matrix) at compile time.

For performance reasons all operations, except for the indexing `get`

method, are lazy and
perform no actual computation. An expression like `a * b + c;`

simply builds an *expression
tree*. `get`

can be used to force evaluation of such a tree; see below:

#[macro_use] extern crate mat; use mat::traits::Matrix; fn main() { // 2 by 3 matrix let a = mat!(i32, [ [1, 2, 3], [3, 4, 5], ]); // 3 by 2 matrix let b = mat!(i32, [ [1, 2], [3, 4], [5, 6], ]); // build an expression tree let c = &a * &b; // partially evaluate the tree assert_eq!(c.get(0, 0), 22); }

This program does *not* allocate and compute a whole new matrix C of size 2x2; it simply
performs the operations required to get the element at row 0 and column 0 that such matrix C
would have.

# Out of scope

The following features are out of scope for this library.

- Operations that require dynamic memory allocation
- SIMD acceleration
- n-dimensional arrays

If you are looking for such features check out the `ndarray`

crate.

# Development status

This library is unlikely to see much development until support for const generics lands in the compiler.

## Modules

consts |
Type aliases for many constants. |

traits |
Traits |

## Macros

mat |
Macro to construct a |

## Structs

Mat |
Statically allocated (row major order) matrix |

Product |
The product of two matrices |

Row |
Row view into a |

Sum |
The sum of two matrices |

Transpose |
The transpose of a matrix |

## Type Definitions

__Quot |
Alias for the associated type of |