Propagation

Generics

PauliPropagation.applyMethod
apply(gate::StaticGate, pstr, coeff, theta)

Calling apply on a StaticGate will dispatch to a 3-argument apply function without the paramter theta. If a 4-argument apply function is defined for a concrete type, it will still dispatch to that one. See the 4-custom-gates.ipynb for examples of how to define custom gates.

source
PauliPropagation.applyandadd!Method
applyandadd!(gate, pstr, coefficient, theta, output_psum; kwargs...)

3rd-level function below applymergetruncate! that applies one gate to one Pauli string in psum, moving results into output_psum by default. This function can be overwritten for a custom gate if the lower-level function apply is not sufficient. This is likely the the case if apply is not type-stable because it does not return a unique number of outputs. E.g., a Pauli gate returns 1 or 2 (pstr, coefficient) outputs. See the 4-custom-gates.ipynb for examples of how to define custom gates.

source
PauliPropagation.applymergetruncate!Method
applymergetruncate!(gate, psum, aux_psum, thetas, param_idx; max_weight=Inf, min_abs_coeff=1e-10, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)

1st-level function below propagate! that applies one gate to all Pauli strings in psum, potentially using aux_psum in the process, and merges everything back into psum. Truncations are checked here after merging. This function can be overwritten for a custom gate if the lower-level functions applytoall!, applyandadd!, and apply are not sufficient.

source
PauliPropagation.applytoall!Method
applytoall!(gate, theta psum, output_psum; kwargs...)

2nd-level function below applymergetruncate! that applies one gate to all Pauli strings in psum, moving results into output_psum by default. After this functions, Pauli strings in remaining in psum and output_psum are merged. This function can be overwritten for a custom gate if the lower-level functions applyandadd! and apply are not sufficient. In particular, this function can be used to manipulate both psum and output_psum at the same time to reduce memory movement. Note that manipulating psum on anything other than the current Pauli string will likely lead to errors. See the 4-custom-gates.ipynb for examples of how to define custom gates.

source
PauliPropagation.propagateFunction
propagate(circ, pstr::PauliString, thetas=nothing; max_weight=Inf, min_abs_coeff=1e-10, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)

Propagate a PauliString through the circuit circ in the Heisenberg picture. This means that the circuit is applied to the Pauli string in reverse order, and the action of each gate is its conjugate action. Parameters for the parametrized gates in circ are given by thetas, and need to be passed as if the circuit was applied as written in the Schrödinger picture. If thetas are not passed, the circuit must contain only non-parametrized StaticGates. Default truncations are max_weight, min_abs_coeff, max_freq, and max_sins. max_freq, and max_sins will lead to automatic conversion if the coefficients are not already wrapped in suitable PathProperties objects. A custom truncation function can be passed as customtruncfunc with the signature customtruncfunc(pstr::PauliStringType, coefficient)::Bool. Further kwargs are passed to the lower-level functions applymergetruncate!, applytoall!, applyandadd!, and apply.

source
PauliPropagation.propagateFunction
propagate(circ, psum::PauliSum, thetas=nothing; max_weight=Inf, min_abs_coeff=1e-10, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)

Propagate a PauliSum through the circuit circ in the Heisenberg picture. This means that the circuit is applied to the Pauli sum in reverse order, and the action of each gate is its conjugate action. Parameters for the parametrized gates in circ are given by thetas, and need to be passed as if the circuit was applied as written in the Schrödinger picture. If thetas are not passed, the circuit must contain only non-parametrized StaticGates. Default truncations are max_weight, min_abs_coeff, max_freq, and max_sins. max_freq, and max_sins will lead to automatic conversion if the coefficients are not already wrapped in suitable PathProperties objects. A custom truncation function can be passed as customtruncfunc with the signature customtruncfunc(pstr::PauliStringType, coefficient)::Bool. Further kwargs are passed to the lower-level functions applymergetruncate!, applytoall!, applyandadd!, and apply.

source
PauliPropagation.propagate!Function
propagate!(circ, psum::PauliSum, thetas=nothing; max_weight=Inf, min_abs_coeff=1e-10, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)

Propagate a Pauli sum through the circuit circ in the Heisenberg picture. This means that the circuit is applied to the Pauli sum in reverse order, and the action of each gate is its conjugate action. The input psum will be modified. Parameters for the parametrized gates in circ are given by thetas, and need to be passed as if the circuit was applied as written in the Schrödinger picture. If thetas are not passed, the circuit must contain only non-parametrized StaticGates. Default truncations are max_weight, min_abs_coeff, max_freq, and max_sins. max_freq, and max_sins can only be used with suitable PathProperties coefficients like PauliFreqTracker. A custom truncation function can be passed as customtruncfunc with the signature customtruncfunc(pstr::PauliStringType, coefficient)::Bool. Further kwargs are passed to the lower-level functions applymergetruncate!, applytoall!, applyandadd!, and apply.

source

Specializations

PauliPropagation.applyMethod
apply(gate::CliffordGate, pstr::PauliStringType, coeff)

Apply a CliffordGate to an integer Pauli string and its coefficient.

source
PauliPropagation.applyMethod
apply(gate::TransferMapGate, pstr, coeff)

Apply a TransferMapGate to an integer Pauli string and its coefficient. The outcomes are determined by the transfer_map of the gate.

source
PauliPropagation.applyandadd!Method
applyandadd!(gate::CliffordGate, pstr, coeff, theta, output_psum; kwargs...)

Overload of applyandadd! for CliffordGate gates. Use set!() instead of add!() because Clifford gates create non-overlapping Pauli strings. applytoall! does not need to be adapted.

source
PauliPropagation.applytoall!Method
applytoall!(gate::AmplitudeDampingNoise, theta, psum, aux_psum; kwargs...)

Overload of applytoall! for AmplitudeDampingNoise gates. It fixes the type-instability of the apply() function and reduces moving Pauli strings between psum and auxpsum. psum and `auxpsum` are merged later.

source
PauliPropagation.applytoall!Method
applytoall!(gate::FrozenGate, thetas, psum, aux_psum; kwargs...)

Overload of applytoall! for FrozenGates. Re-directs to applytoall! for the wrapped FrozenGate.gate with the frozen parameter.

source
PauliPropagation.applytoall!Method
applytoall!(gate::PauliNoise, p, psum, aux_psum; kwargs...)

Overload of applytoall! for PauliNoise gates with noise strength p. It changes the coefficients in-place and does not require the aux_psum, which stays empty.

source
PauliPropagation.applytoall!Method
applytoall!(gate::PauliRotation, theta, psum, aux_psum; kwargs...)

Overload of applytoall! for PauliRotation gates. It fixes the type-instability of the apply() function and reduces moving Pauli strings between psum and aux_psum. psum and aux_psum are merged later.

source
PauliPropagation.applytoall!Method
applytoall!(gate::TGate, thetas, psum, aux_psum; kwargs...)

Overload of applytoall!() for TGate(qind). Redirects to a PauliRotation(:Z, qind) with angle π/4.

source
PauliPropagation.getnewpaulistringMethod
getnewpaulistring(gate::MaskedPauliRotation, pstr::PauliStringType)

Get the new Pauli string after applying a MaskedPauliRotation to an integer Pauli string, as well as the corresponding ±1 coefficient.

source