monoprop

Circuit

A variational circuit: an ordered sequence of exponential gates, angles, and a state.

All gates must share a family (see ExpGate). Empty parameters means unbound; a bound circuit needs exactly n_parameters values.

The per-gate index values give the parameter mapping: with none set, each gate gets its own angle in order; otherwise every gate must set a contiguous 0..n-1 index, and gates sharing an index share an angle.

Attributes

attribute_state_given
= initial_state is not None
attributegates
= gates

The ordered exponential gates.

attributeparameters
= parameters

The angle values, or empty for an unbound circuit.

attributeinitial_state
= initial_state

The reference state (occupied mode / qubit indices).

attributefamily
= self._resolve_family(gates)

"pauli", "majorana", or "empty"; the propagators dispatch on it.

attribute__hash__
= None
attributeresolved_mappingtuple[int, ...]

Per-gate angle index, derived from each gate's index (see Circuit).

attributen_parametersint

Number of distinct variational angles the circuit references.

Functions

func__init__(self, gates=(), parameters=(), initial_state=None) -> None

Build the circuit, dropping identity gates and validating family/mapping/params.

paramself
paramgatesSequence[ExpGate]
= ()

The ordered exponential gates.

paramparametersSequence[float]
= ()

The angle values, or empty for an unbound circuit.

paraminitial_stateSequence[int] | None
= None

The reference state (occupied mode / qubit indices), or None to defer to the propagator's. () is not None: it is the explicit vacuum, and a propagator built against a different reference rejects it.

Returns

None
func__eq__(self, other) -> bool

Equal when gates, parameters, and initial state match (family is derived).

paramself
paramotherobject

Returns

bool
func__repr__(self) -> str

Return a string representation listing the gates, parameters, and initial state.

paramself

Returns

str
func__len__(self) -> int

Number of gates.

paramself

Returns

int
func__iter__(self) -> Iterator[ExpGate]

Iterate over the gates in application order.

paramself

Returns

collections.abc.Iterator[monoprop.circuit.ExpGate]
func__add__(self, other) -> Circuit

Concatenate two circuits of the same family, appending other's angles.

other's angle indices are shifted up by self.n_parameters, so the two halves keep independent angles and every gate in the result gets an explicit index. Prefer one MonomialPropagator.build_graph call over incremental multi-call building, whose ordering is picture-dependent.

paramself
paramotherCircuit

Returns

monoprop.circuit.Circuit
funcfrom_dense_arrays(cls, majoranas, gen_coeffs, param_inds, parameters=(), initial_state=None) -> Circuit

Build a Majorana circuit from flat, per-monomial dense arrays.

The native dense/wire format (also the on-disk msgpack-fixture layout): consecutive monomials sharing a param_ind become one Majorana ExpGate with that param_ind as its index, so weight-tying is preserved and the expanded engine arrays stay identical.

paramcls
parammajoranasSequence[Sequence[int]]

One Majorana-index sequence per monomial.

paramgen_coeffsSequence[float]

Generator coefficient per monomial (already structural).

paramparam_indsSequence[int]

Variational-angle index per monomial; contiguous runs group into gates.

paramparametersSequence[float]
= ()

Optional angle values.

paraminitial_stateSequence[int] | None
= None

Reference state (occupied mode indices), or None to defer to the propagator's. () is the explicit vacuum, exactly as in the constructor -- the wire format has no third state, so a caller round-tripping it decides which of the two an absent field means.

Returns

monoprop.circuit.Circuit

On this page