DD Strategies

DD strategies, sequences, and coloring assignments.

gadd.strategies.create_xb_gate()[source]

Create Xb gate (X with additional phase).

gadd.strategies.create_yb_gate()[source]

Create Yb gate (Y with additional phase).

class gadd.strategies.DDSequence(gates: List[str])[source]

Bases: object

Dynamical Decoupling sequence representation.

gates: List[str]
__post_init__()[source]

Validate sequence after initialization.

copy() DDSequence[source]

Create a deep copy of the sequence.

to_indices(group: DecouplingGroup | None = None) List[int][source]

Convert gate names to group element indices.

Parameters:

group – Optional custom decoupling group. Uses default if not provided.

Returns:

List of integer indices corresponding to group elements.

__init__(gates: List[str]) None
class gadd.strategies.StandardSequences[source]

Bases: object

Standard DD sequence implementations.

This class provides access to well-established dynamical decoupling sequences commonly used in quantum error suppression experiments. Each sequence is designed to suppress specific types of errors through systematic application of Pauli operations during idle periods.

Available Sequences:
xy4: Four-pulse sequence [X, Y, X, Y] that provides first-order decoupling

from both X and Y noise. Also known as XY-4, this sequence offers robust performance against pulse timing errors.

cpmg: Two-pulse Carr-Purcell-Meiboom-Gill sequence [X, X] that decouples

Y and Z noise but leaves X noise unaffected. Simple and widely used for basic error suppression.

edd: Eight-pulse Eulerian Dynamical Decoupling sequence

[X, Y, X, Y, Y, X, Y, X] that provides enhanced robustness against systematic pulse errors compared to XY-4 while maintaining first-order decoupling properties.

baseline: Single identity operation [I] used as a control sequence to

measure the effect of applying no dynamical decoupling.

urdd: Simplified Universally Robust DD sequence [X, Y, X, Y]. In practice,

URDD adapts pulse counts based on idle duration, but this provides the basic four-pulse pattern.

xy4_staggered: XY-4 sequence with CR-aware staggering for crosstalk

suppression. Uses the same pulse sequence as xy4 but applies time-shifted scheduling between different qubit colors.

cpmg_staggered: CPMG sequence with staggered timing between colors

for multi-qubit crosstalk mitigation.

edd_staggered: Eulerian DD sequence with staggered timing to reduce

correlated errors between neighboring qubits.

Note

Staggered sequences use the same gate patterns as their non-staggered counterparts but apply different pulse timing during circuit padding to suppress crosstalk errors between adjacent qubits.

__init__()[source]
get(name: str) DDSequence[source]

Get a standard DD sequence by name.

Parameters:

name – Name of the sequence (case insensitive).

Returns:

Copy of the requested DD sequence.

Raises:

ValueError – If the sequence name is not recognized.

is_staggered(name: str) bool[source]

Check if a sequence should be applied with staggered timing.

Parameters:

name – Sequence name to check (case insensitive).

Returns:

True if sequence should use staggered timing, False otherwise.

list_available() List[str][source]

List all available standard sequence names.

Returns:

List of available sequence names that can be used with get().

class gadd.strategies.DDStrategy(sequences: List[DDSequence] | Dict[int, DDSequence])[source]

Bases: object

Collection of dynamical decoupling sequences assigned to different qubit colors.

A DD strategy defines the complete dynamical decoupling approach for a quantum circuit by specifying which DD sequence should be applied to each color of qubits. The coloring is typically based on the circuit’s connectivity graph to ensure that adjacent qubits (which may experience crosstalk) receive independent DD sequences for optimal error suppression.

This class encapsulates the multi-color DD approach described in the GADD paper, where different groups of qubits can receive tailored DD sequences optimized for their specific noise environment and connectivity constraints. The strategy can range from simple uniform approaches (same sequence for all colors) to sophisticated heterogeneous strategies with different sequences per color.

Parameters:

sequences – Either a list of DDSequence objects assigned to colors 0, 1, 2, … or a dictionary mapping color indices to DD sequences.

Raises:
  • ValueError – If sequences is empty.

  • TypeError – If sequences contains non-DDSequence objects or has invalid format.

Example

>>> seq1 = DDSequence(["X", "Y", "X", "Y"])
>>> seq2 = DDSequence(["Y", "X", "Y", "X"])
>>> strategy = DDStrategy([seq1, seq2])  # 2-color strategy
>>> strategy.get_sequence(0)  # Returns seq1
__init__(sequences: List[DDSequence] | Dict[int, DDSequence])[source]
classmethod from_single_sequence(sequence: DDSequence, n_colors: int = 1) DDStrategy[source]

Create strategy by repeating single sequence for all colors.

Parameters:
  • sequence – DD sequence to replicate for all colors.

  • n_colors – Number of colors in the strategy.

Returns:

New DD strategy with the sequence assigned to all colors.

Raises:

ValueError – If n_colors is not positive.

get_sequence(color: int) DDSequence[source]

Get the DD sequence assigned to a specific color.

Parameters:

color – Color index to retrieve sequence for.

Returns:

DD sequence for the specified color.

Raises:

KeyError – If no sequence is defined for the specified color.

to_dict() Dict[str, any][source]

Convert strategy to dictionary for serialization.

Returns:

Dictionary representation suitable for JSON serialization.

classmethod from_dict(data: Dict[str, any]) DDStrategy[source]

Create strategy from dictionary.

class gadd.strategies.ColorAssignment(graph: PyGraph | None = None, backend: BackendV2 | None = None)[source]

Bases: object

Assignment of device qubits to colors based on connectivity graph.

__init__(graph: PyGraph | None = None, backend: BackendV2 | None = None)[source]

Initialize color assignment.

Parameters:
  • graph – Connectivity graph where nodes are qubits and edges are connections. If None and backend is provided, will extract from backend.

  • backend – Backend to extract connectivity from if graph not provided.

Raises:

ValueError – If neither graph nor backend is provided.

__str__() str[source]

Return human-readable string representation.

classmethod from_circuit(circuit: QuantumCircuit) ColorAssignment[source]

Create color assignment from circuit connectivity.

Parameters:

circuit – Quantum circuit to extract connectivity from.

Returns:

ColorAssignment based on circuit structure.

classmethod from_manual_assignment(assignments: Dict[int, List[int]]) ColorAssignment[source]

Create from manual color assignments.

Parameters:

assignments – Dictionary mapping colors to lists of qubit indices.

Returns:

ColorAssignment with specified assignments.

get_color(qubit: int) int | None[source]

Get color assigned to a qubit.

get_qubits(color: int) List[int][source]

Get qubits assigned to a color.

property n_colors: int

Number of colors used in assignment.

to_dict() Dict[int, int][source]

Convert to qubit->color mapping dictionary.

Returns:

Dictionary mapping qubit indices to color values.

validate_coloring() bool[source]

Validate that the coloring is proper (no adjacent nodes have same color).

Returns:

True if coloring is valid, False otherwise.