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 a qubits array 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]]) – the qubits array 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:

the relabeled qubits array.

Return type:

List[List[int]]