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.x
— Methodx(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)
QXZoo.DefaultGates.y
— Methody(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)
QXZoo.DefaultGates.z
— Methodz(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)
QXZoo.DefaultGates.h
— Methodh(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)
QXZoo.DefaultGates.s
— Methods(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)
QXZoo.DefaultGates.t
— Methods(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)
Single Qubit Gates: rotation and arbitrary
QXZoo.DefaultGates.u
— Methodu(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)
QXZoo.DefaultGates.r_x
— Methodr_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)
QXZoo.DefaultGates.r_y
— Methodr_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)
QXZoo.DefaultGates.r_z
— Methodr_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)
QXZoo.DefaultGates.r_phase
— Methodr_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)
Two Qubit Gates: default
QXZoo.DefaultGates.c_x
— Methodc_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))
QXZoo.DefaultGates.c_y
— Methodc_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))
QXZoo.DefaultGates.c_z
— Methodc_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))
Two Qubit Gates: rotation and arbitrary
QXZoo.DefaultGates.c_u
— Methodc_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)
QXZoo.DefaultGates.c_r_x
— Methodc_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)
QXZoo.DefaultGates.c_r_y
— Methodc_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)
QXZoo.DefaultGates.c_r_z
— Methodc_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)
QXZoo.DefaultGates.c_r_phase
— Methodc_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)