mimiqcircuits.backends.compiled¶
Compiled-circuit types and the metadata they carry.
LocalBackend.compile() turns a Circuit into a
backend-specific CompiledCircuit. The compile step must be
pure: no RNG, no sampling. Stochastic per-trajectory work belongs in
LocalBackend.prepare_trajectory().
Every compiled circuit carries a CompileMetadata (read via
its metadata attribute) so generic drivers can read measurement
analysis, qubit permutations, and other compile-time side effects
without unpacking a tuple.
Concrete types:
DefaultCompiledCircuit— generic passthrough wrap when the backend’s lowering already returns its final compiled form.CompiledParametricCircuit— compiled artifact that still holds free symbolic parameters; resolve them viaLocalBackend.bind().
Classes
|
Compile-time side effects carried alongside a |
Backend-specific deterministic representation of a circuit. |
|
|
Compiled artifact that still carries free symbolic parameters. |
|
Generic passthrough wrapper. |
Exceptions
|
Raised when |
- class mimiqcircuits.backends.compiled.CompileMetadata(measures=<factory>, active_qubits=<factory>, qubit_flips=<factory>, qubit_permutation=None, measure_action_counts=<factory>, prefix_endpoint=0)[source]¶
Bases:
objectCompile-time side effects carried alongside a
CompiledCircuit.- measures¶
Measurement-analysis entries (classifies each classical bit as Unused / Direct / Flip / Const0 / Const1). Empty when analysis has not run.
- Type:
- active_qubits¶
Qubit indices that must be simulated; the others can be dropped because they are provably
|0⟩at measurement.
- qubit_permutation¶
Composed permutation applied by the pass pipeline.
Nonewhen the pipeline is identity on qubit indices.
- measure_action_counts¶
Frequency of each measurement-action branch (debug aid).
- prefix_endpoint¶
Index of the last instruction folded into the deterministic prefix when the backend splits prefix from stochastic suffix;
0when no split applies.- Type:
- __init__(measures=<factory>, active_qubits=<factory>, qubit_flips=<factory>, qubit_permutation=None, measure_action_counts=<factory>, prefix_endpoint=0)¶
- class mimiqcircuits.backends.compiled.CompiledCircuit[source]¶
Bases:
objectBackend-specific deterministic representation of a circuit.
Returned by
LocalBackend.compile(). Concrete backends subclass to carry whatever payload they need — an MPO for an MPS simulator, a plainCircuitfor a state-vector backend, a streaming thunk for an out-of-core simulator, …Every subclass exposes two attributes:
metadata— aCompileMetadatadescribing compile-time side effects;source— the wrapped, backend-specific artifact.
- property metadata: CompileMetadata¶
- property source¶
The backend-specific artifact wrapped by this compiled circuit (e.g. a
Circuit, an MPO, a streaming thunk).
- class mimiqcircuits.backends.compiled.DefaultCompiledCircuit(_source, _metadata=<factory>)[source]¶
Bases:
CompiledCircuitGeneric passthrough wrapper.
Use this when your backend’s
compilestep is effectively the identity — for example a state-vector simulator that consumes the inputCircuitdirectly.- property metadata: CompileMetadata¶
- property source¶
The backend-specific artifact wrapped by this compiled circuit (e.g. a
Circuit, an MPO, a streaming thunk).
- __init__(_source, _metadata=<factory>)¶
- class mimiqcircuits.backends.compiled.CompiledParametricCircuit(_source, _metadata=<factory>)[source]¶
Bases:
CompiledCircuitCompiled artifact that still carries free symbolic parameters.
Produced by
LocalBackend.compile()when the input is symbolic and the backend advertises the"parametric"capability. Resolve the parameters by callingLocalBackend.bind().- property metadata: CompileMetadata¶
- property source¶
The backend-specific artifact wrapped by this compiled circuit (e.g. a
Circuit, an MPO, a streaming thunk).
- __init__(_source, _metadata=<factory>)¶