Unverified Commit 49a05cc5 authored by Thien Nguyen's avatar Thien Nguyen Committed by GitHub
Browse files

Merge pull request #243 from tnguyen-ornl/tnguyen/add-mirror-validation-example

Added Deuteron-like example for mirror circuit validation with noisy sim
parents 1fe64ee6 ea56056b
Loading
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
// Compile to run with validation mode: 
// Qpp (noiseless)
// qcor -validate deuteron_validation.cpp -shots 1024
// Aer (noisy)
// qcor -validate deuteron_validation.cpp -shots 1024 -qpu aer[noise-model:noise_model.json]
__qpu__ void deuteron(qreg q, double theta) {
  X(q[0]);
  Ry(q[1], theta);
  CNOT(q[1], q[0]);
  // for (int i = 0; i < 20; i++) {
  //   CNOT(q[1], q[0]);
  // }
  H(q[0]);
  H(q[1]);
  Measure(q[0]);
  Measure(q[1]);
}

int main() {
  qcor::set_verbose(true);
  const double angle = 0.297113;
  auto q = qalloc(2);
  deuteron(q, angle);
  q.print();
  std::cout << "<XX> = " << q.exp_val_z() << "\n";
}
 No newline at end of file