SpecStage

class SpecStage(name)[source]

Bases: Stage[InT, dict[tuple[tuple[str, Hashable], …], MetaCircuit]], ABC

First stage in every pipeline: converts an arbitrary spec into a keyed MetaCircuit batch.

Examples

  • CircuitSpecStage: wraps one or more pre-built MetaCircuit instances into a batch (by position or by name).

  • TrotterSpecStage: takes a Hamiltonian and decomposes it into one or more MetaCircuit entries via a trotterization factory.

Methods Summary

expand(batch, env)

Transform input (e.g. Hamiltonian) into a keyed batch of MetaCircuits.

reduce(results, env, token)

Identity by default; override if this stage reduces results.

Methods Documentation

abstractmethod expand(batch, env)[source]

Transform input (e.g. Hamiltonian) into a keyed batch of MetaCircuits.

Return type:

tuple[dict[tuple[tuple[str, Hashable], ...], MetaCircuit], Any]

reduce(results, env, token)[source]

Identity by default; override if this stage reduces results.

Return type:

dict[Any, Any]