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

Update back_box_numeric.py #163

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyEPR/calcs/back_box_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def PT_on_vector(original_vector, original_basis, pertub, energy0, evalue):

def closest_state_to(s):
def distance(s2):
return (s.dag() * s2[1]).norm()
return np.abs((s.dag() * s2[1]))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Have you checked if this works with the new version?

And ideally if it is backwards compatible

There is also this possibility I think if not mistaken

return np.abs(np.vdot(s, s2[1]))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested it with a fresh install with python3.10 and latest numpy. Ran into no problems. Numpy was a red herring: it turns out that that was not the problem after all. I don't know exactly was, but the pull request fixes it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Garry! Going to merge


return max(zip(evals, evecs), key=distance)

Expand Down
Loading