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

Momentum and position default isherm values. #2032

Merged
merged 4 commits into from Dec 6, 2022

Conversation

AGaliciaMartinez
Copy link
Member

Description
The momentum and position did not have the _isherm attribute set to True. Setting it by default to True means hamiltonians created with those operators only will also have the attribute set to True and, for example, eigenvalues computed will, by default, return a real value (and I think be computed faster but I am not completely sure if we take this into account in our algorithms).

Copy link
Contributor

@hodgestar hodgestar left a comment

Choose a reason for hiding this comment

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

There is a setter for isherm, so we can skip the assignment to the private _isherm attribute. Otherwise this looks like a great improvement.

qutip/core/operators.py Outdated Show resolved Hide resolved
qutip/core/operators.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Dec 6, 2022

Coverage Status

Coverage increased (+0.008%) to 72.217% when pulling 20dd899 on AGaliciaMartinez:momentum_position into 2ef8847 on qutip:dev.major.

Copy link
Member

@Ericgig Ericgig left a comment

Choose a reason for hiding this comment

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

Good to have the flag properly set.
I approve, but also prefer isherm over _isherm.

AGaliciaMartinez and others added 2 commits December 6, 2022 18:49
Co-authored-by: Simon Cross <hodgestar+github@gmail.com>
Co-authored-by: Simon Cross <hodgestar+github@gmail.com>
@AGaliciaMartinez
Copy link
Member Author

Good point with the setter!

@hodgestar hodgestar merged commit cf47051 into qutip:dev.major Dec 6, 2022
@AGaliciaMartinez AGaliciaMartinez deleted the momentum_position branch December 6, 2022 21:44
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

4 participants