Skip to main content

Module decompose

Module decompose 

Source
Expand description

Circuit decomposition transforms and synthesis building blocks.

This module separates decomposition by the representation that is available for an operation:

  • definition expands gates that already carry an implementation circuit. Use this first for CircuitGate and circuit-backed UnitaryGate operations.
  • unitary synthesizes remaining custom UnitaryGate operations from fixed numeric matrices. It currently supports one- and two-qubit matrices.
  • mc_gate provides explicit algorithmic synthesis primitives for multi-controlled gates, plus the circuit-level resource-aware decompose_mc_gates entry point.

The workflow-facing adapters DecomposeDefinitions, DecomposeUnitaries, and DecomposeMcGates implement Transformer. They are expected to report changed = false when no operation in their scope was lowered.

Run definition expansion before matrix synthesis so circuit-backed unitary gates are expanded before the matrix-only decompose_unitaries stage is reached. Run multi-controlled gate decomposition after unitary synthesis so the circuit-level planner can apply resource policy and control-flow traversal to the remaining high-level controlled operations.

These are decomposition entry points, not a complete compiler pipeline. Target-basis lowering belongs to rewrite, initial placement belongs to layout, and SWAP insertion belongs to routing. Directed-coupling legalization and scheduling are separate compiler concerns.

Re-exports§

pub use definition::DecomposeDefinitions;
pub use definition::expand_definitions;
pub use mc_gate::DecomposeMcGates;
pub use mc_gate::McGateDecomposeConfig;
pub use mc_gate::decompose_mc_gates;
pub use mc_gate::decompose_mc_gates_with_rule_stats;
pub use rule::DecompositionAlgorithm;
pub use rule::DecompositionRule;
pub use rule::DecompositionRuleCache;
pub use rule::DecompositionRuleStats;
pub use rule::McGateRuleRequest;
pub use rule::NumericUnitaryRuleRequest;
pub use rule::NumericUnitarySynthesisKey;
pub use rule::ResourceSignature;
pub use rule::RuntimeAncillaKind;
pub use unitary::decompose::DecomposeUnitaries;
pub use unitary::decompose::UnitaryDecomposeConfig;
pub use unitary::decompose::decompose_unitaries;
pub use unitary::decompose::decompose_unitaries_with_rule_stats;

Modules§

definition
Definition-based decomposition.
mc_gate
Multi-controlled gate decomposition.
rule
Runtime decomposition rules.
unitary
Numeric synthesis for matrix-backed custom unitary gates.