xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

numpy.fromfunction equivalent

Open james-mxr opened this issue 1 year ago • 1 comments

Example;

import numpy as np
np.fromfunction(lambda i, j: i == j, (2, 3), dtype=int)

Would be nice to have an inbuilt equivalent.

james-mxr avatar Jul 21 '22 10:07 james-mxr

Do I understand that it is a wrapper around meshgrid and https://xtensor.readthedocs.io/en/latest/operator.html#universal-functions-and-vectorization ? If so, the wrapper should be easy to implement. Would you be willing to give it a shot?

tdegeus avatar Jul 26 '22 08:07 tdegeus