I have a 3D array and I have three 1D array, which represents the x-axis, y-axis, and z-axis values. I would like to multiply the 3D array with the 1D arrays. The correct value can be obtained with
array_x = np.array([1,2,3])
array_y = np.array([1,2,3])
array_z = np.array([1,2,3])
array3D = something
for ix, x in enumerate(array_x):
for iy, y in enumerate(array_y):
for iz, z in enumerate(array_z):
array3D[ix][iy][iz] *= x*y*z
What is the fastest way to do this in python? I would also like to avoid turning the three 1D arrays into 3D arrays since I need to keep the memory usage low.