-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9abb0b5
commit 3f93d55
Showing
9 changed files
with
78 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from ..quantum_gate import ControlledGate, FixedGate, QuantumGate | ||
from quafu.elements.matrices import SwapMatrix | ||
|
||
from ..quantum_gate import ControlledGate, FixedGate, QuantumGate | ||
|
||
@QuantumGate.register('cswap') | ||
|
||
@QuantumGate.register("cswap") | ||
class FredkinGate(ControlledGate, FixedGate): | ||
name = "CSWAP" | ||
|
||
def __init__(self, ctrl: int, targ1: int, targ2: int): | ||
ControlledGate.__init__(self, "SWAP", [ctrl], [targ1, targ2], None, tar_matrix=SwapMatrix) | ||
ControlledGate.__init__( | ||
self, "SWAP", [ctrl], [targ1, targ2], None, tar_matrix=SwapMatrix | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
from ..quantum_gate import ControlledGate, FixedGate, QuantumGate | ||
from quafu.elements.matrices import XMatrix, YMatrix, ZMatrix | ||
|
||
from ..quantum_gate import ControlledGate, FixedGate, QuantumGate | ||
|
||
__all__ = ["MCXGate", "MCYGate", "MCZGate", "ToffoliGate"] | ||
|
||
|
||
@QuantumGate.register('mcx') | ||
@QuantumGate.register("mcx") | ||
class MCXGate(ControlledGate, FixedGate): | ||
name = "MCX" | ||
|
||
def __init__(self, ctrls, targ: int): | ||
ControlledGate.__init__(self, "X", ctrls, [targ], None, tar_matrix=XMatrix) | ||
|
||
|
||
@QuantumGate.register('mcy') | ||
@QuantumGate.register("mcy") | ||
class MCYGate(ControlledGate, FixedGate): | ||
name = "MCY" | ||
|
||
def __init__(self, ctrls, targ: int): | ||
ControlledGate.__init__(self, "Y", ctrls, [targ], None, tar_matrix=YMatrix) | ||
|
||
|
||
@QuantumGate.register('mcz') | ||
@QuantumGate.register("mcz") | ||
class MCZGate(ControlledGate, FixedGate): | ||
name = "MCZ" | ||
|
||
def __init__(self, ctrls, targ: int): | ||
ControlledGate.__init__(self, "Z", ctrls, [targ], None, tar_matrix=ZMatrix) | ||
|
||
|
||
@QuantumGate.register('ccx') | ||
@QuantumGate.register("ccx") | ||
class ToffoliGate(ControlledGate, FixedGate): | ||
name = "CCX" | ||
|
||
def __init__(self, ctrl1: int, ctrl2: int, targ: int): | ||
ControlledGate.__init__(self, "X", [ctrl1, ctrl2], [targ], None, tar_matrix=XMatrix) | ||
ControlledGate.__init__( | ||
self, "X", [ctrl1, ctrl2], [targ], None, tar_matrix=XMatrix | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.