Gradients

PauliPropagation.rewindgradient!Method
rewindgradient!(circuit, psum::VectorPauliSum, params, overlapfunc; kwargs...)

In-place version of rewindgradient. Only allows the Pauli sum to be a VectorPauliSum.

source
PauliPropagation.rewindgradientMethod
rewindgradient(circuit, psum::AbstractPauliSum, params, overlapfunc; thread=true, kwargs...)

Compute overlapfunc(propagate(circuit, psum, params; kwargs...)) together with its gradient with respect to params, in one paired forward and backward sweep costing O(length(circuit)) gate applications. The only parametrized gates can be PauliRotations. All other gates must not be parametrized or frozen via freeze(gate, param) before inputting to rewindgradient. Noise channels are not supported, frozen or not, because the backward sweep cannot undo them. overlapfunc must be linear in the coefficients of the VectorPauliSum it is handed, e.g. any of overlapwithzero, overlapwithplus, overlapwithcomputational, overlapwithmaxmixed, or overlapwithpaulisum. kwargs are passed on to applymergetruncate! in the forward sweep and the operator side of the backward sweep. Returns (expec, grad).

source