meshgrid

Contents

meshgrid#

Creates a matrix with values from two vectors

template<typename ...Ts>
__MATX_INLINE__ auto matx::meshgrid(Ts&&... ts)#

Creates mesh grid operators

Template Parameters:

Ts... – list of N Rank1 operators types defining mesh points

Parameters:

ts – list of N Rank1 operators

Returns:

N RankN operators of mesh grid. Grids are returned in cartisian indexing (transpose of matrix indexing)

Examples#

auto xv = make_tensor<dtype>({yd, xd});
auto yv = make_tensor<dtype>({yd, xd});

auto x = linspace<0>({xd}, 1, xd);
auto y = linspace<0>({yd}, 1, yd);

// Create a mesh grid with "x" as x extents and "y" as y extents and assign it to "xv"/"yv"
auto [xx, yy] = meshgrid(x, y);

(xv = xx).run(exec);
(yv = yy).run(exec);