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 the input ActionSchedule
unchanged and returns a DDPassResult. The
result contains the transformed schedule and a method-specific report.
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 Architecture, LinearCompiler
7from mqt.ionshuttler.linear.actions import DEFAULT_ACTION_TYPES, GlobalPulse
8from mqt.ionshuttler.linear.dd import compute_critical_segments
9from mqt.ionshuttler.linear.field_profile import FieldProfile
10
11compilation_architecture = Architecture(
12 num_sites=6,
13 processing_zones={"pz": [2, 3]},
14 field_profile=FieldProfile(
15 6,
16 (
17 (0, 4.0),
18 (1, 3.0),
19 (2, 1.0),
20 (3, 1.0),
21 (4, 3.0),
22 (5, 4.0),
23 ),
24 ),
25)
26
27circuit = QuantumCircuit(4)
28circuit.rx(0.25, 0)
29circuit.ry(0.5, 1)
30circuit.rzz(0.75, 0, 1)
31circuit.rzz(0.5, 2, 3)
32circuit.rx(0.25, 2)
33
34compilation = LinearCompiler(compilation_architecture).compile(circuit)
35schedule = compilation.schedule
36dd_architecture = replace(
37 compilation.architecture,
38 supported_action_types=(*DEFAULT_ACTION_TYPES, GlobalPulse),
39)
40{
41 "circuit_depth": circuit.depth(),
42 "status": compilation.status.value,
43 "timesteps": schedule.num_timesteps,
44 "actions": dict(Counter(type(action).__name__ for action in schedule.path)),
45}
{'circuit_depth': 2,
'status': 'SUCCESS',
'timesteps': 15,
'actions': {'Shuttle': 8,
'AdvanceTime': 15,
'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 schedule,
5 dd_architecture,
6 SADDMethod.FULL,
7 SADDConfig(max_accepted_windows=1, num_search_workers=1),
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
10-second timeout, phase-based ion ordering, chronological windows, eight solver
workers, and shuttle/swap/local-pulse durations of 1/3/1 timesteps.
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.
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. spacing sets their
nominal separation. 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 GlobalPulse 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
GlobalPulse or one that cannot execute the existing schedule.
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.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 action schedules
Trapped-Ion Hardware Model — define sites, processing zones, timing, and field profiles
mqt.ionshuttler.linear.dd — consult the complete DD Python API