iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common.relabel_qubits_array_from_zero

iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common.relabel_qubits_array_from_zero#

iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common.relabel_qubits_array_from_zero(arr: list[list[int]], separate_registers: bool = False, reversed_arr: bool = False) list[list[int]]#

Helper function to relabel an array of qubits to an increasingly ordered one starting from zero.

E.g., [[2,3], [5], [7,8]] -> [[0,1], [2], [3,4]]

Note: This assumes the input array is sorted in increasing order!

Parameters:
  • arr (list[list[int]]) – Array of qubits to relabel.

  • separate_registers (bool) – Whether the clbits were generated in separate registers. This has the effect of skipping one value in between each sublist, e.g., [[2,3], [5], [7,8]] -> [[0,1], [3], [5,6]]. Default is False.

  • reversed_arr (bool) – Whether the input array is reversed. This has the effect of reversing the output array, e.g., [[2,3], [5,7], [8]] -> [[0], [1,2], [3,4]]. Default is False.

Returns:

Relabeled array of qubits.

Return type:

list[list[int]]