DefaultGates

DefaultGates.GateSymbols

Here we store symbols for the gates available in DefaultGates, and generator functions for parameteric variants of these gates. This allows us to track the mappings as to be used by the gate type hierarchy and architecture.

Commonly used gates

The functions in this module allow use to create a QXZoo.GateOps.AGateCall struct for a given qubit target and symbol type.

Single Qubit Gates: default

QXZoo.DefaultGates.xMethod
x(q_target::Int)

Generate a single qubit Pauli-x GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.x(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:x, 0, false), 0)
source
QXZoo.DefaultGates.yMethod
y(q_target::Int)

Generate a single qubit Pauli-y GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.y(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:y, 0, false), 0)
source
QXZoo.DefaultGates.zMethod
z(q_target::Int)

Generate a single qubit Pauli-z GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.z(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:z, 0, false), 0)
source
QXZoo.DefaultGates.hMethod
h(q_target::Int)

Generate a single qubit Hadamard GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.h(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:h, 0, false), 0)
source
QXZoo.DefaultGates.sMethod
s(q_target::Int)

Generate a single qubit S GateCall (GateCall1) applied to the target qubit (s == sqrt(z))

Examples

julia> QXZoo.DefaultGates.s(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:z, 1, false), 0)
source
QXZoo.DefaultGates.tMethod
s(q_target::Int)

Generate a single qubit T GateCall (GateCall1) applied to the target qubit (t == sqrt(s))

Examples

julia> QXZoo.DefaultGates.t(0)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:z, 2, false), 0)
source

Single Qubit Gates: rotation and arbitrary

QXZoo.DefaultGates.uMethod
u(label::GateSymbol, q_target::Int)

Generate a single qubit arbitrary unitary GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.u(QXZoo.GateOps.GateSymbol(:mygate), 1)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbol(:mygate, 0, false), 1)
source
QXZoo.DefaultGates.r_xMethod
r_x(q_target::Int, theta::Number)

Generate a single qubit R_x(θ) GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.r_x(3,pi/2)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbolP(:r_x, 0, false, 1.5707963267948966), 3)
source
QXZoo.DefaultGates.r_yMethod
r_y(q_target::Int, theta::Number)

Generate a single qubit R_y(θ) GateCall (GateCall1) applied to the target qubit.

Examples

julia> QXZoo.DefaultGates.r_y(3,pi/2)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbolP(:r_y, 0, false, 1.5707963267948966), 3)
source
QXZoo.DefaultGates.r_zMethod
r_z(q_target::Int, theta::Number)

Generate a single qubit R_z(θ) GateCall (GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.r_z(3,pi/2)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbolP(:r_z, 0, false, 1.5707963267948966), 3)
source
QXZoo.DefaultGates.r_phaseMethod
r_phase(q_target::Int, theta::Number)

Generate a single qubit phase shift GateCall ( diag(1, exp(1im*theta)) , GateCall1) applied to the target qubit

Examples

julia> QXZoo.DefaultGates.r_phase(3,pi/2)
QXZoo.GateOps.GateCall1(QXZoo.GateOps.GateSymbolP(:r_phase, 0, false, 1.5707963267948966), 3)
source

Two Qubit Gates: default

QXZoo.DefaultGates.c_xMethod
c_x(q_target::Int, q_ctrl::Int)

Generate a controlled Pauli-x (two qubit) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_x(0, 1)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbol(:c_x, 0, false), 0, 1, QXZoo.GateOps.GateSymbol(:x, 0, false))
source
QXZoo.DefaultGates.c_yMethod
c_y(q_target::Int, q_ctrl::Int)

Generate a controlled Pauli-y (two qubit) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_y(0, 1)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbol(:c_y, 0, false), 0, 1, QXZoo.GateOps.GateSymbol(:y, 0, false))
source
QXZoo.DefaultGates.c_zMethod
c_z(q_target::Int, q_ctrl::Int)

Generate a controlled Pauli-x (two qubit) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_z(0, 1)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbol(:c_z, 0, false), 0, 1, QXZoo.GateOps.GateSymbol(:z, 0, false))
source

Two Qubit Gates: rotation and arbitrary

QXZoo.DefaultGates.c_uMethod
c_u(label::GateSymbol, q_target::Int, q_ctrl::Int)

Generate a controlled unitary (two qubit) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_u(QXZoo.GateOps.GateSymbol(:myCU), 0, 1)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbol(:myCU, 0, false), 0, 1, nothing)
source
QXZoo.DefaultGates.c_r_xMethod
c_r_x(q_target::Int, q_ctrl::Int, theta::Number)

Generate a controlled rotation about x (exp(-iθx/2)) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_r_x( 0, 1, pi/2)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbolP(:c_r_x, 0, false, 1.5707963267948966), 0, 1, nothing)
source
QXZoo.DefaultGates.c_r_yMethod
c_r_y(q_target::Int, q_ctrl::Int, theta::Number)

Generate a controlled rotation about y (exp(iθy/2)) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_r_y( 0, 1, pi/3)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbolP(:c_r_y, 0, false, 1.0471975511965976), 0, 1, nothing)
source
QXZoo.DefaultGates.c_r_zMethod
c_r_z(q_target::Int, q_ctrl::Int, theta::Number)

Generate a controlled rotation about z (exp(iθz/2)) GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target

Examples

julia> QXZoo.DefaultGates.c_r_z( 0, 1, pi/4)
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbolP(:c_r_z, 0, false, 0.7853981633974483), 0, 1, nothing)
source
QXZoo.DefaultGates.c_r_phaseMethod
c_r_phase(q_target::Int, q_ctrl::Int, theta::Real)

Generate a controlled phase rotation about (controlled [1 0; 0 exp(iθ)] GateCall (GateCall2), controlled on the index q_ctrl applied to the target q_target.

Examples

julia> QXZoo.DefaultGates.c_r_phase( 0, 1, pi/7 )
QXZoo.GateOps.GateCall2(QXZoo.GateOps.GateSymbolP(:c_r_phase, 0, false, 0.4487989505128276), 0, 1, nothing)
source