Skip to content

Commit

Permalink
Add tdg to operators.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bopardikarsoham authored May 29, 2023
1 parent dae5ca2 commit 79cf688
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions torchquantum/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"EchoedCrossResonance",
"ECR",
"SDG",
"TDG",
]


Expand Down Expand Up @@ -124,6 +125,7 @@ class Operator(tq.QuantumModule):
"Reset",
"EchoedCrossResonance",
"SDG",
"TDG",
]

parameterized_ops = [
Expand Down Expand Up @@ -1330,12 +1332,25 @@ class sdg(Operation, metaclass=ABCMeta):
@classmethod
def _matrix(cls, params):
return cls.matrix

class tdg(Operation, metaclass=ABCMeta):
"""Class for TDG Gate."""

num_params = 0
num_wires = 1
matrix = mat_dict["tdg"]
func = staticmethod(tqf.tdg)

@classmethod
def _matrix(cls, params):
return cls.matrix


H = Hadamard
SH = SHadamard
EchoedCrossResonance = ECR
SDG = sdg
TDG = tdg


op_name_dict = {
Expand Down Expand Up @@ -1404,4 +1419,5 @@ def _matrix(cls, params):
"ecr": ECR,
"echoedcrossresonance": ECR,
"sdg": sdg,
"tdg": tdg,
}

0 comments on commit 79cf688

Please sign in to comment.