diff --git a/Cargo.toml b/Cargo.toml index 7d5a9db9..3fd9ae81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ compare = [ "matrixcompare-core" ] libm = [ "simba/libm" ] libm-force = [ "simba/libm_force" ] - [dependencies] typenum = "1.12" generic-array = "0.14" @@ -55,6 +54,7 @@ mint = { version = "0.5", optional = true } quickcheck = { version = "0.9", optional = true } pest = { version = "2", optional = true } pest_derive = { version = "2", optional = true } +bytemuck = { version = "1.5", optional = true } matrixcompare-core = { version = "0.1", optional = true } [dev-dependencies] diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 8035d2f8..73001536 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -279,6 +279,25 @@ impl> matrixcompare_core::DenseAc } } +#[cfg(feature = "bytemuck")] +unsafe impl + bytemuck::Zeroable for Matrix> +where + R::Value: core::ops::Mul, + >::Output: generic_array::ArrayLength, +{ +} + +#[cfg(feature = "bytemuck")] +unsafe impl + bytemuck::Pod for Matrix> +where + R::Value: core::ops::Mul, + >::Output: generic_array::ArrayLength, + <::Value>>::Output as generic_array::ArrayLength>::ArrayType: Copy +{ +} + impl Matrix { /// Creates a new matrix with the given data without statically checking that the matrix /// dimension matches the storage dimension.