qiskit-community / qiskit-ionq

Qiskit provider for IonQ backends

Home Page:https://qiskit-community.github.io/qiskit-ionq/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MS gate matrix is wrong

fvoichick opened this issue · comments

commented

Information

  • Qiskit IonQ Provider version: 0.4.7

  • Python version: 3.10.12

  • Operating system: Ubuntu

What is the current behavior?

The MS gate matrix is incorrect. The phi0 parameter affects qubit 1, and the phi1 parameter affects qubit 0.

Steps to reproduce the problem

Run this code:

target = QuantumCircuit(2)
target.rz(-pi / 2, 0)
target.append(MSGate(0, 0), (0, 1))
target.rz(pi / 2, 0)

c0 = QuantumCircuit(2)
c0.append(MSGate(0.25, 0), (0, 1))

c1 = QuantumCircuit(2)
c1.append(MSGate(0, 0.25), (0, 1))

print(process_fidelity(Operator(c0), Operator(target)))
print(process_fidelity(Operator(c1), Operator(target)))

Output:

0.2500000000000001
1.0

What is the expected behavior?

Circuit target should be equivalent to c0. Changing the phi0 parameter should be equivalent to RZ gates on qubit 0, not qubit 1.

Suggested solutions

Fix the gate matrix to adhere to Qiskit's unusual bit ordering conventions.