-
Notifications
You must be signed in to change notification settings - Fork 271
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
StatePreparation() on individual qubits instead of on a qureg? #277
Comments
In a program one can combine lists of quantum registers (using
PS:
one could do:
and for more quantum registers use the trick above to build a new larger quantum register:
|
Thanks for the clarification! Is that documented somewhere? I knew that a
seems to suggest that q1 ends up being a Is the behavior of |
You are welcome, I'm happy to help out. Yes, all our functions are documented: To find, e.g.,
|
I know that I can use
StatePreparation()
on a qureg as follows:This works and outputs
Measured: (1, 1)
as expected.How can I use
StatePreparation()
when the qubits were allocated individually and not as a qureg?Suppose have two qubits that were allocated as follows
and I can't change that part of the code, but want to prepare them in a state with
StatePreparation()
. I have tried all of the following, but to no avail:StatePreparation([0,0,0,1]) | [q0, q1]
-> givesAttributeError: 'Qureg' object has no attribute 'id'
StatePreparation([0,0,0,1]) | (q0, q1)
-> givesAssertionError: raised in: ' File "/home/cgogolin/.local/lib/python3.5/site-packages/projectq-0.4.1-py3.5-linux-x86_64.egg/projectq/setups/decompositions/stateprep2cnot.py", line 33, in _decompose_state_preparation' ' assert len(cmd.qubits) == 1'
StatePreparation([0,0,0,1]) | Qureg([q0, q1])
-> givesAttributeError: 'Qureg' object has no attribute 'id'
It does (seem to work) if I do the following:
But this can't be the right way of using
StatePreparation()
? Why do the individually allocated qubits not get anid
? It doesn't seem to matter whether I putq0.id = 0
orq0.id = 54
. Is that intentional/expected?The text was updated successfully, but these errors were encountered: