pygsti.construction.repeat_remainder_for_truncation

pygsti.construction.repeat_remainder_for_truncation(x, N, assertAtLeastOneRep=False)

Repeat the gate string x the fewest number of times such that the repeated string has length greater than or equal to N. Return the portion of this repeated string from the N-th position to the end. Note that this corresponds to what is truncated in a call to repeateAndTruncate(x,N,assertAtLeastOneRep).

Parameters:
  • x (tuple or GateString) – the gate string to operate on.
  • N (int) – the truncation length.
  • assertAtLeastOneRep (bool, optional) – if True, assert that number of repetitions is > 0. This is always the case when x has length > 0.
Returns:

the remainder gate string

Return type:

tuple or GateString (whichever x was)