Skip to content

Commit

Permalink
Merge pull request ScQ-Cloud#129 from chensgit169/master
Browse files Browse the repository at this point in the history
Enhance QuantumGate (1/2, reopened)
  • Loading branch information
Zhaoyilunnn authored Dec 24, 2023
2 parents 47346cf + a2e8644 commit b6ba27b
Show file tree
Hide file tree
Showing 15 changed files with 587 additions and 668 deletions.
7 changes: 4 additions & 3 deletions quafu/elements/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .instruction import Instruction, Barrier, Measure, Reset
from .pulses import Delay, XYResonance, QuantumPulse
from .quantum_gate import QuantumGate, ControlledGate, MultiQubitGate, SingleQubitGate
from .classical_element import Cif
from .instruction import Barrier, Instruction, Measure, Reset
from .pulses import Delay, QuantumPulse, XYResonance
from .quantum_gate import ControlledGate, MultiQubitGate, QuantumGate, SingleQubitGate
from .unitary import UnitaryDecomposer
12 changes: 2 additions & 10 deletions quafu/elements/element_gates/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
from .c11 import CPGate, CSGate, CTGate, CXGate, CYGate, CZGate
from .c12 import FredkinGate
from .clifford import HGate, SdgGate, SGate, TdgGate, TGate
from .cm1 import MCXGate, MCYGate, MCZGate, ToffoliGate
from .pauli import *
from .rotation import PhaseGate, RXGate, RXXGate, RYGate, RYYGate, RZGate, RZZGate
from .swap import ISwapGate, SwapGate
from .unitary import UnitaryDecomposer
from .element_gates import *

__all__ = [
"XGate",
Expand Down Expand Up @@ -42,6 +35,5 @@
"FredkinGate",
"MCXGate",
"MCYGate",
"MCZGate",
"UnitaryDecomposer",
"MCZGate"
]
71 changes: 0 additions & 71 deletions quafu/elements/element_gates/c11.py

This file was deleted.

13 changes: 0 additions & 13 deletions quafu/elements/element_gates/c12.py

This file was deleted.

50 changes: 2 additions & 48 deletions quafu/elements/element_gates/clifford.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
import numpy as np
from quafu.elements.matrices import HMatrix, SMatrix
from .element_gates import HGate, SGate, CXGate

from ..quantum_gate import FixedGate, QuantumGate, SingleQubitGate
__all__ = ['HGate', 'SGate', 'CXGate']

__all__ = ["HGate", "SGate", "SdgGate", "TGate", "TdgGate"]


@QuantumGate.register("h")
class HGate(SingleQubitGate, FixedGate):
name = "H"
matrix = HMatrix

def __init__(self, pos: int):
FixedGate.__init__(self, pos)


@QuantumGate.register("s")
class SGate(SingleQubitGate, FixedGate):
name = "S"
matrix = SMatrix

def __init__(self, pos: int):
FixedGate.__init__(self, pos)


@QuantumGate.register("sdg")
class SdgGate(SingleQubitGate, FixedGate):
name = "Sdg"
matrix = SMatrix.conj().T

def __init__(self, pos: int):
FixedGate.__init__(self, pos)


@QuantumGate.register("t")
class TGate(SingleQubitGate, FixedGate):
name = "T"
matrix = np.array([[1.0, 0.0], [0.0, np.exp(1.0j * np.pi / 4)]], dtype=complex)

def __init__(self, pos: int):
FixedGate.__init__(self, pos)


@QuantumGate.register("tdg")
class TdgGate(SingleQubitGate, FixedGate):
name = "Tdg"
matrix = TGate.matrix.conj().T

def __init__(self, pos: int):
FixedGate.__init__(self, pos)
39 changes: 0 additions & 39 deletions quafu/elements/element_gates/cm1.py

This file was deleted.

Loading

0 comments on commit b6ba27b

Please sign in to comment.