Код: Выделить всё
import numpy as np
def myfun(x,y):
return np.sin(x**2 + y**2) / (x**2 + y**2)
# create 2 arrays, each 1D but not on the same dimension
x = np.array([1,2,3,4,5]).reshape(1,-1)
y = np.array([6,7,8]).reshape(-1,1)
# make some computation
z = myfun(x,y)
# same with full 2D arrays
xx, yy = np.meshgrid(x,y,indexing='xy')
zz = myfun(xx,yy)
if (zz == z).all():
print("They are the same array!")
edit:
В моем реальном случае «полный» массив будет выглядеть примерно так (14000,60,500,2,2).>
Подробнее здесь: https://stackoverflow.com/questions/798 ... o-1-nx-and
Мобильная версия