generated from qiskit-community/quantum-prototype-template
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Updates for Qiskit to Braket circuit conversion #97
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ee6e3a0
Probability to Sample result type
urihan 45f6eba
passes tox lint
urihan 18a8f24
updates toxlint
urihan 04df9dc
fixes observable z error but not passses elint
urihan fe16bbf
Merge branch 'main' into branch1
urihan 7213c7d
unit test added
urihan cff2d84
final commit with tests
urihan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Class
Observable
represents a quantum observable, but which one? SinceProbability
returns probabilities on computation basis, you have to put the computational basis observableThere 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.
Hi @dakk, Thank you for your comment. In my first commit, I used
observable=Observable.Z()
for the Probability; however, it was not passing thetox -elint
test. I was changing codes to pass thetox -elint
, which is why I got rid of theZ()
part causing an error intox -epy39
.So, I think you are right that I have to put a computational basis but not sure how to pass the
tox -elint
test..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.
What was the error of the linter?
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.
@dakk
qiskit_braket_provider/providers/adapter.py:351:31: E1101: Class 'Observable' has no 'Z' member (no-member)
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.
I wonder if we have to use
StandardObservable
class instead of justObservable
classThere 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.
Right, seems like I have the same version. For that specific error, I added the comment
# pylint:disable=fixme
next to the code, and I think it might fix it.But, now I am getting after running
tox -elint
I tried to follow this instruction on mypy-install-types-mre, but only produces the same error. I might have to spend more time with it.
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.
Maybe there is a problem with the linter that can't detect dynamically added members; observables are dynamically added to Observable class (from braket side).
There is a workaround:
If the problem is the linter, this should work.
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 a lot for your help here @dakk!
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.
I wrote a comment here before, but I might have accidentally erased it. Thank you for your help @dakk. I found out I was still getting the same error even after updating with observables.Z(). I was able to get it to work after re-cloning my repository. I decided to just stick with the solution you provided though! I appreciate your help! :)
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.
Oh, that's weird! It was a pleasure!