Loading CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ find_package(Python COMPONENTS Interpreter Development) if(Python_FOUND) if(${Python_VERSION} VERSION_GREATER_EQUAL 3.0.0) message(STATUS "Found Python version ${Python_VERSION}. Building QCOR Python API with ${Python_INCLUDE_DIRS}") #add_subdirectory(python) add_subdirectory(python) else() message(STATUS "Found Python version ${Python_VERSION}. Version must be greater than 3.0.0, skipping Python API build.") endif() Loading python/CMakeLists.txt +4 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ target_include_directories(${LIBRARY_NAME} PUBLIC . ${CMAKE_SOURCE_DIR}/runtime/ set_target_properties(${LIBRARY_NAME} PROPERTIES PREFIX "") if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit qcor-mlir-api xacc::xacc) target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-jit qcor-mlir-api xacc::xacc) # target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit qcor-mlir-api xacc::xacc) else() target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit xacc::xacc) #target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit xacc::xacc) target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-jit xacc::xacc) endif() if(APPLE) Loading python/examples/multiple_kernels.py +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ q = qalloc(2) # Inspect the IR comp = bell_test.extract_composite(q) print(comp.toString()) print(comp) # Run the bell experiment bell_test(q) Loading python/examples/qaoa_circuit.py +2 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from types import MethodType # Define a QAOA kernel with variational parameters (theta and beta angles) @qjit def qaoa_circ(q: qreg, cost_ham: PauliOperator, nbSteps: int, theta: List[float], beta: List[float]): def qaoa_circ(q: qreg, cost_ham: Operator, nbSteps: int, theta: List[float], beta: List[float]): # Start off in the uniform superposition for i in range(q.size()): H(q[i]) Loading Loading @@ -50,3 +50,4 @@ obj = createObjectiveFunction(qaoa_circ, H, n_params) # Run optimization optimizer = createOptimizer('nlopt', {'initial-parameters': np.random.rand(n_params)}) results = optimizer.optimize(obj) print(results) No newline at end of file python/examples/qjit_observe.py +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ def objective_function(x): energy = ansatz.observe(H, q, x[0]) return abs(target_energy - energy) objective_function([2.2]) optimizer = createOptimizer('nlopt', {'nlopt-maxeval':20}) opt_val, opt_params = optimizer.optimize(objective_function, 1) Loading Loading
CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ find_package(Python COMPONENTS Interpreter Development) if(Python_FOUND) if(${Python_VERSION} VERSION_GREATER_EQUAL 3.0.0) message(STATUS "Found Python version ${Python_VERSION}. Building QCOR Python API with ${Python_INCLUDE_DIRS}") #add_subdirectory(python) add_subdirectory(python) else() message(STATUS "Found Python version ${Python_VERSION}. Version must be greater than 3.0.0, skipping Python API build.") endif() Loading
python/CMakeLists.txt +4 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ target_include_directories(${LIBRARY_NAME} PUBLIC . ${CMAKE_SOURCE_DIR}/runtime/ set_target_properties(${LIBRARY_NAME} PROPERTIES PREFIX "") if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit qcor-mlir-api xacc::xacc) target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-jit qcor-mlir-api xacc::xacc) # target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit qcor-mlir-api xacc::xacc) else() target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit xacc::xacc) #target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-quasimo qcor-jit xacc::xacc) target_link_libraries(${LIBRARY_NAME} PUBLIC qcor qcor-jit xacc::xacc) endif() if(APPLE) Loading
python/examples/multiple_kernels.py +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ q = qalloc(2) # Inspect the IR comp = bell_test.extract_composite(q) print(comp.toString()) print(comp) # Run the bell experiment bell_test(q) Loading
python/examples/qaoa_circuit.py +2 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from types import MethodType # Define a QAOA kernel with variational parameters (theta and beta angles) @qjit def qaoa_circ(q: qreg, cost_ham: PauliOperator, nbSteps: int, theta: List[float], beta: List[float]): def qaoa_circ(q: qreg, cost_ham: Operator, nbSteps: int, theta: List[float], beta: List[float]): # Start off in the uniform superposition for i in range(q.size()): H(q[i]) Loading Loading @@ -50,3 +50,4 @@ obj = createObjectiveFunction(qaoa_circ, H, n_params) # Run optimization optimizer = createOptimizer('nlopt', {'initial-parameters': np.random.rand(n_params)}) results = optimizer.optimize(obj) print(results) No newline at end of file
python/examples/qjit_observe.py +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ def objective_function(x): energy = ansatz.observe(H, q, x[0]) return abs(target_energy - energy) objective_function([2.2]) optimizer = createOptimizer('nlopt', {'nlopt-maxeval':20}) opt_val, opt_params = optimizer.optimize(objective_function, 1) Loading