diff --git a/fftw/src/array.rs b/fftw/src/array.rs index 3c3bfc5c..70c2b625 100644 --- a/fftw/src/array.rs +++ b/fftw/src/array.rs @@ -2,6 +2,7 @@ use crate::types::*; use ffi; +use ndarray::*; use num_traits::Zero; use std::ops::{Deref, DerefMut}; @@ -55,6 +56,14 @@ impl AlignedVec { pub fn as_slice_mut(&mut self) -> &mut [T] { unsafe { from_raw_parts_mut(self.data, self.n) } } + + pub fn as_view(&self, shape: Shape) -> Result, ShapeError> + where + D: Dimension, + Shape: Into>, + { + ArrayView::from_shape(shape, self.as_slice()) + } } impl Deref for AlignedVec {