logo

Function ndarray::aview1

source · []
pub fn aview1<A>(xs: &[A]) -> ArrayView1<'_, A>
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);