qiskit_noise_learning.sequences.Path
class qiskit_noise_learning.sequences.Path(start_fragment: Iterable[T], repeatable_fragment: Iterable[T], end_fragment: Iterable[T], fragment_depth: int | None = None)
Bases: BaseSequence[FidelityIndex]
A sequence of fidelity indices.
Parameters
- start_fragment – The start of the sequence.
- repeatable_fragment – The repeatable middle of the sequence.
- end_fragment – The end of the sequence.
- fragment_depth – The number of repetitions of the repeatable fragment.
__init__
__init__(start_fragment: Iterable[T], repeatable_fragment: Iterable[T], end_fragment: Iterable[T], fragment_depth: int | None = None)
Methods
Column 1 | Column 2 |
|---|---|
__init__(start_fragment, ...[, fragment_depth]) | |
bind_at(fragment_depth) | Return a new instance with the same fragments bound to the fragment depth. |
extend_permutations(instruction_sequence) | Return an instruction sequence with extended permutations to traverse self. |
fragment_sign_flips(instruction_sequence) | Whether the instruction sequence fragments flip the observable sign when traversing self. |
is_traversed_by(instruction_sequence) | Whether or not this path is traversed by the instruction sequence. |
to_instruction_sequence() | Return a minimally-specified instruction sequence that traverses this path. |
unbind() | Return a new instance with the same fragments but fragment depth set to None. |
Attributes
Column 1 | Column 2 |
|---|---|
end_fragment | The ending fragment. |
end_fragment_observable_idxs | The observable indices of the end fragment. |
fragment_depth | The number of repetitions of the repeatable fragment. |
is_unbound | Whether the sequence is unbound. |
repeatable_fragment | The repeatable fragment. |
repeatable_fragment_observable_idxs | The observable indices of the repeatable fragment. |
start_fragment | The starting fragment. |
start_fragment_observable_idxs | The observable indices of the start fragment. |
start_fragment_observable_idxs
repeatable_fragment_observable_idxs
end_fragment_observable_idxs
extend_permutations
extend_permutations(instruction_sequence: InstructionSequence) → InstructionSequence | None
Return an instruction sequence with extended permutations to traverse self.
Given an instruction_sequence, this method attempts to extend its definition by constructing a new instruction sequence with the same structure as the input, but for which the PartialPauliPermutations are extended to specify the minimal superset of mappings required to traverse this path. If this is not possible, the function will return None, indicating that the procedure failed.
In terms of the specific algorithm, when encountering a PartialPauliPermutation while jointly iterating through self and instruction_sequence, this method will attempt to extend the permutation to map the current Pauli in the path to the Pauli in the next relevant FidelityIndex. Note that this can lead to failures in instances when multiple permutations occur in a row, even if it is technically possible to find a super instruction sequence that traverses the path.
Parameters
instruction_sequence – The base instruction sequence.
Returns
The extended instruction sequence, or None if an extension is not possible.
Raises
ValueError – If the transitions of self do not start and end with the identity.
is_traversed_by
is_traversed_by(instruction_sequence: InstructionSequence) → bool
Whether or not this path is traversed by the instruction sequence.
Whether or not a Path is traversed by an InstructionSequence is determined on a fragment-by-fragment basis.
Requires the path starts and ends at the identity.
Parameters
instruction_sequence – The instruction sequence.
Returns
Whether or not the path is traversed.
Raises
ValueError – If the path does not start and end at the identity.
fragment_sign_flips
fragment_sign_flips(instruction_sequence: InstructionSequence) → tuple[bool, bool]
Whether the instruction sequence fragments flip the observable sign when traversing self.
Requires the path starts and ends at the identity. This method ignores the fragment depths of the path and instruction sequence, operating only on the fragment structure.
Parameters
instruction_sequence – An instruction sequence that traverses this path.
Returns
A tuple of booleans, the first indicating whether the combined action of the start and end fragments flip the sign, and the second indicating whether the repeatable fragment flips the sign.
Raises
- ValueError – If the path does not satisfy the assumptions.
- ValueError – If the instruction sequence does not traverse the path.
to_instruction_sequence
to_instruction_sequence() → InstructionSequence
Return a minimally-specified instruction sequence that traverses this path.
The single-qubit Clifford layers between gate set elements are given as PartialPauliPermutations specifying only the mappings required to traverse this path. The fragment depth of the returned instruction sequence is self.fragment_depth.
Returns
An instruction sequence traversing this path.