Commit dc4942e2 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Add code comment for IQPE example



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 7c583fbe
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
OPENQASM 3;
include "qelib1.inc";

// NISQ-mode lowering to conditional (If) statements
// Compile targeting nisq runtime and a capable QPU:
// (1) Qpp simulator (default):
// qcor -qrt nisq -shots 1024 measure_conditional.qasm -print-final-submission 
// (2) Aer simulator (inspect the QObj to see the use of "conditional" to control quantum instructions)
// qcor -qrt nisq -qpu aer -shots 1024 measure_conditional.qasm -print-final-submission 
// (3) Honeywell: see the OpenQASM2 with if statements.
// qcor -qrt nisq -qpu honeywell:HQS-LT-S1-APIVAL -shots 1024 measure_conditional.qasm -print-final-submission 

// Expected to get 4 bits (iteratively) of 1011 (or 1101 LSB) = 11(decimal):
// phi_est = 11/16 (denom = 16 since we have 4 bits)
// => phi = 2pi * 11/16 = 11pi/8 = 2pi - 5pi/8
// i.e. we estimate the -5*pi/8 angle...
qubit q[2];
const bits_precision = 4;
bit c[bits_precision];
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void OpenQasmV3MLIRGenerator::initialize_mlirgen(
    } else {
      for (const auto &name_to_check : IF_STMT_CAPABLE_QPUS) {
        const auto qpu_name = extra_quantum_args["qpu"];
        if (name_to_check.rfind(qpu_name, 0) == 0) {
        if (qpu_name.rfind(name_to_check, 0) == 0) {
          // QPU start with aer, honeywell, etc.
          // (it could have backend name customization after ':')
          enable_qir_apply_ifelse = true;