diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs index bebb8740..450127ba 100644 --- a/src/base/array_storage.rs +++ b/src/base/array_storage.rs @@ -48,6 +48,19 @@ where /// Renamed to [ArrayStorage]. pub type MatrixArray = ArrayStorage; +impl Default for ArrayStorage +where + R: DimName, + C: DimName, + R::Value: Mul, + Prod: ArrayLength, + N: Default, +{ + fn default() -> Self { + ArrayStorage { data: Default::default() } + } +} + impl Hash for ArrayStorage where N: Hash, diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 7119a8ad..1aa171e4 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -90,6 +90,21 @@ impl fmt::Debug for Matrix } } +impl Default for Matrix +where + N: Scalar, + R: Dim, + C: Dim, + S: Default, +{ + fn default() -> Self { + Matrix { + data: Default::default(), + _phantoms: PhantomData, + } + } +} + #[cfg(feature = "serde-serialize")] impl Serialize for Matrix where