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

Clean-up Q# QIR integration folder



- Define QCOR QIR target for compilation and install to a fixed location for qsc to find.

- Restructure the example folder.

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 3840f20a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
namespace XACC 
namespace QCOR 
{
open Microsoft.Quantum.Intrinsic;
// Using QCOR Intrinsic instruction set
// see QirTarget.qs    
open QCOR.Intrinsic;
operation TestBell(count : Int) : Int {
    // Simple bell test
    mutable numOnes = 0;
+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#include "qcor.hpp"

// Include the external QSharp function.
qcor_include_qsharp(XACC__TestBell__body, int64_t, int64_t)
qcor_include_qsharp(QCOR__TestBell__body, int64_t, int64_t)


// Compile with:
@@ -13,7 +13,7 @@ qcor_include_qsharp(XACC__TestBell__body, int64_t, int64_t)
// Run with:
// $ ./a.out
int main() {
  auto oneCounts = XACC__TestBell__body(1024);
  auto oneCounts = QCOR__TestBell__body(1024);
  std::cout << "Result = " << oneCounts << "\n";
  return 0;
}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
namespace XACC 
namespace QCOR 
{
open Microsoft.Quantum.Intrinsic;
open QCOR.Intrinsic;
// Estimate energy value in a FTQC manner.
operation Deuteron(theta : Double, shots: Int) : Double {
    mutable numParityOnes = 0;
    use (qubits = Qubit[2])
+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#include "qcor.hpp"

// Include the external QSharp function.
qcor_include_qsharp(XACC__Deuteron__body, double, double, int64_t);
qcor_include_qsharp(QCOR__Deuteron__body, double, double, int64_t);

// Compile with:
// Include both the qsharp source and this driver file
@@ -22,7 +22,7 @@ int main() {
  for (size_t i = 0; i < angles.size(); ++i) {

    const double angle = angles[i];
    const double exp_val_xx = XACC__Deuteron__body(angle, 1024);
    const double exp_val_xx = QCOR__Deuteron__body(angle, 1024);
    std::cout << "<X0X1>(" << angle << ") = " << exp_val_xx
              << " vs. expected = " << expectedResults[i] << "\n";
  }
Loading