pub fn meshgrid<T>(
x: ArrayView<'_, T, Ix1>,
y: ArrayView<'_, T, Ix1>,
) -> GradientResult<T>
Expand description
Create a meshgrid from 1D coordinate arrays
§Arguments
x
- 1D array of x coordinatesy
- 1D array of y coordinates
§Returns
A tuple of two 2D arrays (X, Y) where X and Y are copies of the input arrays repeated to form a meshgrid
§Examples
use ndarray::array;
use scirs2_core::ndarray_ext::manipulation::meshgrid;
let x = array![1, 2, 3];
let y = array![4, 5];
let (x_grid, y_grid) = meshgrid(x.view(), y.view()).unwrap();
assert_eq!(x_grid.shape(), &[2, 3]);
assert_eq!(y_grid.shape(), &[2, 3]);
assert_eq!(x_grid, array![[1, 2, 3], [1, 2, 3]]);
assert_eq!(y_grid, array![[4, 4, 4], [5, 5, 5]]);