Crate cayley

source ·
Expand description

cayley is a crate for generic linear algebra. It aims to do everything stack-allocated and constantly sized (though there are workarounds possible if dynamically sized types are needed). cayley is named after Arthur Cayley, a prominent mathematician who introduced matrix multiplication.

In addition to this, it aims to assume as little as possible about the type over which its structures are generic. For example, you can construct an identity matrix of any type that implements One, Zero and Copy, and you can multiply matrices of different types A and B, so long as there exists a type C so that A * B = C and C + C = C. In practice, of course, all numerical types meet these conditions.

Due to the nature of generic matrices, it’s necessary to use the #[feature(generic_const_exprs)] feature; there is no other way to provide compile-time multiplicability or invertibility checks.



  • The following is some weird shit. This enum is generic over a boolean condition. It then only implements the IsTrue trait for DimensionAssertion<true>, so that an assertion can be made within a function signature or an impl block.


  • IsTrue is only ever implemented on DimensionAssertion<true>. See its documentation for info on why this exists.