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

Fix #1691 #1692

Merged
Merged

Conversation

AGaliciaMartinez
Copy link
Member

Description
Changes pow to allow the exponentiation of arbitrary square matrices regardless of their type as qobj.

I tried to change it so that bra*ket returns a scalar but this breaks backwards compatibility and there are modules such as control that do thinks like

(bra*ket).tr()

or

(bra*ket).data[0,0]

that would stop working.

Related issues or PRs
fix #1691

Changelog
It is now possible to compute the power of an scalar-like qobj.

@hodgestar hodgestar added this to the QuTiP 4.6.3 milestone Oct 20, 2021
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.

This looks like a good minimal change to me.

I've flagged it for inclusion in QuTiP 4.6.3.

We've had some odd test failures recently that haven't been tracked down yet. I would like to only merge this once all tests pass, but let's see how the test runs go.

@hodgestar
Copy link
Contributor

hodgestar commented Oct 20, 2021

@AGaliciaMartinez Would you mind updating this branch to the latest master branch? (I am trying to understand the broken test)

@AGaliciaMartinez
Copy link
Member Author

@hodgestar Should be now updated.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 67.127% when pulling 59e4ddd on AGaliciaMartinez:fix#1691_allow_pow_with_scalars into 981328c on qutip:master.

@hodgestar
Copy link
Contributor

Since tests pass with the updated branch, I'm going to merge this.

@hodgestar hodgestar merged commit 091574d into qutip:master Oct 20, 2021
@AGaliciaMartinez AGaliciaMartinez deleted the fix#1691_allow_pow_with_scalars branch October 20, 2021 15:50
hodgestar added a commit to hodgestar/qutip that referenced this pull request Feb 4, 2022
…w_with_scalars

Add support for computing powers of scalar (1x1) Qobjs. Fixes qutip#1691.
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.

Raising scalar-like Qobj instances to a power results in exception
3 participants