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

Added GHZ demo



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent e53e2868
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

- CLI: compile (`-qpu` switch) 

- Execution: state-vector (`qpp`); noisy (`aer`); IBM. Show QObj (IBMQ portal) to demonstate native gate set mapping (e.g. H -> rz and sx decomposition)
- Execution: state-vector (`qpp`); noisy (`aer`); IBM; IonQ. Show QObj (IBMQ portal) to demonstate native gate set mapping (e.g. H -> rz and sx decomposition)

- Advance: increase number of qubits (~50) => MPS simulation (TNQVM); choose IBM pulse-mode (submitting pulses to IBM)

+31 −0
Original line number Diff line number Diff line
/// Simulator
/// $qcor -qpu qpp ghz.cpp 

/// IBMQ Backend (normal gate-mode)
/// $qcor -qpu ibm:ibmqx2 ghz.cpp

/// IBMQ Backend (pulse mode)
/// QCOR lowers gates --> pulses
/// $qcor -qpu ibm:ibmq_montreal[mode:pulse] ghz.cpp 
__qpu__ void ghz(qreg q) {
  H(q[0]);

  for (int i = 0; i < q.size() - 1; i++) {
    CX(q[i], q[i + 1]);
  }

  Measure(q);
}

int main() {
  set_shots(100);
  auto q = qalloc(3);

  ghz(q);

  auto counts = q.counts();

  for (auto [bit, count] : counts) {
    print(bit, ": ", count);
  }
}
 No newline at end of file