diff --git a/src/base/construction.rs b/src/base/construction.rs index 52e99cd7..9c10fbe5 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -257,6 +257,13 @@ where DefaultAllocator: Allocator { Self::from_fn_generic(nrows, ncols, |_, _| distribution.sample(rng)) } + + /// Creates a matrix backed by a given vector. + #[inline] + #[cfg(feature = "std")] + pub fn from_vec(nrows: R, ncols: C, data: Vec) -> Self { + Self::from_iterator_generic(nrows, ncols, data) + } } impl MatrixN