Dynamical decoupling for Linear schedules¶
Dynamical decoupling (DD) adds control pulses to a compiled schedule to reduce the phase accumulated by idle ions. The Linear backend provides four methods:
Method |
Intended use |
Hardware constraints |
|---|---|---|
Shuttling-aware DD (SADD) |
Producing a schedule intended for execution |
Respects control locations and may add transport |
Nearest Hahn reference |
Measuring what unmodified transport already allows |
Respects control locations and adds no transport |
Idealized Hahn reference |
Estimating the benefit of unrestricted control |
Deliberately ignores where local pulses can be applied |
Periodic global DD |
Applying one pulse to all ions at regular spacing |
Uses schedule-wide global pulses |
Each method leaves its input unchanged and returns its transformed artifact with
a method-specific report. SADD accepts a compilation result and returns a
SADDResult, whose result remains a
complete, visualizable compilation artifact. The reference methods currently
operate directly on schedules and return
DDPassResult.
Installation¶
The Hahn references and the global method use the standard installation. SADD also requires OR-Tools:
uv pip install "mqt.ionshuttler[dd]"
OR-Tools is loaded only when SADD reaches an optimization opportunity.
Compile a circuit¶
The examples compile a depth-2 four-qubit circuit for a six-site architecture with one two-site processing zone. Executing the circuit requires both transport and idle time, giving the DD passes a nontrivial schedule to work with.
1from collections import Counter
2from dataclasses import replace
3
4from qiskit import QuantumCircuit
5
6from mqt.ionshuttler.linear import LinearArchitecture, LinearCompiler
7from mqt.ionshuttler.core.gates import GlobalGate
8from mqt.ionshuttler.linear.actions import DEFAULT_ACTION_TYPES
9from mqt.ionshuttler.linear.dd import compute_critical_segments
10from mqt.ionshuttler.linear.field_profile import FieldProfile
11
12compilation_architecture = LinearArchitecture(
13 num_sites=6,
14 processing_zones={"pz": [2, 3]},
15 field_profile=FieldProfile(
16 6,
17 (
18 (0, 4.0),
19 (1, 3.0),
20 (2, 1.0),
21 (3, 1.0),
22 (4, 3.0),
23 (5, 4.0),
24 ),
25 ),
26)
27
28circuit = QuantumCircuit(4)
29circuit.rx(0.25, 0)
30circuit.ry(0.5, 1)
31circuit.rzz(0.75, 0, 1)
32circuit.rzz(0.5, 2, 3)
33circuit.rx(0.25, 2)
34
35compilation = LinearCompiler(compilation_architecture).compile(circuit)
36schedule = compilation.schedule
37dd_architecture = replace(
38 compilation.architecture,
39 supported_action_types=(*DEFAULT_ACTION_TYPES, GlobalGate),
40)
41{
42 "circuit_depth": circuit.depth(),
43 "status": compilation.status.value,
44 "timesteps": schedule.duration,
45 "actions": dict(Counter(type(action).__name__ for action in schedule.path)),
46}
{'circuit_depth': 2,
'status': 'SUCCESS',
'timesteps': 15,
'actions': {'Shuttle': 8, 'Rx': 2, 'Ry': 1, 'Rzz': 2, 'PhysicalSwap': 2}}
Phase metric¶
Dephasing is modeled as quasistatic, site-dependent longitudinal \(Z\)-phase accumulation. A refocusing pulse reverses the sign of subsequent accumulation, allowing positive and negative contributions to cancel.
The phase is evaluated at critical points: logical gates that rotate the
accumulated phase out of the longitudinal axis and therefore terminate a
phase-coherent segment. Residual phase at these points is considered detrimental
to execution fidelity and is used as a cost and comparison metric by the DD
methods. The implementation exposes this as phase_cost; it corresponds to
\(J_\phi\), the sum of squared residual phases over all critical segments:
1baseline = compute_critical_segments(schedule, dd_architecture)
2{"critical_segments": len(baseline.segments), "phase_cost": round(baseline.phase_cost, 3)}
{'critical_segments': 7, 'phase_cost': 439.269}
Smaller values indicate less residual phase under this model. The value is a schedule-comparison metric, not a complete noisy-circuit fidelity estimate.
Shuttling-aware dynamical decoupling¶
SADDMethod.PULSE_ONLY adds local pulses without changing transport.
SADDMethod.FULL may also move ions to and from control sites. Both variants
use the same SADD backend (publication pending).
1from mqt.ionshuttler.linear.dd import SADDConfig, SADDMethod, run_sadd
2
3sadd = run_sadd(
4 compilation,
5 SADDMethod.FULL,
6 SADDConfig(max_accepted_windows=1, num_search_workers=1),
7 architecture=dd_architecture,
8)
9opportunity = next(record for record in sadd.report.opportunities if record.accepted)
10{
11 "window": opportunity.window,
12 "status": opportunity.status,
13 "eligible_ions": opportunity.eligible_ions,
14 "participating_ions": opportunity.participating_ions,
15 "pulse_timesteps": dict(opportunity.pulse_timesteps or {}),
16 "transport_delta": dict(opportunity.transport_delta),
17 "phase_cost_before": round(opportunity.phase_cost_before, 3),
18 "phase_cost_after": round(opportunity.phase_cost_after or 0.0, 3),
19}
{'window': (5, 12),
'status': 'OPTIMAL',
'eligible_ions': (3, 0, 1, 2),
'participating_ions': (3, 0, 1, 2),
'pulse_timesteps': {0: (7,), 1: (), 2: (9,), 3: ()},
'transport_delta': {'Shuttle': 6},
'phase_cost_before': 438.577,
'phase_cost_after': 347.423}
The default SADDConfig uses the current
paper configuration: windows of 2–16 timesteps, at most five ions per window, a
one-second timeout, phase-based ion ordering, chronological windows, and eight
solver workers. Synthesized shuttles, swaps, and local pulses take the durations
of the architecture: its transport_timing and its rx gate timing. SADD
requires a physical rx pulse with a positive duration.
The opportunity records expose the solver status, whether a proposal was
accepted, its objective values, and the inserted pulse and transport actions.
transport_delta gives the signed change in transport actions by type relative
to the schedule entering that opportunity. Runtime and model-size fields are
diagnostic and may vary between runs.
Both compilation stages can be plotted without rebuilding a result wrapper:
from mqt.ionshuttler import visualize
visualize(compilation).savefig("compiled.png", dpi=150)
visualize(sadd.result).savefig("compiled_sadd.png", dpi=150)
Idealized Hahn reference¶
The idealized Hahn pass inserts local refocusing sequences without enforcing where or alongside which operations the pulses can be applied. It provides a comparison point rather than an executable hardware schedule.
By default it places a single pulse at each idle window’s midpoint. The Pauli
frame that pulse introduces is not undone by a second physical pulse; it
persists and is discharged virtually by a consumer that corrects the terminal
frame. Set include_terminating_pulse=True for the closing-pulse variant, which
returns the frame to the identity at the cost of a second pulse per window.
1from mqt.ionshuttler.linear.dd import IdealizedHahnConfig, apply_idealized_hahn
2
3hahn = apply_idealized_hahn(
4 schedule,
5 dd_architecture,
6 IdealizedHahnConfig(min_idle_timesteps=11),
7)
8hahn_pulse_ids = frozenset(
9 action_id
10 for sequence in hahn.report.sequences
11 for action_id in sequence.action_ids
12)
13{
14 "sequences": len(hahn.report.sequences),
15 "pulse_timesteps": hahn.report.sequences[0].pulse_timesteps,
16}
{'sequences': 2, 'pulse_timesteps': (6,)}
The minimum idle-window length restricts this short example to its two longest idle intervals. The default processes every idle interval long enough to hold the selected pulse sequence.
Nearest Hahn reference¶
Nearest Hahn places one X pulse as close to each idle window’s midpoint as the compiled trajectory already permits. It uses only processing-zone access the ion already has, inserts no transport, and never extends the makespan, so unlike the idealized reference every schedule it returns is executable on the given architecture. Its frame also persists and is corrected virtually.
1from mqt.ionshuttler.linear.dd import NearestHahnConfig, run_nearest_hahn
2
3nearest = run_nearest_hahn(schedule, dd_architecture, NearestHahnConfig())
4nearest_pulse_ids = frozenset(
5 action_id
6 for sequence in nearest.report.sequences
7 for action_id in sequence.action_ids
8)
9{
10 "placed": nearest.report.placed,
11 "eligible_windows": len(nearest.report.opportunities),
12 "statuses": sorted({record.status for record in nearest.report.opportunities}),
13}
{'placed': 1, 'eligible_windows': 5, 'statuses': ['shifted', 'skipped']}
Every eligible window appears in opportunities, including the ones that
received no pulse. A skipped window records why: the ion never reached a
processing zone, the ion was busy, or the zone was occupied. A placed pulse
records its displacement from the ideal midpoint, so a comparison can separate
windows the hardware served exactly from windows it served only approximately.
1[
2 {
3 "ion": record.ion,
4 "window": record.window,
5 "status": record.status,
6 "selected_timestep": record.selected_timestep,
7 "signed_displacement": record.signed_displacement,
8 "skip_reason": record.skip_reason,
9 }
10 for record in nearest.report.opportunities
11]
[{'ion': 1,
'window': (0, 2),
'status': 'skipped',
'selected_timestep': None,
'signed_displacement': None,
'skip_reason': 'processing_zone_busy'},
{'ion': 2,
'window': (0, 12),
'status': 'shifted',
'selected_timestep': 9,
'signed_displacement': 3,
'skip_reason': None},
{'ion': 3,
'window': (0, 12),
'status': 'skipped',
'selected_timestep': None,
'signed_displacement': None,
'skip_reason': 'ion_busy'},
{'ion': 0,
'window': (5, 15),
'status': 'skipped',
'selected_timestep': None,
'signed_displacement': None,
'skip_reason': 'no_processing_zone_access'},
{'ion': 1,
'window': (5, 15),
'status': 'skipped',
'selected_timestep': None,
'signed_displacement': None,
'skip_reason': 'ion_busy'}]
Periodic global DD¶
Periodic global DD inserts X pulses that act on all ions. Each pulse is a
GlobalGate with gate_name="rx" whose
ions list every ion of the schedule, and it takes the architecture’s ordinary
rx duration. spacing sets the nominal separation of the pulses. A nonzero
shift_range allows small position adjustments that minimize the same
critical-segment \(J_\phi\) metric used by SADD.
1from mqt.ionshuttler.linear.dd import GlobalDDConfig, apply_periodic_global_dd
2
3global_dd = apply_periodic_global_dd(schedule, dd_architecture, GlobalDDConfig(spacing=10))
4{
5 "pulse_timesteps": global_dd.report.pulse_timesteps,
6 "phase_cost": round(global_dd.report.phase_cost, 3),
7}
{'pulse_timesteps': (5,), 'phase_cost': 124.962}
The ten-timestep spacing inserts one global pulse in this 15-timestep schedule. Shorter spacing would assume a substantially higher global control rate.
The base circuit was compiled before GlobalGate was added to the architecture
catalog. The DD pass accepts the extended architecture because the original
schedule remains valid on it. It would reject an architecture without
GlobalGate or one that cannot execute the existing schedule.
Frame replay also accepts a global gate that targets only some ions of the
schedule, such as GlobalGate(gate_name="rx", theta=pi, ions=(0, 2)). Such a
pulse changes only the frames of its target ions.
Comparing results¶
Local DD pulses use ordinary single-qubit actions. Pass their report-owned action IDs to the phase analysis so they are not interpreted as logical gates:
1sadd_pulse_ids = frozenset(
2 action_id
3 for sequence in sadd.report.sequences
4 for action_id in sequence.action_ids
5)
6
7{
8 "without_dd": round(compute_critical_segments(schedule, dd_architecture).phase_cost, 3),
9 "sadd": round(
10 compute_critical_segments(
11 sadd.result.schedule,
12 dd_architecture,
13 local_pulse_action_ids=sadd_pulse_ids,
14 ).phase_cost,
15 3,
16 ),
17 "nearest_hahn": round(
18 compute_critical_segments(
19 nearest.schedule,
20 dd_architecture,
21 local_pulse_action_ids=nearest_pulse_ids,
22 ).phase_cost,
23 3,
24 ),
25 "idealized_hahn": round(
26 compute_critical_segments(
27 hahn.schedule,
28 dd_architecture,
29 local_pulse_action_ids=hahn_pulse_ids,
30 ).phase_cost,
31 3,
32 ),
33 "global_dd": round(global_dd.report.phase_cost, 3),
34}
{'without_dd': 439.269,
'sadd': 348.115,
'nearest_hahn': 395.423,
'idealized_hahn': 220.962,
'global_dd': 124.962}
Use the same field profile and metric settings for all schedules in a comparison. These values do not compare methods under equal control constraints. SADD and Nearest Hahn respect the hardware’s control access, so their numbers are achievable. Idealized Hahn assumes unconstrained local pulses and global DD assumes schedule-wide pulses; both reflect substantially relaxed control assumptions and are reference points, not competing implementations.
Limitations¶
Equal-quality SADD solutions may place pulses differently; compare their validity and objective values rather than one exact placement.
The idealized Hahn result is intentionally not hardware constrained.
Both Hahn references leave a persistent Pauli frame by default. A consumer that does not correct the terminal frame will misread their results.
These phase metrics are comparison proxies. Full noisy-circuit simulation is provided by a separate simulation layer.
See also¶
Linear Compiler — compile circuits into schedules
Hardware Models — define sites, processing zones, timing, and field profiles
mqt.ionshuttler.linear.dd — consult the complete DD Python API