-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add GHZ
circuit function
#1499
Add GHZ
circuit function
#1499
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1499 +/- ##
=======================================
Coverage 99.93% 99.93%
=======================================
Files 81 81
Lines 11907 11914 +7
=======================================
+ Hits 11899 11906 +7
Misses 8 8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@mho291 addition to |
src/qibo/models/encodings.py
Outdated
|
||
|
||
def ghz_state(nqubits: int, **kwargs): | ||
"""Generates an :math:`n`-qubits Greenberger-Horne-Zeilinger (GHZ) state that takes the form |
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.
"""Generates an :math:`n`-qubits Greenberger-Horne-Zeilinger (GHZ) state that takes the form | |
"""Generate a circuit that encodes a :math:`n`-qubit Greenberger-Horne-Zeilinger (GHZ) state. | |
This state that takes the form |
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.
@mho291 a tip: you can click the "Commit suggestion" button here to directly commit a suggestion to the code instead of changing things locally and then pushing it. It also helps to track which changes were already implemented.
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 @renatomello ! I wanted to do extra checks for the documentation, so I did it locally and generated the html file. :)
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.
@mho291 After you address my latest docstring comments, this is ready to go on my end.
Thanks a lot @renatomello , I have modified the docstring accordingly. |
@MatteoRobbiati could you please have another look? |
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! LGTM.
A few (minor) suggestions follow.
"""Generates an :math:`n`-qubit Greenberger-Horne-Zeilinger (GHZ) state that takes the form | ||
|
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.
"""Generates an :math:`n`-qubit Greenberger-Horne-Zeilinger (GHZ) state that takes the form | |
"""Generate an :math:`n`-qubit Greenberger-Horne-Zeilinger (GHZ) state that takes the form | |
Co-authored-by: Matteo Robbiati <[email protected]>
@mho291 Thank you for the addition of the GHZ circuit in models.encodings. I am going to use the added feature but found the following error: when I am importing it in my file head as from qibo.models.encodings import ( and it will cause no problem of importing if I am using from qibo.models.encodings import ( How should I solve this problem? Thanks. |
Are you using the newest version of qibo?
…On Tue, 29 Oct 2024 at 14:33, HuberyMing ***@***.***> wrote:
@mho291 <https://github.com/mho291> Thank you for the addition of the GHZ
circuit in models.encodings. I am going to use the added feature but found
the following error:
ImportError: cannot import name 'ghz_state' from 'qibo.models.encodings'
(/opt/anaconda3/envs/qiskit10/lib/python3.11/site-packages/qibo/models/encodings.py)
when I am importing it in my file head as
from qibo.models.encodings import (
comp_basis_encoder,
entangling_layer,
ghz_state,
phase_encoder,
unary_encoder,
unary_encoder_random_gaussian,
)
and it will cause no problem of importing if I am using
from qibo.models.encodings import (
comp_basis_encoder,
entangling_layer,
#ghz_state,
phase_encoder,
unary_encoder,
unary_encoder_random_gaussian,
)
How should I solve this problem? Thanks.
—
Reply to this email directly, view it on GitHub
<#1499 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABH5QVUY4FHT5GWOHK22Q4TZ55P77AVCNFSM6AAAAABQMLS32SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBTHA2DAMBZGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Actually, even if I am in the newest master branch, it still does not work. $ git pull origin master
$ python test_noise.py |
I have the |
Okay. Currently I am using qibo 0.2.12. I will create a new environment and see if it works later. Thanks. Python 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] on darwin
|
It works when I created a whole new environment. Probably that is because of the qibo version as you said. The qibo 0.2.13 works for it now. |
Release 0.2.12 was released prior to the GHZ PR. So now the ghz function is in release 0.2.13 as well as the master branch. |
I see. Thank you for the explanation. |
Checklist: