logo
pub fn aview1<A>(xs: &[A]) -> ArrayBase<ViewRepr<&A>, Dim<[usize; 1]>>
Expand description

Create a one-dimensional array view with elements borrowing xs.

use ndarray::aview1;

let data = [1.0; 1024];

// Create a 2D array view from borrowed data
let a2d = aview1(&data).into_shape((32, 32)).unwrap();

assert_eq!(a2d.sum(), 1024.0);