Gates
In Quac, gates are symbolic, i.e. they do not store their representation. A gate instance just stores the qubit lane in which it acts and its parameters if needed. Thanks to Julia's multiple-dispatch different representations can be queried lazily from type information.
For example, this is a $Z$ that acts on qubit 4.
julia> gate = Z(4)
Z() on 4Any gate can be represented by a dense matrix.
julia> Matrix(gate)
2×2 Matrix{ComplexF64}:
1.0+0.0im 0.0+0.0im
0.0+0.0im -1.0+0.0imYou can even specify the eltype!
julia> Matrix{Int}(gate)
2×2 Matrix{Int64}:
1 0
0 -1Furthermore, the $Z$ gate allows a Diagonal representation!
julia> Diagonal{Float32}(gate)
2×2 Diagonal{Float32, Vector{Float32}}:
1.0 ⋅
⋅ -1.0Quac.Operator — TypeOperatorAn abstract type that groups all symbolic expressions of operators.
Quac.Gate — TypeGate{Op,N}A type that represents an Operator acting on N qubits.
Pauli gates
Quac.I — TypeI(lane)The $σ_0$ Pauli matrix gate.
Note
Due to name clashes with LinearAlgebra.I, Quac.I is not exported by default.
Quac.X — TypeX(lane)The $σ_1$ Pauli matrix gate.
Quac.Y — TypeY(lane)The $σ_2$ Pauli matrix gate.
Quac.Z — TypeZ(lane)The $σ_3$ Pauli matrix gate.
Hadamard gate
Quac.H — TypeH(lane)The Hadamard gate.
Phase gates
Quac.S — TypeS(lane)The $S$ gate or $\frac{π}{2}$ rotation around Z-axis.
Quac.Sd — TypeSd(lane)The $S^\dagger$ gate or $-\frac{π}{2}$ rotation around Z-axis.
Quac.T — TypeT(lane)The $T$ gate or $\frac{π}{4}$ rotation around Z-axis.
Quac.Td — TypeTd(lane)The $T^\dagger$ gate or $-\frac{π}{4}$ rotation around Z-axis.
Rotation gates
Quac.Rx — TypeRx(lane, θ)The $\theta$ rotation around the X-axis gate.
Quac.Ry — TypeRy(lane, θ)The $\theta$ rotation around the Y-axis gate.
Quac.Rz — TypeRz(lane, θ)The $\theta$ rotation around the Z-axis gate.
Notes
- The
U1gate is an alias ofRz.
Quac.Rxx — TypeRxx(lane1, lane2, θ)The $\theta$ rotation around the XX-axis gate.
Quac.Ryy — TypeRyy(lane1, lane2, θ)The $\theta$ rotation around the YY-axis gate.
Quac.Rzz — TypeRzz(lane1, lane2, θ)The $\theta$ rotation around the ZZ-axis gate.
General U2, U3 gates
Quac.U2 — TypeU2(lane, ϕ, λ)The $U2$ gate.
Quac.U3 — TypeU3(lane, θ, ϕ, λ)The $U3$ gate.
Controlled gates
Quac.Control — TypeControl(lane, op::Gate)A controlled gate.
SWAP gate
Quac.Swap — TypeSwap(lane1, lane2)The SWAP gate.
Special Unitary gate
This interface is experimental and may change in the future.
Quac.SU — TypeSU{N}(lane_1, lane_2, ..., lane_N, array)The SU{N} multi-qubit general unitary gate that can be used to represent any unitary matrix that acts on N qubits. A new random SU{N} can be created with rand(SU{N}, lanes...), where N is the dimension of the unitary matrix and lanes are the qubit lanes on which the gate acts.
Note
Unlike the general notation, N is not the dimension of the unitary matrix, but the number of qubits on which it acts. The dimension of the unitary matrix is $2^N \times 2^N$.