Comment écrire la boucle suivante en utilisant la boucle implicite de Python?Diffusion d'un tableau avec numpy
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])
Je veux faire quelque chose comme
z = kl(x, y)
mais qui donne:
TypeError: only length-1 arrays can be converted to Python scalars
"boucle implicite"? pouvez-vous définir cela? – nosklo
Je suppose que je voulais dire "diffusion de tableau" :) –