pygsti.circuits.circuitconstruction.repeat_with_max_length

pygsti.circuits.circuitconstruction.repeat_with_max_length#

repeat_with_max_length(x, max_length, assert_at_least_one_rep=False)#

Repeat the x an integer number of times such that the result has length <= 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 repeated operation sequence

Return type:

tuple or Circuit (whichever x was)