Gates
Clifford Gates
PauliPropagation.CliffordGate
— TypeA type for a Clifford gate that carries the name of the gate and qubit indices on which it acts.
PauliPropagation.CliffordGate
— MethodCliffordGate(symbol::Symbol, qinds::Vector{Int})
CliffordGate(symbol::Symbol, qinds::Int)
A Clifford gate with the name symbol
acting on the qubits qinds
. symbol
needs to match any of the implemented Clifford gates in the global clifford_map
. qinds
can be a single integer, a vector of integers, or anything that transforms into a vector via vec(collect(qinds))
.
PauliPropagation.composecliffordmaps
— Methodcomposecliffordmaps(circuit::Vector{CliffordGate})
Compose a circuit of Clifford gates into a single Clifford map. The length of the map is 4^nq
where nq
is the maximum qubit index in the circuit. The resulting clifford map can be added to the global clifford_map
with a custom Clifford gate name. The maximum number of qubits is 4 due to current restrictions of UInt8
. Even if all gates only act on one qubit, that qubit index will determine the dimensionality of the map.
PauliPropagation.createcliffordmap
— Methodcreatecliffordmap(gate_relations::Dict)
Create a Clifford gate map from a dictionary of gate relations which can then be pushed to the global clifford_map
. gate_relations
is a dictionary with pairs like (:X, :X) => (:Z, :X, -1)
, describing the action of the Clifford gate on symbols (including the sign change).
PauliPropagation.reset_clifford_map!
— Methodreset_clifford_map!()
Reset global clifford_map
to the CLifford gate implemented by default.
PauliPropagation.transposecliffordmap
— Methodtransposecliffordmap(map_array::Vector{Tuple{UInt8,Int}})
Transpose the Clifford gate maparray
so that the output map is the inverse of the input map. For example, transposecliffordmap(clifford_map[:H])
returns the map for the inverse of the Hadamard gate, which is the same map.
PauliPropagation.clifford_map
— Constantclifford_map
Global dictionary of Clifford gates and their action on Pauli strings. Currently supported Clifford gates are :H
, :X
, :Y
, :Z
, :SX
, :SY
, :S
(:SZ
) , :CNOT
, :CZ
, :ZZpihalf
, and :SWAP
. If one indexes into the returned arrays with the integer that corresponds to the partial Pauli string, the returned tuple is (sign, partial_pstr)
where sign
is the sign change and partial_pstr
is the new partial Pauli string.
Pauli Rotations
PauliPropagation.PauliRotation
— TypeA type for a Pauli rotation gate carrying the gate generator and the qubit indices on which it acts.
PauliPropagation.PauliRotation
— MethodPauliRotation(symbols, qinds, theta)
Constructor for a frozen PauliRotation
generated by the Pauli string symbols
acting on the qubits qinds
, and with fixed parameter theta
.
PauliPropagation.PauliRotation
— MethodPauliRotation(symbols::Vector{Symbol}, qinds::Vector{Int})
PauliRotation(symbol::Symbol, qind::Int)
A parametrized Pauli rotation generated by the Pauli string symbols
acting on the qubits qinds
. For example PauliRotation(:X, 2) or PauliRotation([:X, :Y], [1, 2]). We follow the convention that those rotation are equivalent by conjugation of
\[e^{-i θ/2 P}\]
where P
is the corresponding Pauli operator.
PauliPropagation.commutes
— Methodcommutes(gate::PauliRotation, pstr::Integer)
Check if a PauliRotation
commutes with an integer Pauli string.
PauliPropagation.commutes
— Methodcommutes(gate::PauliRotation, pstr::PauliString)
Check if a PauliRotation
commutes with a PauliString
.
PauliPropagation.tomatrix
— Methodtomatrix(gate::PauliRotation, theta)
Compute the unitary matrix for the PauliRotation
gate with parameter theta
in the computational 0/1 basis. This is done by computing the matrix U = cos(θ/2) I - i sin(θ/2) P
where P
is the Pauli matrix corresponding to the symbols
. The returned unitary is returned in Schrödinger picture form.
Noise Channels
PauliPropagation.AmplitudeDampingNoise
— TypeA type for an amplitude damping noise channel carrying the qubit index on which it acts.
PauliPropagation.AmplitudeDampingNoise
— MethodAmplitudeDampingNoise(qind::Int)
AmplitudeDampingNoise(qind::Int, gamma::Real)
An amplitude damping noise channel acting on the qubit at index qind
. If gamma
is provided, this returns a frozen gate with that noise strength. Damps X and Y Paulis by a factor of sqrt(1-gamma) and splits Z into and gamma * I and (1-gamma) * Z component (in the transposed Heisenberg picture).
PauliPropagation.DephasingNoise
— TypeDephasingNoise(qind::Int)
DephasingNoise(qind::Int, p::Real)
This is an alias for PauliZNoise
. If p
is provided, this returns a frozen gate with that noise strength. A dephasing noise channel acting on the qubit at index qind
. Will damp X and Y Paulis equally by a factor of 1-p
.
PauliPropagation.DepolarizingNoise
— TypeA type for a depolarizing noise channel carrying the qubit index on which it acts.
PauliPropagation.DepolarizingNoise
— MethodDepolarizingNoise(qind::Int)
DepolarizingNoise(qind::Int, p::Real)
A depolarizing noise channel acting on the qubit at index qind
. If p
is provided, this returns a frozen gate with that noise strength. Will damp X, Y, and Z Paulis equally by a factor of 1-p
.
PauliPropagation.ParametrizedNoiseChannel
— TypeAbstract type for parametrized noise channels.
PauliPropagation.PauliNoise
— TypeAbstract type for Pauli noise, i.e., noise that is diagonal in Pauli basis.
PauliPropagation.PauliXNoise
— TypeA type for a Pauli X noise channel carrying the qubit index on which it acts.
PauliPropagation.PauliXNoise
— MethodPauliXNoise(qind::Int)
PauliXNoise(qind::Int, p::Real)
A Pauli-X noise channel acting on the qubit at index qind
. If p
is provided, this returns a frozen gate with that noise strength. Will damp Y and Z Paulis equally by a factor of 1-p
. This corresponds to inserting a Pauli X operator into the circuit with probability p/2
.
PauliPropagation.PauliYNoise
— TypeA type for a Pauli Y noise channel carrying the qubit index on which it acts.
PauliPropagation.PauliYNoise
— MethodPauliYNoise(qind::Int)
PauliYNoise(qind::Int, p::Real)
A Pauli-Y noise channel acting on the qubit at index qind
. If p
is provided, this returns a frozen gate with that noise strength. Will damp X and Z Paulis equally by a factor of 1-p
. This corresponds to inserting a Pauli Y operator into the circuit with probability p/2
.
PauliPropagation.PauliZNoise
— TypeA type for a Pauli Z noise channel carrying the qubit index on which it acts.
PauliPropagation.PauliZNoise
— MethodPauliZNoise(qind::Int)
PauliZNoise(qind::Int, p::Real)
A Pauli-Z noise channel acting on the qubit at index qind
. If p
is provided, this returns a frozen gate with that noise strength. Will damp X and Y Paulis equally by a factor of 1-p
. This corresponds to inserting a Pauli Z operator with probability p/2
.
Misc
PauliPropagation.TGate
— MethodTGate(qind::Integer)
Returns a T gate acting on qubit qind
. It acts on qubit qind
like a PauliRotation(:Z, qind)
with angle π/4.
PauliPropagation.TransferMapGate
— TypeTransferMapGate(transfer_map::Vector{Vector{Tuple{PauliStringType,CoeffType}}}, qinds::Vector{Int})
A non-parametrized StaticGate
defined by a transfer map acting on the qubits qinds
. Transfer maps can be constructed manually or generated via totransfermap()
.
PauliPropagation.TransferMapGate
— MethodA constructor for TransferMapGate
that accepts matrix representations in the 0/1 basis or the Pauli basis (a PTM).
PauliPropagation.tomatrix
— Methodtomatrix(gate::TGate)
Compute the unitary matrix for a TGate
. The returned unitary is returned in Schrödinger picture form.
Frozen Gates
PauliPropagation.FrozenGate
— MethodFrozenGate(gate::ParametrizedGate, parameter)
A StaticGate
that wraps a ParametrizedGate
with a fixed parameter. These are used to fix the parameter of ParametrizedGate
at the time of circuit construction. This can be convenient but might exclude this parameter from being, e.g., differentiated by external libraries.
PauliPropagation.freeze
— Methodfreeze(gates::Vector{Gate}, parameters::Vector{Number})
Returns a vector of Gate
s where ParametrizedGate
s are frozen with their parameters
.
PauliPropagation.freeze
— Methodfreeze(gate::ParametrizedGate, parameter)
Returns a FrozenGate
wrapping the gate
with the fixed parameter
.