quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Add warning when converting global phase operator to OpenQASM 2.0 #6473

Closed kenya-sk closed 7 months ago

kenya-sk commented 7 months ago

OpenQASM 2.0 does not support global phase (https://github.com/Qiskit/qiskit/issues/7167#issuecomment-947821313). Therefore, the current implementation generated an error and terminated the program. Since the global phase does not affect the observation results, I have changed it to be supported as a warning and the program can be executed.

The following is how to handle the situation.

  1. Determine if the operator passed to qasm() is an instance of ops.GlobalPhaseGate. If a Circuit is passed, it is deployed to each operator by existing implementations and a decision is made for each.
  2. If it is an instance of ops.GlobalPhaseGate, generate a warning and return an empty string for compatibility with previous implementations.
  3. Otherwise, the operation is the same as before.
google-cla[bot] commented 7 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

kenya-sk commented 7 months ago

The branch was not appropriate, so it was closed and the pull request was recreated.