Global Phase#

from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register
from qualtran import QBit, QInt, QUInt, QAny
from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma
from typing import *
import numpy as np
import sympy
import cirq

GlobalPhase#

Applies a global phase to the circuit as a whole.

For an exponent \(t\), the unitary effect is to multiply the state vector by the complex scalar

\[ (-1)^t = e^{i \pi t} \]

The global phase of a state or circuit does not affect any observable quantity, but keeping track of it can be a useful bookkeeping mechanism for testing circuit identities, and the global phase becomes important when controlling an operation.

This is fundamentally an atomic operation and this bloq has no decomposition in Qualtran.

The single-qubit controlled version of GlobalPhase is ZPowGate.

Parameters#

  • exponent: the exponent t of the global phase (-1)^t to apply.

  • eps: The precision of the rotation. This parameter is for bookkeeping and does not affect e.g. the tensor representation of this gate.

from qualtran.bloqs.basic_gates import GlobalPhase

Example Instances#

global_phase = GlobalPhase(exponent=0.5)

Graphical Signature#

from qualtran.drawing import show_bloqs
show_bloqs([global_phase],
           ['`global_phase`'])

Tensors and Controlled#

The “tensor” of the global phase gate is just a number.

global_phase.tensor_contract()
(6.123233995736766e-17+1j)

When a global phase is controlled, it is equivalent to a ZPowGate

cgp = global_phase.controlled()
print(repr(cgp))
print(cgp.tensor_contract())
ZPowGate(exponent=0.5, eps=1e-11)
[[1.+0.j 0.+0.j]
 [0.+0.j 0.+1.j]]