mqt.ionshuttler.linear.dd¶
Dynamical-decoupling methods for Linear schedules.
Submodules¶
- mqt.ionshuttler.linear.dd.critical_segments
- mqt.ionshuttler.linear.dd.frame_replay
- mqt.ionshuttler.linear.dd.global_dd
- mqt.ionshuttler.linear.dd.idealized_hahn
- mqt.ionshuttler.linear.dd.metrics
- mqt.ionshuttler.linear.dd.nearest_hahn
- mqt.ionshuttler.linear.dd.phase
- mqt.ionshuttler.linear.dd.result
- mqt.ionshuttler.linear.dd.sadd
- mqt.ionshuttler.linear.dd.sadd_solver
- mqt.ionshuttler.linear.dd.schedule_transform
- mqt.ionshuttler.linear.dd.schemes
- mqt.ionshuttler.linear.dd.windows
Package Contents¶
- class CriticalSegment[source]¶
Describe one interval over which longitudinal phase remains comparable.
- class CriticalSegmentResult[source]¶
Contain logic-aware normalized-phase replay over critical segments.
phase_costis a schedule-ranking surrogate: the sum of squared normalized segment phases. It is not a joint-coherence decay exponent or a complete circuit-error model.- segments: tuple[CriticalSegment, ...]¶
- compute_critical_segments(schedule: Schedule, architecture: LinearArchitecture, *, sensitivity_profile: FieldProfile | None = None, dt: float = 1.0, segmentation: SegmentationMode = 'critical', local_pulse_action_ids: frozenset[int] = frozenset()) CriticalSegmentResult[source]¶
Replay ion-local segments and their normalized squared-phase proxy.
- Returns:
The reconstructed critical segments and their phase objective.
- Raises:
ValueError – If the analysis parameters or architecture metadata are invalid.
- gate_z_effect(action: Action, ion: int) int | None[source]¶
Return a preserving gate’s Z sign, or
Nonefor a mixing gate.- Raises:
TypeError – If
actionis not a supported algorithmic gate.
- normalized_sensitivity_values(architecture: LinearArchitecture, profile: FieldProfile | None = None) tuple[float, ...][source]¶
Return a nonnegative dimensionless sensitivity envelope with unit RMS.
- Raises:
ValueError – If the profile does not match the architecture or cannot be normalized.
- class GlobalDDConfig[source]¶
Configure a periodic sequence of schedule-wide global X pulses.
Shift optimization minimizes the logic-aware critical-segment phase cost shared with SADD.
- __post_init__() None[source]¶
Validate periodic placement and optional shift optimization.
- Raises:
TypeError – If a configuration value has the wrong type.
ValueError – If a value or pulse lies outside the supported domain.
- class GlobalDDReport[source]¶
Summarize the selected global pulse sequence and phase cost.
- __post_init__() None[source]¶
Freeze pulse positions and validate their ordering.
- Raises:
TypeError – If a report value has the wrong type.
ValueError – If a report value is outside its supported range.
- classmethod from_dict(data: object) GlobalDDReport[source]¶
Restore a global-DD report from JSON-compatible values.
- Returns:
The restored global-DD report.
- Raises:
ValueError – If the serialized report is malformed.
- apply_periodic_global_dd(schedule: Schedule, architecture: LinearArchitecture, config: GlobalDDConfig) DDPassResult[GlobalDDReport][source]¶
Insert periodic global X pulses, optionally shifting them by phase cost.
Each pulse is a
GlobalGatewhose targets are all ions of the schedule. Global pulses are placed before all existing actions at the same schedule boundary and may overlap local gates or transport under the global-frame abstraction.- Returns:
The transformed schedule and selected pulse/phase summary.
- Raises:
ValueError – If the architecture does not support global pulses, replay metadata is absent, or global pulses already exist.
- class IdealizedHahnConfig[source]¶
Configure the idealized full-control Hahn reference.
The comparator permits local pulses at every ion position and concurrently with transport or other operations. Its output is therefore a reference schedule, not necessarily an executable schedule for the given hardware.
By default the sequence is a single midpoint pulse and the resulting Pauli frame persists past its window, to be discharged virtually by a consumer that corrects the terminal frame. Set
include_terminating_pulseto insert the physical closing pulse that returns the frame to the identity instead.- __post_init__() None[source]¶
Validate the reference sequence configuration.
- Raises:
TypeError – If a configuration value has the wrong type.
ValueError – If a configuration value is outside its supported range.
- class IdealizedHahnReport[source]¶
Summarize local pulse sequences inserted by the idealized reference.
- sequences: tuple[LocalDDSequence, ...] = ()¶
- __post_init__() None[source]¶
Freeze and validate insertion records.
- Raises:
TypeError – If an item is not a local DD insertion record.
- classmethod from_dict(data: object) IdealizedHahnReport[source]¶
Restore an idealized-Hahn report from JSON-compatible values.
- Returns:
The restored report.
- Raises:
ValueError – If the serialized report is malformed.
- apply_idealized_hahn(schedule: Schedule, architecture: LinearArchitecture, config: IdealizedHahnConfig | None = None) DDPassResult[IdealizedHahnReport][source]¶
Insert constraint-relaxed Hahn pulses into every eligible idle window.
Pulse positions are rounded to schedule boundaries, clamped to their idle window, and deduplicated by boundary while retaining sequence order. The default single-pulse sequence leaves a persistent Pauli frame; see
IdealizedHahnConfigfor the closing-pulse alternative.- Returns:
The idealized schedule and its inserted local-pulse records.
- decoupling_ratio(schedule: Schedule, sequences: Sequence[LocalDDSequence] = ()) float[source]¶
Return the fraction of ion-time volume covered by recorded DD windows.
- max_absolute_residual_phase(schedule: Schedule, architecture: LinearArchitecture, local_pulse_action_ids: frozenset[int] = frozenset()) float[source]¶
Return the largest absolute schedule-end residual phase.
- residual_phase_by_ion(schedule: Schedule, architecture: LinearArchitecture, local_pulse_action_ids: frozenset[int] = frozenset()) dict[int, float][source]¶
Return schedule-end residual phase for every ion.
- sum_absolute_residual_phase(schedule: Schedule, architecture: LinearArchitecture, local_pulse_action_ids: frozenset[int] = frozenset()) float[source]¶
Return the sum of absolute schedule-end residual phases.
- sum_squared_residual_phase(schedule: Schedule, architecture: LinearArchitecture, local_pulse_action_ids: frozenset[int] = frozenset()) float[source]¶
Return the sum of squared schedule-end residual phases.
- class NearestHahnConfig[source]¶
Configure the schedule-preserving nearest-feasible Hahn comparator.
- __post_init__() None[source]¶
Validate the comparator configuration.
- Raises:
TypeError – If a configuration value has the wrong type.
ValueError – If a configuration value is outside its supported range.
- class NearestHahnOpportunityRecord[source]¶
Describe the placement outcome for one eligible ion-local idle window.
- status: NearestHahnStatus¶
- skip_reason: NearestHahnSkipReason | None = None¶
- __post_init__() None[source]¶
Validate one placement audit entry.
- Raises:
TypeError – If a record value has the wrong type.
ValueError – If a record value is outside its supported range.
- classmethod from_dict(data: object) NearestHahnOpportunityRecord[source]¶
Restore one placement record from JSON-compatible values.
- Returns:
The restored record.
- Raises:
ValueError – If the serialized record is malformed.
- class NearestHahnReport[source]¶
Summarize nearest-Hahn placements and the windows it could not use.
- sequences: tuple[LocalDDSequence, ...] = ()¶
- opportunities: tuple[NearestHahnOpportunityRecord, ...] = ()¶
- __post_init__() None[source]¶
Freeze and validate the report collections.
- Raises:
TypeError – If a collection contains an unexpected value.
- classmethod from_dict(data: object) NearestHahnReport[source]¶
Restore a nearest-Hahn report from JSON-compatible values.
- Returns:
The restored report.
- run_nearest_hahn(schedule: Schedule, architecture: LinearArchitecture, config: NearestHahnConfig | None = None) DDPassResult[NearestHahnReport][source]¶
Place one X pulse as near each eligible idle-window midpoint as the schedule allows.
The pass uses only processing-zone access the compiled trajectory already provides. It inserts no transport, never extends the makespan, and adds no physical recovery pulse, so the resulting Pauli frame persists and is discharged virtually by a consumer that corrects the terminal frame. Unlike
apply_idealized_hahn(), every returned schedule is executable on the given architecture.The pass is intended for a base schedule. Applying it to an already augmented schedule is permitted, but the returned report then owns only the pulses this call inserted.
- Parameters:
schedule – Base schedule to augment.
architecture – Hardware model the schedule runs on.
config – Optional comparator settings.
- Returns:
The augmented schedule and its complete eligible-window audit.
- class DDPassResult[source]¶
Bases:
Generic[ReportT]Contain an augmented schedule and diagnostics from one DD pass.
- architecture: LinearArchitecture¶
- report: ReportT¶
- __post_init__() None[source]¶
Validate the schedule, report, and optional explanation.
- Raises:
TypeError – If the schedule or report violates the pass-result protocol.
ValueError – If an unavailable reason is empty.
- classmethod from_dict(data: object, report_class: type[ReportT]) DDPassResult[ReportT][source]¶
Restore a DD-pass result with an explicit report class.
- Returns:
The restored DD-pass result.
- Raises:
ValueError – If the serialized envelope or report type is malformed.
- classmethod from_json(raw: str, report_class: type[ReportT]) DDPassResult[ReportT][source]¶
Restore a DD-pass result from JSON text.
- Returns:
The restored DD-pass result.
- class LocalDDSequence[source]¶
Describe one ion-local pulse sequence in a DD method report.
- __post_init__() None[source]¶
Validate pulse positions and their associated idle window.
- Raises:
TypeError – If a sequence field has the wrong type.
ValueError – If the window or pulse positions are inconsistent.
- classmethod from_dict(data: object) LocalDDSequence[source]¶
Restore a local sequence from JSON-compatible values.
- Returns:
The restored local DD sequence.
- Raises:
ValueError – If the serialized sequence is malformed.
- class SADDConfig[source]¶
Configure the shared pulse-only and transport-enabled SADD backend.
SADD denotes shuttling-aware dynamical decoupling.
timeout_sbounds each control window’s solve. The unchanged schedule is always an admissible solution and is supplied to the solver as a hint, so a window that runs out of time yields a weaker improvement or none at all rather than an invalid or missing result. Raise it for long windows or many participating ions, where proving optimality takes longer.Synthesized shuttles, swaps, and local pulses take the durations defined by the architecture.
- ion_preselection: Literal['phase', 'distance'] = 'phase'¶
- opportunity_order: Literal['chronological', 'reverse_chronological'] = 'chronological'¶
- __post_init__() None[source]¶
Validate optimization and problem parameters.
- Raises:
TypeError – If a parameter has the wrong type.
ValueError – If a parameter is outside its supported range.
- class SADDMethod[source]¶
Bases:
enum.StrEnumSelect a shuttling-aware dynamical decoupling (SADD) method.
- PULSE_ONLY = 'pulse_only_sadd'¶
- FULL = 'full_sadd'¶
- class SADDOpportunityRecord[source]¶
Describe one ordered SADD optimization opportunity and its outcome.
transport_deltarecords the signed change in scheduled transport actions by concrete action type between the opportunity input and proposed result. Equality ignoresruntime_s, so two runs with the same outcome compare equal.- __post_init__() None[source]¶
Validate and freeze nested opportunity diagnostics.
- Raises:
TypeError – If a field has the wrong type.
ValueError – If a field contains an invalid value.
- class SADDReport[source]¶
Collect ordered opportunity records produced by one SADD pass.
- method: SADDMethod¶
- opportunities: tuple[SADDOpportunityRecord, ...] = ()¶
- __post_init__() None[source]¶
Normalize opportunity records to an immutable tuple.
- Raises:
TypeError – If the method or an opportunity has the wrong type.
- property sequences: tuple[LocalDDSequence, ...]¶
Accepted ion-local pulse sequences in opportunity order.
- classmethod from_dict(data: object) SADDReport[source]¶
Restore a SADD report from JSON-compatible values.
- Returns:
The restored SADD report.
- Raises:
ValueError – If the serialized report is malformed.
- class SADDResult[source]¶
Contain a SADD-augmented compilation result and its pass report.
- result: CompilationResult¶
- report: SADDReport¶
- __post_init__() None[source]¶
Validate the transformed result, report, and optional explanation.
- Raises:
TypeError – If a field has the wrong type.
ValueError – If an unavailable reason is empty.
- classmethod from_dict(data: object) SADDResult[source]¶
Restore a serialized SADD result.
- Returns:
The restored SADD result.
- Raises:
ValueError – If the serialized value is malformed.
- classmethod from_json(raw: str) SADDResult[source]¶
Restore a SADD result from JSON text.
- Returns:
The restored SADD result.
- run_sadd(result: CompilationResult, method: SADDMethod, config: SADDConfig | None = None, *, architecture: LinearArchitecture | None = None) SADDResult[source]¶
Apply shuttling-aware dynamical decoupling to a compiled schedule.
Pulse-only and transport-enabled SADD use the same optimization backend;
methodcontrols whether the solver may synthesize transport.- Parameters:
result – Compilation result to augment.
method – SADD method to apply.
config – Optional optimization settings.
architecture – Optional compatible architecture with added DD capabilities.
- Returns:
The transformed compilation result and an ordered SADD report.
- Raises:
TypeError – If
methodis not aSADDMethod.ValueError – If the result and architecture are incompatible or the architecture lacks actions required by the selected method.