How to Automatically decompose the GlobalPhase gate?

I design this VQC that uses Quantum Amplitude Amplification as ansatz and Angle Encoding method :


# Define the Quantum Amlitude Amplification VQC circuit
@qml.prod
def generator(wires):
    for wire in wires:
        qml.Hadamard(wires=wire)
O = qml.FlipSign(1, wires=range(5)) 
U = generator(wires=range(5))#oracle for fliping the sign of the state
@qml.qnode(dev)
def QAmpAmp_vqc(inputs, weights):
    # Encoding layer
    qml.AngleEmbedding(inputs, rotation='X', wires=range(n_qubits))
    # Ansatz layer
    qml.AmplitudeAmplification(U,O,iters=1)
    # Return expectation values
    return qml.probs(wires=range(5))

and i tronsform it this way, aiming to have a full-transformation :

# Get the transform program
transform_program = qml.workflow.get_transform_program(QAmpAmp_vqc, level="device") # equivalent to level=None

after that i describe infos from this VQC as follows :

print(qml.specs(QAmpAmp_vqc, level="device")(inputs, weights)["resources"])

i got this informations :

wires: 5
gates: 20
depth: 8
shots: Shots(total=None)
gate_types:
{‘RX’: 5, ‘C(PauliZ)’: 1, ‘GlobalPhase’: 1, ‘Hadamard’: 10, ‘PauliX’: 2, ‘C(PhaseShift)’: 1}
gate_sizes:
{1: 17, 5: 2, 0: 1}

My question is : how can we automatically decompose the GlobalPhase gate (which applies a global phase to all qubits) into simpler, hardware-compatible gates like RX, RY, or RZ rotations? Are there existing methods in libraries like PennyLane, or is there a known standard technique for converting a GlobalPhase into a combination of single-qubit gates?

Hi @yousrabou,

I don’t think a global phase can be decomposed as RX, RY, and RZ gates. The global phase won’t affect the measurement outcome probabilities so in many cases you can ignore it.

In case you do care about this global phase you’d need to do quantum phase estimation. You can learn about it in this Codebook module, or this demo.

I hope this helps!

1 Like