DD Strategies¶
DD strategies, sequences, and coloring assignments.
- class gadd.strategies.DDSequence(gates: List[str])[source]¶
Bases:
object
Dynamical Decoupling sequence representation.
- copy() DDSequence [source]¶
Create a deep copy of the sequence.
- 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.
- 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.
- 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.
- 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.