How to write the following loop using an implicit Python loop?
def kl(myA, myB, a, b): lots of stuff that assumes all inputs are scalars x, y = meshgrid(inclusive_arange(0.0, xsize, 0.10),\ inclusive_arange(0.0, ysize, 0.10)) for j in range(x.shape[0]): for i in range(x.shape[1]): z[j, i] = kl(x[j, i], y[j, i])
I want to do something like
z = kl(x, y)
but it gives:
TypeError: only length-1 arrays can be converted to Python scalars
python numpy
Neil g
source share