Skip to content

Change in UnitarySynthesis for Rxx basis between 1.3 and 2.0 #14350

@SquidDev

Description

@SquidDev

Environment

  • Qiskit version: 4c86574
  • Python version: Python 3.12
  • Operating system: Ubuntu 24.04

What is happening?

With Qiskit 1.3, using UnitarySynthesis with the Rxx basis would decompose to Rxx(π/2) gates. Under Qiskit 2.0, it instead decomposes those gates to Rxx(-π/2).

This might be intended behaviour, in which case sorry! I couldn't see anything on the release notes, so felt it was worth raising an issue just in case.

How can we reproduce the issue?

import math

from qiskit import QuantumCircuit
from qiskit.transpiler.passes import ConsolidateBlocks, UnitarySynthesis

q = QuantumCircuit(2)
q.rxx(math.pi / 2, 0, 1)
consolidated = ConsolidateBlocks(basis_gates=["rxx", "r"], force_consolidate=True)(q)
decomposed = UnitarySynthesis(basis_gates=["rxx", "r"])(consolidated)

print(q)
print(decomposed)

What should happen?

Under Qiskit 1.3, this decomposes to a single Rxx(π/2) gate:

Input:
     ┌───────────┐
q_0: ┤0          ├
     │  Rxx(π/2) │
q_1: ┤1          ├
     └───────────┘
Output:
     ┌───────────┐
q_0: ┤0          ├
     │  Rxx(π/2) │
q_1: ┤1          ├
     └───────────┘

Under Qiskit 2.0, this decomposes to a much longer sequence of R and Rxx gates:

Input
     ┌───────────┐
q_0: ┤0          ├
     │  Rxx(π/2) │
q_1: ┤1          ├
     └───────────┘
Output
global phase: π
      ┌───────────┐ ┌──────────┐┌────────────┐             ┌────────────┐┌────────────┐┌─────────────┐┌───────────┐
q_0: ─┤ R(-π/4,0) ├─┤ R(π,π/2) ├┤ R(-π/2,-π) ├─────────────┤0           ├┤ R(-π/2,-π) ├┤ R(-3π/4,-π) ├┤ R(π,-π/2) ├────────────
     ┌┴───────────┴┐├──────────┤├───────────┬┘┌───────────┐│  Rxx(-π/2) │├───────────┬┘└─┬──────────┬┘├───────────┤┌──────────┐
q_1: ┤ R(-3π/4,-π) ├┤ R(π,π/2) ├┤ R(-π,π/2) ├─┤ R(π/2,-π) ├┤1           ├┤ R(-π,π/2) ├───┤ R(π/2,0) ├─┤ R(-π/4,0) ├┤ R(π,π/2) ├
     └─────────────┘└──────────┘└───────────┘ └───────────┘└────────────┘└───────────┘   └──────────┘ └───────────┘└──────────┘

Any suggestions?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions