-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- Qiskit version: 2.3.0rc1 (& others)
- Python version: 3.11
- Operating system: macOS
What is happening?
Isometry does not correctly set the global phase if the input state is the single-qubit [-1, 0]. For all other global phases and more than single-qubit states it works, though. This affects Initialize and StatePreparation, too, since they are based on Isometry.
How can we reproduce the issue?
from qiskit.circuit.library import Isometry, Initialize
from qiskit.quantum_info import Statevector
import numpy as np
vecs = [
[np.exp(1j * np.pi), 0], # -|0>, doesn't work
[np.exp(1j * np.pi * 0.9999), 0], # close to -|0>, works
[np.exp(1j * np.pi), 0, 0, 0], # -|00>, works
]
for vec in vecs:
sv = Statevector(Isometry(vec, 0, 0).definition)
print(sv)What should happen?
The output circuit should have the correct phase of pi.
Any suggestions?
Isometry does a bunch of tests checking if matrices are the identity up to global phase. We can probably fix this by correcting the global phase there.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working