Skip to content
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

shouldn't single-qubit initialization decomposition result in single-qubit instructions? #5134

Closed
1ucian0 opened this issue Sep 26, 2020 · 1 comment · Fixed by #5229
Closed

Comments

@1ucian0
Copy link
Member

1ucian0 commented Sep 26, 2020

Not sure if an issue, so tagging as question for now. If I'm saying nonsense, an explanation would be enough to close this issue (even if I don't understand it).

When creating an initializer with single-qubit states, I would expect that the decomposition turns into single qubits gates/instructions. In this case1 I want to initialize two qubits in |1>:

from qiskit.extensions.quantum_initializer.initializer import Initialize
initialize = Initialize([ 0, 0, 0, 1])

The result of decomposing it, I think, should be something along these lines:

initialize.definition.draw()
          ┌───┐
q_0: ─|0>─┤ X ├
          ├───┤
q_1: ─|0>─┤ X ├
          └───┘

However, it results in a circuit with CNOTs:

from qiskit import transpile
transpile(initialize.definition, basis_gates=['u3', 'cx', 'reset'], optimization_level=0).draw()
          ┌──────────────┐┌───┐┌───────────────┐┌───┐
q_0: ─|0>─┤ U3(pi/2,0,0) ├┤ X ├┤ U3(-pi/2,0,0) ├┤ X ├
          └┬────────────┬┘└─┬─┘└───────────────┘└─┬─┘
q_1: ─|0>──┤ U3(pi,0,0) ├───■─────────────────────■──
           └────────────┘                            

I understand that synthesis is something hard you want to keep general and probably we dont want to handle too many "special cases" (or do we?). To this end, would it help to support something likeInitialize('11') (a la Statevector.from_label)?

In summary,

  • should we "aid" Initialize to decompose into single-qubit instructions when possible?
    • If No,
      • should Initialize synthesis be smarter and minimize/avoid multi-qubit gates when possible?
      • should the transpiler do the leg work here?
    • If Yes,
      • should we support something like Initialize('11'), Initialize('+l'), and the other labels from Statevector.from_label?
      • should we keep the labels when a Statevector is created from labels and allow Initialize(Statevector.from_label('11'))2?

Footnotes:
1 This issue is inspired by a question in stack exchange
2 Supporting Statevector as Initializeparameter seems intuitive to me in any case. Currently an unexpected .data needs to be added Initialize(Statevector.from_label('11').data)

@1ucian0
Copy link
Member Author

1ucian0 commented Oct 14, 2020

From some in-webex discussions, it seem the way to go will be Initialize('11'). Implemented in #5229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants