Gates
The gates are used to represent various gate operations on qubits. Gates should implement the following functions:
label
qubit_count
n_angles
angles
chars
ir_typ
ir_str
targets_and_controls
label
is used to generate the gate's representation in OpenQASM3.chars
is used when pretty-printing the gate as part of aCircuit
.n_angles
is the number of angles present in the gate andangles
is an accessor method for those angles – gates without angles should return an empty tuple()
.ir_typ
is a mapping to the gate's sibling in theIR
submodule.ir_str
is the gate's full OpenQASM3 representation.targets_and_controls
should accept the gate and aQubitSet
of qubits to apply it to, and generate from this the list of control qubits and target qubits.
New gates with angle parameters should be subtypes of AngledGate{N}
, where N
is the number of angle parameters. They should have one member, angle::NTuple{N, Union{Float64, FreeParameter}}
.
Braket.Gate
— TypeGate <: QuantumOperator
Abstract type representing a quantum gate.
Braket.AngledGate
— TypeAngledGate{NA} <: Gate
Parametric type representing a quantum gate with NA
angle
parameters.
Braket.H
— TypeH <: Gate
H() -> H
H gate.
Braket.I
— TypeI <: Gate
I() -> I
I gate.
Braket.X
— TypeX <: Gate
X() -> X
X gate.
Braket.Y
— TypeY <: Gate
Y() -> Y
Y gate.
Braket.Z
— TypeZ <: Gate
Z() -> Z
Z gate.
Braket.PhaseShift
— TypePhaseShift <: AngledGate{1}
PhaseShift(angles) -> PhaseShift
PhaseShift gate.
Braket.Rx
— TypeRx <: AngledGate{1}
Rx(angles) -> Rx
Rx gate.
Braket.Ry
— TypeRy <: AngledGate{1}
Ry(angles) -> Ry
Ry gate.
Braket.Rz
— TypeRz <: AngledGate{1}
Rz(angles) -> Rz
Rz gate.
Braket.V
— TypeV <: Gate
V() -> V
V gate.
Braket.Vi
— TypeVi <: Gate
Vi() -> Vi
Vi gate.
Braket.T
— TypeT <: Gate
T() -> T
T gate.
Braket.Ti
— TypeTi <: Gate
Ti() -> Ti
Ti gate.
Braket.S
— TypeS <: Gate
S() -> S
S gate.
Braket.Si
— TypeSi <: Gate
Si() -> Si
Si gate.
Braket.CNot
— TypeCNot <: Gate
CNot() -> CNot
CNot gate.
Braket.CV
— TypeCV <: Gate
CV() -> CV
CV gate.
Braket.CY
— TypeCY <: Gate
CY() -> CY
CY gate.
Braket.CZ
— TypeCZ <: Gate
CZ() -> CZ
CZ gate.
Braket.XX
— TypeXX <: AngledGate{1}
XX(angles) -> XX
XX gate.
Braket.XY
— TypeXY <: AngledGate{1}
XY(angles) -> XY
XY gate.
Braket.YY
— TypeYY <: AngledGate{1}
YY(angles) -> YY
YY gate.
Braket.ZZ
— TypeZZ <: AngledGate{1}
ZZ(angles) -> ZZ
ZZ gate.
Braket.ECR
— TypeECR <: Gate
ECR() -> ECR
ECR gate.
Braket.CPhaseShift
— TypeCPhaseShift <: AngledGate{1}
CPhaseShift(angles) -> CPhaseShift
CPhaseShift gate.
Braket.CPhaseShift00
— TypeCPhaseShift00 <: AngledGate{1}
CPhaseShift00(angles) -> CPhaseShift00
CPhaseShift00 gate.
Braket.CPhaseShift01
— TypeCPhaseShift01 <: AngledGate{1}
CPhaseShift01(angles) -> CPhaseShift01
CPhaseShift01 gate.
Braket.CPhaseShift10
— TypeCPhaseShift10 <: AngledGate{1}
CPhaseShift10(angles) -> CPhaseShift10
CPhaseShift10 gate.
Braket.Swap
— TypeSwap <: Gate
Swap() -> Swap
Swap gate.
Braket.PSwap
— TypePSwap <: AngledGate{1}
PSwap(angles) -> PSwap
PSwap gate.
Braket.ISwap
— TypeISwap <: Gate
ISwap() -> ISwap
ISwap gate.
Braket.CSwap
— TypeCSwap <: Gate
CSwap() -> CSwap
CSwap gate.
Braket.CCNot
— TypeCCNot <: Gate
CCNot() -> CCNot
CCNot gate.
Braket.Unitary
— TypeUnitary <: Gate
Unitary(matrix::Matrix{ComplexF64}) -> Unitary
Arbitrary unitary gate.