If one has two qubits in arbitrary stats and wishes to apply a controlled version of some global phase gate $P(\varphi) = \begin{pmatrix} e^{i\varphi} & 0 \\ 0 & e^{i\varphi} \end{pmatrix}$ one should obtain:

$$ \left| \psi_0 \right\rangle \left| \psi_1 \right\rangle = \left(c_{00} \left| 0 \right\rangle + c_{01} \left| 1 \right\rangle \right)\left(c_{10} \left| 0 \right\rangle + c_{11} \left| 1 \right\rangle \right) \xrightarrow{\text{CP} }$$

$$ \xrightarrow{\text{CP}} c_{00} \left| 0 \right\rangle \left(c_{10} \left| 0 \right\rangle + c_{11} \left| 1 \right\rangle \right) + c_{01} \left| 1 \right\rangle \left(c_{10} e^{i\varphi} \left| 0 \right\rangle + c_{11} e^{i\varphi} \left| 1 \right\rangle \right), $$

This example shows that in contrast to global phase gate $P$ which doesn't produce any measurable changes in a qubit state, the controlled version of it ($CP$) makes measurable changes in the state of a system of qubits. So it is ok if $P$ is ignored, but it is not ok if $CP$ is ignored (what is happening in the presented code).

Here is a code where I use qiskit.aqua.operators.common.evolution_instruction method, where because of (how I understand) ignoring the global phase gate, the $CP$ gate wasn't obtained (the print(qc.qasm()) command shows no gate is added to the circuit):

import numpy as np
from qiskit import *
from qiskit.aqua.operators import WeightedPauliOperator
from qiskit.aqua.operators.common import evolution_instruction

phase = np.pi
pauli_dict = {'paulis': [{"coeff": {"imag": 0.0, "real": phase}, "label": "I"}]}
identity = WeightedPauliOperator.from_dict(pauli_dict)

pauli_list = identity.reorder_paulis()
instruction = evolution_instruction(pauli_list, evo_time=1, num_time_slices=1, controlled=True)

q = QuantumRegister(2)
qc_temp = QuantumCircuit(q)
qc_temp.append(instruction, q)
qc = qc_temp.decompose()


Possible consequences: when I tried to implement IPEA algorithm for $H = \begin{pmatrix} E_1 & 0 \\ 0 & E_2 \end{pmatrix}$ Hamiltonian I was estimating $E_2 - E_1$ instead of estimating $E_2$ eigenvalue. This problem was reported here. Problems may arise also for other quantum algos that use PEA as a subroutine (like HHL algo).

Is this a problem/bug? Are there alternatives to qiskit evolution_instruction method that don't ignore phase gates (or Pauli I operator)?


3 Answers 3


It seems that this is not a problem/bug. In case the global phase gate $P$ is applied in non-controlled form, final matrix for two qubits ($P$ is acting on second qubit) is \begin{equation} I \otimes P = \begin{pmatrix} P & O \\ O & P \\ \end{pmatrix} =\mathrm{e}^{i\phi}I \end{equation} So, $P$ acts as global phase gate and the phase $\mathrm{e}^{i\phi}$ can be ignored.

However, matrix of controlled $P$ is as follows \begin{equation} CP = \begin{pmatrix} I & O \\ O & P \\ \end{pmatrix} \end{equation} Hence, $CP$ is no longer global phase gate but it prepares entangled state.

  • 1
    $\begingroup$ Thanks for your answer Martin :). My problem here is not about the uselessness of P gate and is not about the fact that CP isn't a global phase gate. You are right about CP and P, but my question is about qiskit's evolution_instruction method that doesn't create CP gate, when it should be created. $\endgroup$ Commented Jan 2, 2020 at 19:39
  • $\begingroup$ @DavitKhachatryan: Sorry, I probably did not understand your question correctly. $\endgroup$ Commented Jan 2, 2020 at 20:01

What does the print(qc.qasm()) yield for you?

Here is what I get:

include "qelib1.inc";
qreg q2[2];
Controlled-Evolution^1 q2[0],q2[1];
  • $\begingroup$ my output is: OPENQASM 2.0; include "qelib1.inc"; qreg q2[2]; barrier q2[0]; $\endgroup$ Commented Jan 3, 2020 at 15:26
  • $\begingroup$ Did you do qc = qc_temp.decompose() part? It should be done how I understand before adding to the circuit in order to decompose "evolution" or "Controlled-Evolution" to qc gates $\endgroup$ Commented Jan 3, 2020 at 15:27
  • $\begingroup$ maybe the problem is in qc = qc_temp.decompose()? This decompose method is used in WeightedPauliOperator.evolve method for the same purpose (for obtaining gates from "evolutions") $\endgroup$ Commented Jan 3, 2020 at 15:34

I just copied and pasted your code above, and that is the output I get from the print() statement. What version of qiskit do you have?

from qiskit import qiskit_version
  • $\begingroup$ {'qiskit-terra': '0.11.0', 'qiskit-aer': '0.3.4', 'qiskit-ignis': '0.2.0', 'qiskit-ibmq-provider': '0.4.4', 'qiskit-aqua': '0.6.1', 'qiskit': '0.14.0'} $\endgroup$ Commented Jan 3, 2020 at 15:40
  • $\begingroup$ Also for example, when I am changing 'I' to 'Z' in pauli_dict I am obtaining gates, not "evolutions". $\endgroup$ Commented Jan 3, 2020 at 15:46
  • $\begingroup$ You might try installing the latest development code which may explain the difference between your results and mine. Here's my version: { 'qiskit': '0.14.0', 'qiskit-aer': '0.4.0', 'qiskit-aqua': '0.7.0.dev0+6b00bb9', 'qiskit-ibmq-provider': '0.4.6rc1', 'qiskit-ignis': '0.3.0.dev0+59162f7', 'qiskit-terra': '0.12.0.dev0+8700dd2'} $\endgroup$
    – Jack Woehr
    Commented Jan 3, 2020 at 15:59
  • 1
    $\begingroup$ Thanks for your time Jack. I will try to work with qiskit's master branch and see the difference :) $\endgroup$ Commented Jan 3, 2020 at 16:03
  • $\begingroup$ Hi Jack, I tried to run the code with the latest development code and obtained the same thing that you have obtained with Controlled-Evolution^1. Now I am trying to understand what is Controlled-Evolution^1 and why it is not decomposed to a set of gates. $\endgroup$ Commented Jan 4, 2020 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.