The global phase of some circuits generated by SolovayKitaev seems wrong.
How can we reproduce the issue?
>>> from qiskit.transpiler.passes.synthesis import SolovayKitaev
>>> from qiskit.quantum_info import Operator
>>> from qiskit import QuantumCircuit, Aer, transpile, assemble
>>> c = QuantumCircuit(1)
>>> c.y(0)
<qiskit.circuit.instructionset.InstructionSet object at 0x7f62280bc910>
>>> skd = SolovayKitaev(recursion_degree=3)
>>> dc = skd(c)
>>> c.draw()
┌───┐
q: ┤ Y ├
└───┘
>>> dc.draw()
global phase: 3π/4
┌───┐┌───┐┌───┐┌───┐┌─────┐┌─────┐┌───┐┌───┐┌───┐
q: ┤ H ├┤ T ├┤ T ├┤ H ├┤ Tdg ├┤ Tdg ├┤ H ├┤ T ├┤ T ├
└───┘└───┘└───┘└───┘└─────┘└─────┘└───┘└───┘└───┘
>>> Operator(c)
Operator([[0.+0.j, 0.-1.j],
[0.+1.j, 0.+0.j]],
input_dims=(2,), output_dims=(2,))
>>> Operator(dc)
Operator([[-1.11022302e-16+7.85046229e-17j,
1.05981241e-15+1.00000000e+00j],
[-9.43689571e-16-1.00000000e+00j,
0.00000000e+00-3.92523115e-17j]],
input_dims=(2,), output_dims=(2,))
What should happen?
Given Operator(dc).data aprroximately equals to [[0, 1j], [-1j, 0]] which equals to -Operator(c).data, dc's global phase should be π rather than 3π/4, I believe.
That could probably be quick-fixed by checking the phases of the input and output matrix, but this might be a deeper bug since I think the SK algorithm should come up with the right phase in the end 🤔
Environment
What is happening?
The global phase of some circuits generated by
SolovayKitaev
seems wrong.How can we reproduce the issue?
What should happen?
Given
Operator(dc).data
aprroximately equals to[[0, 1j], [-1j, 0]]
which equals to-Operator(c).data
,dc
's global phase should be π rather than 3π/4, I believe.Any suggestions?
No response