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

Using the new creg syntax in examples



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 2577a732
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ __qpu__ void PrepareStateUsingRUS(qreg q, int maxIter) {
    // In order to measure in the PauliX basis, changes the basis.
    H(q[1]);
    Measure(q[1]);
    bool outcome = q.cReg(1);
    bool outcome = q.creg[1];
    if (!outcome) {
      // Success (until (outcome == Zero))
      std::cout << "Success after " << i + 1 << " iterations.\n";
+3 −3
Original line number Diff line number Diff line
@@ -12,16 +12,16 @@ __qpu__ void bell(qreg q, int nbRuns) {
    CX(q[0], q[1]);
    Measure(q[0]);
    Measure(q[1]);
    if (q.cReg(0) == q.cReg(1)) {
    if (q.creg[0] == q.creg[1]) {
      std::cout << "Iter " << i << ": Matched!\n";
    } else {
      std::cout << "Iter " << i << ": NOT Matched!\n";
    }
    // Reset qubits
    if (q.cReg(0)) {
    if (q.creg[0]) {
      X(q[0]);
    }
    if (q.cReg(1)) {
    if (q.creg[1]) {
      X(q[1]);
    }
  }