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

Alias BaseOperator.__mul__ to BaseOperator._multiply in quantum_info #8007

Merged
merged 8 commits into from
May 9, 2022

Conversation

daimurat
Copy link
Member

@daimurat daimurat commented May 1, 2022

Summary

Introduced a left side scalar multiplication to Operator class in quantum_info (issue: #8006 )

Details and comments

Add __mul__ method to Operator class to enable scalar multiplication not only from right side but left side.
It can be used by using * decorator,

For example

from qiskit.quantum_info import Pauli
Pauli("X") * -1j

@daimurat daimurat requested review from a team and ikkoham as code owners May 1, 2022 22:18
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@coveralls
Copy link

coveralls commented May 1, 2022

Pull Request Test Coverage Report for Build 2291373536

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0005%) to 84.358%

Totals Coverage Status
Change from base Build 2272306729: 0.0005%
Covered Lines: 54487
Relevant Lines: 64590

💛 - Coveralls

Copy link
Contributor

@ikkoham ikkoham left a comment

Choose a reason for hiding this comment

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

Thank you very much. I think it will be useful. I have a minor comment

@daimurat daimurat requested a review from ikkoham May 2, 2022 02:49
@daimurat daimurat changed the title Introduced a left side scalar multiplication to Operator class in quantum_info (#8006) Alias BaseOperator.__mul__ to BaseOperator._multiply in quantum_info (#8006) May 2, 2022
@jakelishman jakelishman changed the title Alias BaseOperator.__mul__ to BaseOperator._multiply in quantum_info (#8006) Alias BaseOperator.__mul__ to BaseOperator._multiply in quantum_info May 3, 2022
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for this! I left a small amount of historical context in #8006 (comment) as a note to us in the future, but from my side this looks good to merge. Ikko will be able to tag this "automerge" and it'll get merged.

@jakelishman jakelishman added this to the 0.21 milestone May 3, 2022
@jakelishman jakelishman added Changelog: New Feature Include in the "Added" section of the changelog mod: quantum info Related to the Quantum Info module (States & Operators) labels May 3, 2022
Copy link
Contributor

@ikkoham ikkoham left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you.

@mergify mergify bot merged commit ec9d693 into Qiskit:main May 9, 2022
@daimurat daimurat deleted the issue_#8006 branch May 16, 2022 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: quantum info Related to the Quantum Info module (States & Operators)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants