PauliPropagator
Classical simulator for qubit (Pauli) operators.
Accepts a PauliOperator and a Circuit of
qubit gates; see MonomialPropagator for the shared
surface. The cutoff is qubit Pauli weight -- the number of qubits a retained term touches --
so cutoff_type is fixed and read-only here.
Attributes
attributenum_qubitsintNumber of qubits the propagator acts on.
attributen_gatesintNumber of authoring gates ingested into the graph.
A single-Pauli-term gate expands to one graph layer; a multi-term gate expands to
several layers sharing one gate, so n_gates \<= graph_layers. Stays correct after
a graph prefix is consumed by
contract_partially /
propagate.
attributeparameter_mappinglist[int]The parameter mapping owned by the graph, one entry per graph layer.
Entry i is the variational-parameter index driving the i-th graph layer (a
generated Pauli operator), in the same order as the parameter vector passed to
expectation_value.
This is the graph's native (per-Pauli operators)
mapping, which is finer-grained than the per-gate mapping of the authoring
Circuit when gates bundle several Pauli terms.
attributegraph_layersintNumber of evolved Pauli operators (graph layers).
attributenum_modesintNumber of qubits the propagator acts on -- the same value as num_qubits.
The Pauli basis counts one mode per qubit (two slots each), so the inherited
mode-count name and num_qubits never disagree here; prefer num_qubits in
qubit-facing code.
Functions
func__init__(self, initial_operator, initial_state, *, cutoff, schrodinger_cutoff=None, lower_atol=None, upper_atol=None, comm=None) -> NoneInitialize the qubit propagator.
paramselfparaminitial_operatorPauliOperatorInitial qubit operator; its num_qubits sizes the simulator.
paraminitial_statelist[int] | np.ndarrayComputational-basis reference (indices of qubits set to 1).
paramcutoffintMaximum Pauli weight retained during evolution. The fully-paired exception
described on MajoranaPropagator.__init__
still applies.
paramschrodinger_cutoffint | None= NoneNone (default) keeps the Heisenberg picture; an integer selects
the Schrodinger picture and bounds the Pauli weight of the evolved state, including
its initialization from initial_state. Choose it at least as large as cutoff
for comparable accuracy.
paramlower_atolNone | float= NoneMonomials with |coeff| \< lower_atol are discarded during evolution.
paramupper_atolNone | float= NoneMonomials with |coeff| > upper_atol are kept regardless of weight.
paramcommMPI.Comm | None= NoneOptional MPI communicator (must outlive the propagator).
Returns
Nonefuncevolved_operator(self, parameters=None, *, atol=1e-12) -> PauliOperatorReturn the evolved operator as a PauliOperator.
Equivalent to
contract_partially
with inplace=False, without touching the simulator state. The engine hands back raw
symplectic-slot keys; this decodes them into qubit Pauli terms.
paramselfparamparametersParameterValues= NoneVariational parameter values (see
expectation_value).
paramatolfloat= 1e-12Terms with |coeff| \< atol are dropped; 0.0 keeps all of them.
Returns
monoprop.pauli.PauliOperatorThe evolved qubit operator (Heisenberg picture) or evolved state (Schrodinger picture).
funcbuild_graph(self, circuit, *, seed_parameters=None, only_rotate_len_k=None) -> NoneAppend a circuit to the propagation graph.
Builds (or extends) the reusable evolution graph, recording each layer's gate
information (the parameter that drives it and its generator coefficient) so that
later evaluation takes only parameters. The circuit's angle indices are local
(0-based); when extending a non-empty graph they are shifted up onto the
accumulated parameter axis automatically, so each call's circuit is authored
independently.
paramselfparamcircuitCircuitGates to append, as a Circuit.
paramseed_parametersParameterValues= NoneThe full parameter vector covering the whole accumulated graph, used to regenerate the coefficient seed (by contracting the existing graph) so coefficient truncation sees realistic coefficients when extending. Only needed when extending a non-empty graph with coefficient-informed truncation; on the first (or a single) call it defaults to the circuit's own parameters. When omitted while extending, the new layers are built structurally (coefficient truncation is skipped for them); the engine validates the length of an explicit seed.
paramonly_rotate_len_kint | None= NoneIf provided, apply gates to Pauli terms of length <= k in the
evolved operator even if they anticommute. Length is counted in the engine's
slots, not in qubits: X or Y on a qubit costs one slot and Z
costs two, so k ranges up to 2 * num_qubits.
Returns
Nonefuncupdate_initial_operator(self, new_operator) -> NoneReplace the initial operator (existing terms only).
Re-weights the initial operator the graph is evaluated against, without touching
the evolution graph or rebuilding the simulator. Only the initial operator is
affected -- the gates and their generator coefficients are unchanged. Unlike the
base method, which takes the engine's raw symplectic-slot keys, this accepts qubit Pauli
terms and encodes them via
get_local_operator.
paramselfparamnew_operatorPauliOperatorA PauliOperator whose terms replace the
matching initial-operator coefficients.
Returns
Nonefuncsize(self) -> intNumber of Pauli operators currently tracked.
paramselfReturns
intThe number of distinct Pauli operators in the simulator's current representation.