wrap_in_shots

Set the Executable to run multiple times per execution on the QPU. If this option is not set, the Executable will be run one time per execution.

Definition

void wrap_in_shots(struct Executable *executable, unsigned short shots);

Arguments

  1. executable: The Executable to set the parameter on.
  2. shots: The number of times to run the executable for each execution.

Safety

  1. executable must be the result of executable_from_quil

Example

Take a simple bell state program:

    char *BELL_STATE_PROGRAM =
        "DECLARE ro BIT[2]\n"
        "H 0\n"
        "CNOT 0 1\n"
        "MEASURE 0 ro[0]\n"
        "MEASURE 1 ro[1]\n";

If we run the program like this:

    unsigned int shots = 3;
    Executable *exe = executable_from_quil(BELL_STATE_PROGRAM);
    wrap_in_shots(exe, shots);
    ExecutionResult *result = execute_on_qvm(exe);

Then the program will be executed 3 times (per the number of shots set). The resulting Byte data of one execution will be a 2D array with an outer dimension of 3 (number of shots) and an inner dimension of 2 (amount of memory locations read per run).