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

Increased the speed of _transition_matrix_dense twofold #26

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

RaphaelRobidas
Copy link

A small tweak the _transition_matrix_dense seems to increase its speed twofold.

Original code (nspins=8):
_transition_matrix_dense took 33.4841s for 10000 runs

New code:
_transition_matrix_dense took 16.7938s for 10000 runs

The equivalence has been verified for good measure as such:

for i in range(100):
    for j in range(100):
        m = i ^ j
        flag1 = bin(i ^ j).count("1") == 1

        flag2 = False
        if m > 0 and m & (m-1) == 0:
            flag2 = True

        assert flag1 == flag2

dependabot bot and others added 3 commits April 10, 2023 10:01
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.0 to 1.8.5.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](pypa/gh-action-pypi-publish@v1.5.0...v1.8.5)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…pa/gh-action-pypi-publish-1.8.5

Bump pypa/gh-action-pypi-publish from 1.5.0 to 1.8.5
@sametz
Copy link
Owner

sametz commented Dec 8, 2023

This looks like a neat trick! Can you make your pull request to the develop branch, and not master? See: DEVELOPERS.rst.

edit: also, let me know if you see GitHub Actions running code checks when you make a pull request to develop. If not, I may need to tweak them.

@RaphaelRobidas RaphaelRobidas changed the base branch from master to develop December 8, 2023 17:58
@RaphaelRobidas
Copy link
Author

RaphaelRobidas commented Dec 8, 2023

Sorry, it looks like I missed that info!

It looks like no Github Action was triggered. There isn't a "on pull request" trigger in the actions currently.

@sametz
Copy link
Owner

sametz commented Dec 8, 2023

A test in Jupyter with %%timeit didn't show a real speed boost, but I think your solution is more elegant, so let's do this.

@sametz sametz closed this Dec 8, 2023
@sametz sametz reopened this Dec 8, 2023
@sametz sametz merged commit 681749f into sametz:develop Dec 8, 2023
16 of 18 checks passed
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.

None yet

2 participants