-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix operator @ quantumstate multiplication #14963
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
base: main
Are you sure you want to change the base?
Conversation
change user name and link e-mail
f9bae63
to
be730a3
Compare
…ryav-3/qiskit into fix-operator-quantumstate-mul Merge branch 'fix-operator-quantumstate-mul' of https://github.com/aaryav-3/qiskit into fix-operator-quantumstate-mul#
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 following people are relevant to this code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for having a look, I left some comments below.
ret._op_shape = self._op_shape.transpose() | ||
return ret | ||
|
||
def compose(self, other: Operator, qargs: list | None = None, front: bool = False) -> Operator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument front
is not handled right now. I would suggest we just raise an error if this is True
and the input is a Statevector
.
If
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comments. I’ve handled this with an exception, and since thedot()
method sets front=True
, I updated group.py to handle the statevector dot product as a special case. I’d love to hear your opinion on this approach.
Apologies for the delayed reply — I had drafted this earlier but only just realized I hadn’t sent it.
Pull Request Test Coverage Report for Build 17762403317Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Summary
This PR fixes GitHub issue #14726 by ensuring that matrix multiplication using the
@
operator on quantum states does not cause problems with output dimensions or data types.Checklist
Details and Comments
This change introduces a method implementing the
__rmatmul__
magic function within QuantumState, allowing these operations to be handled separately and preventing unexpected type or dimension issues.