Surrogate
Datatypes
PauliPropagation.CircuitNode — TypeAbstract node type for the Pauli propagation Surrogate
PauliPropagation.EvalEndNode — TypeEvalEndNode(pstr::Integer, coefficient::Real)Node type for the Pauli strings in the observable to be backpropagated.
PauliPropagation.EvalEndNode — MethodEvalEndNode(pstr::Integer)Constructor for EvalEndNode with a default coefficient of 1.0.
PauliPropagation.NodePathProperties — TypeNodePathProperties(node::CircuitNode, nsins::Int, ncos::Int, freq::Int)Surrogate PathProperties type. Carries CircuitNodes instead of numerical coefficients.
PauliPropagation.NodePathProperties — MethodNodePathProperties(node::CircuitNode)One-argument constructor for NodePathProperties. Initializes nsins, ncos, and freq to 0.
PauliPropagation.PauliRotationNode — TypePauliRotationNode(parents::Vector{Union{EvalEndNode,PauliRotationNode}}, trig_inds::Vector{Int}, signs::Vector{Int}, param_idx::Int)Surrogate graph node for a Pauli rotation gate.
Base.show — MethodPretty print for PauliFreqTracker
Base.show — MethodPretty print for CircuitNode
Base.show — MethodPretty print for EvalEndNode
PauliPropagation.set! — Methodset!(psum::Dict{TermType, NodePathProperties}, pstr::TermType, path::NodePathProperties)In-place setting the coefficient of a Pauli string in a Pauli sum dictionary. The type of the Pauli string needs to be the keytype=TermType of the dictionary, and the coefficient coeff needs to be the valuetype=NodePathProperties. If the coefficient is 0, the Pauli string is removed from the dictionary.
PauliPropagation.tonumber — Methodtonumber(path::NodePathProperties)Get the cummulative coefficient of a NodePathProperties node. This assumes that the surrogate has already been evaluated.
PauliPropagation.wrapcoefficients — Methodwrapcoefficients(pstr::PauliString, ::Type{NodePathProperties})Wrap the coefficient of a PauliString into NodePathProperties.
PauliPropagation.wrapcoefficients — Methodwrapcoefficients(psum::PauliSum, ::Type{NodePathProperties})Wrap the coefficients of a PauliSum into NodePathProperties.
Evaluate
PauliPropagation._traceevalorder — Method_traceevalorder(node::EvalEndNode, thetas; eval_list=nothing)Evaluates the observable's coefficient. This function likely does not need to be called manually.
PauliPropagation._traceevalorder — Method_traceevalorder(node::PauliRotationNode, thetas; eval_list=nothing)Evaluate the coefficient of node on the Surrogate by recursively evaluating all parents. thetas are the parameters of the circuit. NOTE: This requires calling resetnodes in-between evaluations with different thetas. eval_list does not need to be passed when manually using this function.
PauliPropagation._traceevalorder — Method_traceevalorder(nodes::Vector{<:CircuitNode}, thetas)Evaluate the sum of coefficients of a vector of CircuitNode on the Surrogate. This will be evaluated in parallel with recursive evaluation of the parents. NOTE: This requires calling resetnodes in-between evaluations with different thetas.
PauliPropagation.evaluate! — Methodevaluate!(psum::PauliSum{TermType,NodePathProperties}, thetas)Evaluate the expectation value of a Surrogate by evaluating all involved circuit nodes in the correct order. eval_list can be attained as the output of gettraceevalorder()
PauliPropagation.expectation — Methodexpectation(eval_list::Vector{<:CircuitNode}, thetas)Evaluate the expectation value of a Surrogate by evaluating all involved circuit nodes in the correct order. eval_list can be attained as the output of gettraceevalorder()
PauliPropagation.gettraceevalorder — Methodgettraceevalorder(node::CircuitNode, thetas)Return a vector of CircuitNodes in the order they should be evaluated to get the correct cummulative result on node. thetas numerically plays no role here but it needs to be the correct length given the number of parametrized gates.
PauliPropagation.reset! — Methodreset!(circuit_node::CircuitNode)Reset a CircuitNode in a the Surrogate. Needs to be done in-between evaluatios with different parameters.
PauliPropagation.reset! — Methodreset!(end_node::EvalEndNode)Reset a EvalEndNode in a the Surrogate. Needs to be done in-between evaluatios with different parameters.
PauliPropagation.reset! — Methodreset!(eval_list::Vector{<:CircuitNode})Resets a vector of CircuitNodes.
PauliPropagation.reset! — Methodreset!(psum::PauliSum{TermType, NodePathProperties})Reset the nodes in a the Surrogate. Needs to be done in-between evaluatios with different parameters.
Propagate
PauliPropagation.apply — Methodapply(gate::CliffordGate, pstr::PauliStringType, coeff::NodePathProperties)Apply a CliffordGate to an integer Pauli string and NodePathProperties coefficient.
PauliPropagation.propagate! — Methodpropagate!(circ, psum::PauliSum{PauliStringType,NodePathProperties}; max_weight=Inf, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)Construct a Pauli propagation surrogate of the propagated PauliSum through the circuit circ in the Heisenberg picture. The PauliSum psum is modified in place. The circuit must only contain CliffordGates and PauliRotations. It 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. Default truncations are max_weight, max_freq, and max_sins. 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.
PauliPropagation.propagate — Methodpropagate(circ, pstr::PauliString{PauliStringType,NodePathProperties}; max_weight=Inf, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)Construct a Pauli propagation surrogate of the propagated PauliString through the circuit circ in the Heisenberg picture. The circuit must only contain CliffordGates and PauliRotations. It is applied to the Pauli string in reverse order, and the action of each gate is its conjugate action. Default truncations are max_weight, max_freq, and max_sins. 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.
PauliPropagation.propagate — Methodpropagate(circ, psum::PauliSum{PauliStringType,NodePathProperties}; max_weight=Inf, max_freq=Inf, max_sins=Inf, customtruncfunc=nothing, kwargs...)Construct a Pauli propagation surrogate of the propagated PauliSum through the circuit circ in the Heisenberg picture. The circuit must only contain CliffordGates and PauliRotations. It is applied to the Pauli sum in reverse order, and the action of each gate is its conjugate action. Default truncations are max_weight, max_freq, and max_sins. 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.