pygsti.construction.repeat_count_with_max_length

pygsti.construction.repeat_count_with_max_length(x, maxLength, assertAtLeastOneRep=False)

Compute the number of times a gate string x must be repeated such that the repeated string has length <= maxLength.

Parameters:
  • x (tuple or GateString) – the gate string to repeat
  • maxLength (int) – the maximum length
  • assertAtLeastOneRep (bool, optional) – if True, assert that number of repetitions is > 0. This can be useful when used within a create_gatestring_list inner loop to build a gate string lists where a string must be repeated at least once to be added to the list.
Returns:

the number of repetitions.

Return type:

int