Closed minhduc66532 closed 3 years ago
We do not support broadcasting an already broadcasted NDArray.
My guess is the meshgrid uses broadcasting. If you'll clone the NDArray (NDArray.Clone()
) that'll produce a linear/contagious stored NDArray which then can be broadcasted again.
My solution currently is to use np.full like this
var shape = Z.shape;
var (u, v) = np.meshgrid(np.arange(shape[1]), np.arange(shape[0]));
var CU = np.full(Cu, shape[0], shape[1]);
var CV = np.full(Cv, shape[0], shape[1]);
var x = (u - CU) * Z / f;
var y = (v - CV) * Z / f;
return np.vstack(x.ravel(), y.ravel(), Z.ravel());
Here is the code
Any ideas ?