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

Make conway updating considerably faster #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Make conway updating considerably faster #6

wants to merge 3 commits into from

Conversation

AlexGreason
Copy link

@AlexGreason AlexGreason commented Feb 2, 2018

It is redundant to independently check if b is 3 and state is 1, and if so set c to 1, and check if b is 3 and state is 0, and if so set c to 1.
Fold these into one check.
Additionally, to reduce number of array lookups, fold the remaining two operations into one. using a bitwise or
Thirdly, in newer numpy versions numpy.where() is not necessary in this case, and is slower than using the array[array condition] syntax

EDIT: correction to the "revert convolution change" commit message, it turns out that if you just shift the filter to the up-left by one the scipy.signal convolution method works. Still not no-changes compatible with the other code so not including.

It is redundant to independently check if b is 3 and state is 1, and if so set c to 1, and check if b is 3 and state is 0, and if so set c to 1.
Fold these into one check.
Additionally, to reduce number of array lookups, fold the remaining two operations into one.
Thirdly, in newer numpy versions numpy.where() is redundant, and slower than using the array[array condition] syntax
scipy has a method for convolution now
The other one is faster, but it requires using a merely (3,3) kernel rather than one the size of the full state, so it isn't no-changes compatible, and it requires scipy so the travis build fails
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

Successfully merging this pull request may close these issues.

1 participant