pygsti.circuits.circuitconstruction.repeat_count_with_max_length

pygsti.circuits.circuitconstruction.repeat_count_with_max_length#

repeat_count_with_max_length(x, max_length, assert_at_least_one_rep=False)#

The maximum number of times x can be repeated such that its length is <= max_length.

Parameters:
  • x (tuple or Circuit) – the operation sequence to repeat

  • max_length (int) – the maximum length

  • assert_at_least_one_rep (bool, optional) – if True, assert that number of repetitions is > 0. This can be useful when used within a create_circuits inner loop to build a operation sequence lists where a string must be repeated at least once to be added to the list.

Returns:

the number of repetitions.

Return type:

int