Why QuantumCircuit.diagonal does not provide global phase when it is used in a controlling circuit


When it is used in a controlling circuit, QuantumCircuit.diagonal() decomposition in Qiskit does not provide global phase (as a relative phase), but instead only identity operator is used. Here the example of the code

`CIRCF= QuantumCircuit(3)    
CIRCF.h([0, 1, 2])

CIRCF_1 = QuantumCircuit(2)
CIRCF_1.diagonal(PARAM1,[0, 1])
GATECIRCF_1  =CIRCF_1.to_gate(label='DiagGate1')
CGATECIRCF_1 =GATECIRCF_1.control(1,ctrl_state='0')
CIRCF.append(CGATECIRCF_1,[2, 0, 1])  

CIRCF_2 = QuantumCircuit(2)
CIRCF_2.diagonal(PARAM2,[0, 1])
GATECIRCF_2  =CIRCF_2.to_gate(label='DiagGate2)
CGATECIRCF_2 =GATECIRCF_2.control(1,ctrl_state='0')
CIRCF.append(CGATECIRCF_2,[2, 0, 1])

CIRCF_job1 = execute(CIRCF, backend1).result().get_statevector(CIRCF) `

The output statevector corresponds to the case where identity operator is used in CIRCF_1.to_gate(label='DiagGate1') and CIRCF_2.to_gate(label='DiagGate1'), without applying the global phase as relative phase. The list of diagonal entries in PARAM1 and PARAM2 does not affect the output in any way, i.e. the output statevector is always in form:


The problem is that the output state vector should be $\frac{1}{2}|0\rangle($GATECIRCF_1$+$GATECIRCF_2$)|\Psi\rangle +$$\frac{1}{2}|1\rangle($GATECIRCF_1$-$GATECIRCF_2$)|\Psi\rangle$ , where $|\Psi\rangle$ is the initial state given by the $|H\rangle$ for all qubits. But any change in PARAM1 or PARAM2 gives exactly the same output as above. In general, global phase for .diagonal method should be included.


Posted 2020-08-21T10:58:56.597

Reputation: 53

No answers