T Gate#

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

TGate#

The T gate.

This is the fourth root of the Pauli Z gate. Quantum programs composed solely of gates belonging to the Clifford group (like X, Z, Hadamard, CNOT, S) can be simulated efficiently by a classical computer and therefore offer no quantum advantage. The Clifford gates do not provide a universal quantum gateset. The addition of any non-Clifford gate makes the gateset universal. One of the most popular additions is the T gate, yielding the common Clifford+T gateset.

The unitary matrix of cirq.T is $$

(1)#\[\begin{bmatrix} 1 & 0 \\ 0 & e^{i \pi /4} \end{bmatrix}\]

$$

Parameters#

  • is_adjoint: If True, this bloq is \(T^\dagger\) instead.

Registers#

  • q: The qubit

References#

from qualtran.bloqs.basic_gates import TGate

Example Instances#

t_gate = TGate()

Graphical Signature#

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

Call Graph#

from qualtran.resource_counting.generalizers import ignore_split_join
t_gate_g, t_gate_sigma = t_gate.call_graph(max_depth=1, generalizer=ignore_split_join)
show_call_graph(t_gate_g)
show_counts_sigma(t_gate_sigma)
../../_images/a271646db6916cebd5f60499e22b9755d26fa17826b8e9bab051229e25ddc878.svg

Counts totals:

  • T: 1

Properties & Relations#

We can create the “magic state” T|+> which is used via teleportation to do non-Clifford operations in the surface code.

from qualtran.bloqs.basic_gates import PlusState

bb = BloqBuilder()
q = bb.add(PlusState())
q = bb.add(TGate(), q=q)
cbloq = bb.finalize(q=q)
show_bloq(cbloq, 'musical_score')
print(cbloq.tensor_contract() * np.sqrt(2))
/usr/local/google/home/mpharrigan/qualtran/conda-311/lib/python3.11/site-packages/cotengra/hyperoptimizers/hyper.py:57: UserWarning: Couldn't find `optuna`, `cmaes`, `baytune (btb)`, `chocolate`, or `nevergrad` so will use completely random sampling in place of hyper-optimization.
  warnings.warn(
/usr/local/google/home/mpharrigan/qualtran/conda-311/lib/python3.11/site-packages/cotengra/hyperoptimizers/hyper.py:76: UserWarning: Couldn't find `optuna`, `cmaes`, `baytune (btb)`, `chocolate`, or `nevergrad` so will use completely random sampling in place of hyper-optimization.
  warnings.warn(
[1.        +0.j         0.70710678+0.70710678j]
../../_images/0a455206aa4d7204cf8dc77f61d9d4c352fd4b974622567a9bbd05fbe97af249.png