Skip to main content
The skip-control statement designates a statement block that should be applied unconditionally, even when the enclosing function is subject directly or indirectly to a quantum control operator. This construct is typically applied when the enclosing function involves intermediate computation and uncomputation blocks in ways that cannot be formulated using a simple conjugation (i.e., using the within-apply statement).

Syntax

Semantics

  • All statements nested under a skip-control statement are applied unconditionally, including in states where a control condition from above is evaluated to False. It is the user’s responsibility to ensure that the combined effect of the skip-control blocks in the enclosing function is functionally equivalent to NOP (identity).
  • Using skip-control inside the within block of a within-apply statement is redundant, since the within block is itself designated as a skip-control block.
  • Using skip-control directly inside the apply block of a within-apply statement is not allowed.

Example

The following example demonstrates the use of skip_control. Function foo rotates a qubit in steps, applying a controlled flip of other qubits at each step. The controlling qubit ultimately returns to its original state. The rotations are marked with skip_control because they can be safely applied even for states where the whole function is under a negative control condition, as demonstrated by function main. Note that the computation of qarr[0] within foo cannot be encapsulated in an apply block of a within-apply statement.