-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- Qiskit version: 1.2.0
- Python version: 3.11
- Operating system: Apple M2 Air
What is happening?
The following circuit is expected to provide a 110 as dominant state. But it is resulting in state 100 for all shots randomly for optimisation level 2 and 3. The issue could possibly be in the transpilation of the circuit.
How can we reproduce the issue?
from qiskit_aer import StatevectorSimulator
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit import QuantumCircuit
from qiskit.circuit.library import CU3Gate
cu3 = CU3Gate(2.7955,5.1982,3.3315,)
cu32 = CU3Gate(-2.7955,-3.3315,-5.1982)
qc = QuantumCircuit(3)
qc.x(1)
qc.x(2)
qc.id(1)
qc.swap(0,2)
qc.csx(0,1)
qc.u(5.6631,3.9488,1.066, 2)
qc.tdg(0)
qc.p(2.8007, 1)
qc.r(0.71942,4.7156, 2)
qc.ry(1.8777, 0)
qc.rxx(4.836, 1,2)
qc.rz(3.5166, 0)
qc.r(0.6993,2.7793, 1)
qc.u(0.3461,0.42597,3.202, 2)
qc.z(1)
qc.append(cu3, [2,0])
#qc.cu3( )
qc.ry(4.7962, 0)
qc.rx(2.4125, 1)
qc.r(2.4677,3.5935, 2)
qc.r(-2.4677,3.5935, 2)
qc.rx(-2.4125, 1)
qc.ry(-4.7962, 0)
qc.append(cu32, [2,0])
qc.z(1)
qc.u(-0.3461,-3.202,-0.42597, 2)
qc.r(-0.6993,2.7793, 1)
qc.rz(-3.5166, 0)
qc.rxx(-4.836, 1,2)
qc.ry(-1.8777, 0)
qc.r(-0.71942,4.7156, 2)
qc.p(-2.8007, 1)
qc.t(0)
qc.u(-5.6631,-1.066,-3.9488, 2)
qc.csx(0,1).inverse()
qc.swap(0,2)
qc.id(1)
qc.measure_all()
backend = StatevectorSimulator()
for i in range(4):
pass_manager=generate_preset_pass_manager(backend=backend, optimization_level=i)
transpiled_circuit = pass_manager.run(qc)
#print(transpiled_circuit)
job = backend.run(transpiled_circuit, shots=11000)
results = job.result().get_counts()
print(f"Optimisation Level: {i}, Results: {results}")
What should happen?
Running the script for 1st time provides correct results
python3 issue.py
Optimisation Level: 0, Results: {'110': 11000}
Optimisation Level: 1, Results: {'110': 11000}
Optimisation Level: 2, Results: {'110': 11000}
Optimisation Level: 3, Results: {'110': 11000}
But running the scirpt for the 3rd time gave me the following result:
python3 issue.py
Optimisation Level: 0, Results: {'110': 11000}
Optimisation Level: 1, Results: {'110': 11000}
Optimisation Level: 2, Results: {'100': 11000}
Optimisation Level: 3, Results: {'100': 11000}
But running the same result on Qiskit 1.1.0 is working properly.
Any suggestions?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working