Skip to content

Commit

Permalink
Merge pull request #244 from BQSKit/sqrt-T-gate
Browse files Browse the repository at this point in the history
SqrtTGate
  • Loading branch information
edyounis committed Jun 7, 2024
2 parents f38c36c + 4e60a9c commit 6974367
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions bqskit/ir/gates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ShiftGate
SqrtCNOTGate
SqrtISwapGate
SqrtTGate
SubSwapGate
SwapGate
SqrtXGate
Expand Down
2 changes: 2 additions & 0 deletions bqskit/ir/gates/constant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from bqskit.ir.gates.constant.shift import ShiftGate
from bqskit.ir.gates.constant.sqrtcnot import SqrtCNOTGate
from bqskit.ir.gates.constant.sqrtiswap import SqrtISwapGate
from bqskit.ir.gates.constant.sqrtt import SqrtTGate
from bqskit.ir.gates.constant.subswap import SubSwapGate
from bqskit.ir.gates.constant.swap import SwapGate
from bqskit.ir.gates.constant.sx import SqrtXGate
Expand Down Expand Up @@ -73,6 +74,7 @@
'ShiftGate',
'SqrtCNOTGate',
'SqrtISwapGate',
'SqrtTGate',
'SubSwapGate',
'SwapGate',
'SqrtXGate',
Expand Down
30 changes: 30 additions & 0 deletions bqskit/ir/gates/constant/sqrtt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""This module implements the SqrtTGate."""
from __future__ import annotations

import cmath

from bqskit.ir.gates.constantgate import ConstantGate
from bqskit.ir.gates.qubitgate import QubitGate
from bqskit.qis.unitary.unitarymatrix import UnitaryMatrix


class SqrtTGate(ConstantGate, QubitGate):
"""
The single-qubit square root T gate.
.. math::
\\begin{pmatrix}
1 & 0 \\\\
0 & e^{i\\frac{\\pi}{8}} \\\\
\\end{pmatrix}
"""

_num_qudits = 1
_qasm_name = 'st'
_utry = UnitaryMatrix(
[
[1, 0],
[0, cmath.exp(1j * cmath.pi / 8)],
],
)

0 comments on commit 6974367

Please sign in to comment.