Crates.io | definitive |
lib.rs | definitive |
version | 0.1.0 |
source | src |
created_at | 2019-10-25 00:27:17.501806 |
updated_at | 2019-11-12 19:00:57.766509 |
description | The definitive and final vector & matrix library for Rust |
homepage | https://owo.codes/noxim/definitive |
repository | https://owo.codes/noxim/definitive |
max_upload_size | |
id | 175471 |
size | 24,283 |
Definitive
The definitive vector and matrix library for Rust
use definitive::Vector;
let a = Vector::new([2, 3, 1]);
let b = Vector::new([8, 0, 0]);
let c = a + b * (b * 2);
Definitive
provides the default feature simd
which enables and disables hand
written SIMD implementations of certain Vector
and Matrix
variants. Hand
optimized variants are documented under their own traits
#![no_std]
This crate supports #![no_std]
environments, and support can be enabled by
disabling the std
feature
The biggest issue currently is supporting arbritrary matrices, as type signature such as the following are not allowed. As far as I can tell, we might get this someday, but const generics are still in their infancy.
struct Matrix<T, const N: usize, const L: [usize; {N}]>([T; { L.iter().product() }]);
Another issue I'm facing is with specialization. I want to allow vec * scalar
operations, but I cannot for the life of me figure out a way to do that without
adding an unnecessary Copy
bound on the vec
's T
. This is in most cases non
issue, and does not cause any inefficiencies as the members of the vec
are not
actually copied anywhere. In future this bound might get removed, as I learn how
to actually use the type system D:
Vector
Clone
Copy
Debug
Display
Eq
PartialEq
Add
AddAssign
Sub
SubAssign
Mul
MulAssign
Div
DivAssign
Rem
RemAssign
Neg
BitAnd
BitAndAssign
BitOr
BitOrAssign
BitXor
BitXorAssign
Shl
ShlAssign
Shr
ShrAssign
Not
Hash
Matrix
(blocked on https://github.com/rust-lang/rust/issues/44580)