Skip to content

Transplie Rx introduce an incorrect global phase. #14074

@PhysicsQoo

Description

@PhysicsQoo

Environment

  • Qiskit version: 1.4.2
  • Python version: 2.9.0
  • Operating system: linux

What is happening?

Rx(theta) = H Rz(theta) H

This conversion theoretically does not generate any global phase. However, the transpiler from qiskit will generate an extra global phase pi here.

How can we reproduce the issue?

from qiskit import QuantumCircuit, transpile
import numpy as np
theta = 0.5*np.pi
circuit1 = QuantumCircuit(1)
circuit1.rx(theta, 0)
circuit2 = transpile(circuit1, basis_gates=['h','rz' ])
global_phase = circuit2.global_phase-circuit1.global_phase
print(global_phase)
circuit2.draw('mpl')

output:

3.141592653589793

Image

What should happen?

During the transformation of Rx gate, the global phase may be added incorrectly, resulting in an error in the final result.

Any suggestions?

No response

Metadata

Metadata

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