4

I have noticed that Open QASM and Qiskit define the universal single-qubit gate U(lambda, theta, phi) differently. The difference causes a phase difference in RZ, for example.

Has anyone come across this problem? Which should one choose?

fatihyildizhan
  • 8,614
  • 7
  • 64
  • 88

1 Answers1

2

The gate U in OpenQASM 2 was defined as a special unitary (i.e. determinant=1). But if you are writing circuits in the OpenQASM 2 language, this choice should not be consequential, as OpenQASM 2 does not have a way of explicitly dealing with global phases (and they are not observable).

OpenQASM 3 on the other hand has a mechanism for controlling gates. This makes global phases consequential (controlling turns the global phase into a relative, observable phase). It turns out the new definition of U in OpenQASM 3 is the same as the definition in Qiskit. If you are writing circuits in OpenQASM 3 or Qiskit, then global phases matter. Therefore you should use this new definition.

(As a side note, the new definition is chosen because standard gates such as Paulis can be derived from it in a more straightforward way).

Ali Javadi
  • 131
  • 2
  • There's a issue when you do controlled-gates though, and the phase becomes relevant. We bumped into this issue in our quantum simulator https://github.com/softwareQinc/qpp and compiler https://github.com/softwareQinc/staq To solve the issue, we decided to use a `-DUSE_QISKIT_SPECS=ON/OFF` flag, so when it's ON, it uses qiskit (standard), and when OFF, uses OpenQASM. – vsoftco Nov 10 '21 at 14:16