-
Notifications
You must be signed in to change notification settings - Fork 294
State preparation synthesis via MPS decomposition #2972
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
Conversation
- Closes NVIDIA#1616
|
@1tnguyen Made the PR sir. Try it out please. It's going to run fine, but will have a logical error which causes the fidelity to be near 0. This has to do with cudaq, because if you just switch to qiskit for those few lines, it works correctly (0.90 fidelity). |
|
Have you had a chance to view the PR? |
One thing to verify is the MSB-LSB convention in the unitary matrix data. You might want to debug it with just a single 2-q unitary gate to verify. |
|
Copy. Will check that now. |
|
I tried different ways for MSB-LSB. I don't think it's that. |
|
Here's how I tried the note you mentioned: from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector, Operator
qc = QuantumCircuit(2)
qc.u(0.1, 0.2, 0.3, 0)
qc.cx(0, 1)
op = Operator(qc).data
neq = cudaq.make_kernel()
qr = neq.qalloc(2)
cudaq.register_operation("unitary_0", op)
neq.unitary_0(qr[0], qr[1])
print(np.array(cudaq.get_state(neq)))
print(Statevector(qc).data)They're identical, which to me means that it should be practically a drop-in replacement for qiskit version that I have. I'll have a closer look, maybe I have accidentally broken something. |
|
I re-checked my qiskit one, it's correct: |
I think the above example exhibits symmetry, hence it cannot expose the differences just by looking at the output state vector starting with the |00> initial state. A different test with a true random unitary will show the differences: The second and third elements are swapped, consistent with the difference in the bit-ordering convention. |
|
@1tnguyen Fixed it. Thank you. Should now yield 1.0. |
|
@1tnguyen Should be finished now. |
Command Bot: Processing... |
Could you please follow the instructions here to add a DCO remediation commit? We require that all commits are signed off (with Also, you'll need to install prerequisites (e.g., Thanks! |
|
@ACE07-Sev This is looking good 👍 I have a question: how does the From what I can see, the decomposition might finish even though it didn't reach the If that's the design intent, my suggestions are:
|
Yes. There are two cases which end the decomposition. Either we reach the number of layers K, or we reach the target fidelity before that.
I wouldn't recommend forcing more layers. Of course, I'll add them now. |
- Added print logs for fidelity with respect to number of layers used.
Command Bot: Processing... |
Hi @ACE07-Sev, |
|
Copy that. |
I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: a089e4b I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: bd2706d I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: 8caf17a Signed-off-by: A.C.E07 <a.c.e8009aiden@gmail.com>
Command Bot: Processing... |
|
Did I break this one? |
|
So, I'll add ASAP. I noticed the index issue you mentioned in one of the failed CI, I'll investigate further. It's odd that I don't see the error on my side, may I ask if you're using a specific OS or something particular like that? |
|
@1tnguyen Sorry to bother. When you run the latest notebook locally, do you still have the issue? |
Yea, I can run the notebook locally without an issue. For the CI failures: (1) The documentation build: we can build the docs locally using this script if needed. This will probably reproduce the error that we've seen in the CI. It looks like we're missing an entry in this (2) For the notebook validation failure, we might need to add a special notebook cell with commands to install extra prerequisites. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
Any of the failed CIs that failed due to my side? |
|
Fixing the spelling check. |
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
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.
LGTM 👍 Thanks @ACE07-Sev for the contribution.
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
Sorry to bother. Could I ask when this will be merged? I would like to work on other issues but I am not allowed to make new PRs if I have 4 PRs open. I apologize for the inconvenience. |
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
* Added MPS encoding - Closes NVIDIA#1616 * - Fixed index ordering * Update mps_encoding.ipynb * - Changed `num_layers` to `max_num_layers`. - Added print logs for fidelity with respect to number of layers used. * DCO Remediation Commit for A.C.E07 <a.c.e8009aiden@gmail.com> I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: a089e4b I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: bd2706d I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: 8caf17a Signed-off-by: A.C.E07 <a.c.e8009aiden@gmail.com> * DCO Remediation Commit for A.C.E07 <a.c.e8009aiden@gmail.com> I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: 1ff26f1 Signed-off-by: A.C.E07 <a.c.e8009aiden@gmail.com> * - Fixes index issue by freezing numba version. * DCO Remediation Commit for A.C.E07 <a.c.e8009aiden@gmail.com> I, A.C.E07 <a.c.e8009aiden@gmail.com>, hereby add my Signed-off-by to this commit: e9c59cb Signed-off-by: A.C.E07 <a.c.e8009aiden@gmail.com> * Adding mps to the spelling list Signed-off-by: Sachin Pisal <spisal@nvidia.com> --------- Signed-off-by: A.C.E07 <a.c.e8009aiden@gmail.com> Signed-off-by: Sachin Pisal <spisal@nvidia.com> Co-authored-by: Thien Nguyen <58006629+1tnguyen@users.noreply.github.com> Co-authored-by: Sachin Pisal <spisal@nvidia.com> Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
Uh oh!
There was an error while loading. Please reload this page.