pygsti.construction.repeat_with_max_length

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

Repeat the gate string x an integer number of times 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 repeated gate string

Return type:

tuple or GateString (whichever x was)