Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neighbours array in game of life example (Uniform Vectorization) #98

Open
aaarbk opened this issue Dec 31, 2020 · 3 comments
Open

neighbours array in game of life example (Uniform Vectorization) #98

aaarbk opened this issue Dec 31, 2020 · 3 comments

Comments

@aaarbk
Copy link

aaarbk commented Dec 31, 2020

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])]

@rougier
Copy link
Owner

rougier commented Jan 4, 2021

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)

@aaarbk
Copy link
Author

aaarbk commented Jan 4, 2021

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

@rougier
Copy link
Owner

rougier commented Jan 5, 2021

I see, thanks. Can you make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants