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 4

Any 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.0im

You can even specify the eltype!

julia> Matrix{Int}(gate)
2×2 Matrix{Int64}:
 1   0
 0  -1

Furthermore, the $Z$ gate allows a Diagonal representation!

julia> Diagonal{Float32}(gate)
2×2 Diagonal{Float32, Vector{Float32}}:
 1.0    ⋅
  ⋅   -1.0
Quac.OperatorType
Operator

An abstract type that groups all symbolic expressions of operators.

source

Pauli gates

Quac.IType
I(lane)

The $σ_0$ Pauli matrix gate.

Note

Due to name clashes with LinearAlgebra.I, Quac.I is not exported by default.

source

Hadamard gate

Phase gates

Quac.SType
S(lane)

The $S$ gate or $\frac{π}{2}$ rotation around Z-axis.

source
Quac.SdType
Sd(lane)

The $S^\dagger$ gate or $-\frac{π}{2}$ rotation around Z-axis.

source
Quac.TType
T(lane)

The $T$ gate or $\frac{π}{4}$ rotation around Z-axis.

source
Quac.TdType
Td(lane)

The $T^\dagger$ gate or $-\frac{π}{4}$ rotation around Z-axis.

source

Rotation gates

Quac.RxType
Rx(lane, θ)

The $\theta$ rotation around the X-axis gate.

source
Quac.RyType
Ry(lane, θ)

The $\theta$ rotation around the Y-axis gate.

source
Quac.RzType
Rz(lane, θ)

The $\theta$ rotation around the Z-axis gate.

Notes

  • The U1 gate is an alias of Rz.
source
Quac.RxxType
Rxx(lane1, lane2, θ)

The $\theta$ rotation around the XX-axis gate.

source
Quac.RyyType
Ryy(lane1, lane2, θ)

The $\theta$ rotation around the YY-axis gate.

source
Quac.RzzType
Rzz(lane1, lane2, θ)

The $\theta$ rotation around the ZZ-axis gate.

source

General U2, U3 gates

Controlled gates

SWAP gate

Special Unitary gate

Experimental interface

This interface is experimental and may change in the future.

Quac.SUType
SU{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$.

source