from-python-to-numpy
from-python-to-numpy copied to clipboard
neighbours array in game of life example (Uniform Vectorization)
In the compute_neighbours()
function, I think you meant to do
N = [[0,]*(shape[1]) for i in range(shape[0])]
instead of
N = [[0,]*(shape[0]) for i in range(shape[1])]
Thansk. Did you try with non-equal size arrays to check if it is actually wrong? (I don't remember the exact layout I used)
Yes I did.
You defined the shape of Z as
shape = len(Z), len(Z[0])
so you want N
to be
[[0] * ncols for _ in range(nrows)]
where (nrows, ncols) = shape
I see, thanks. Can you make a PR?