Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bindings update #7

Merged
merged 5 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 0 additions & 245 deletions jkq/qfr/QiskitImport.hpp

This file was deleted.

12 changes: 10 additions & 2 deletions jkq/qfr/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* See file README.md or go to http://iic.jku.at/eda/research/quantum/ for more information.
*/

#include "QiskitImport.hpp"
#include "algorithms/Grover.hpp"
#include "algorithms/QFT.hpp"
#include "dd/Export.hpp"
#include "nlohmann/json.hpp"
#include "pybind11/pybind11.h"
#include "pybind11_json/pybind11_json.hpp"
#include "qiskit/QasmQobjExperiment.hpp"
#include "qiskit/QuantumCircuit.hpp"

#include <chrono>

Expand Down Expand Up @@ -100,7 +101,14 @@ nl::json construct_circuit(const py::object& circ, const ConstructionMethod& met
auto&& file = circ.cast<std::string>();
qc->import(file);
} else {
import(*qc, circ);
py::object QuantumCircuit = py::module::import("qiskit").attr("QuantumCircuit");
py::object pyQasmQobjExperiment = py::module::import("qiskit.qobj").attr("QasmQobjExperiment");
if (py::isinstance(circ, QuantumCircuit)) {
qc::qiskit::QuantumCircuit::import(*qc, circ);
} else if (py::isinstance(circ, pyQasmQobjExperiment)) {
qc::qiskit::QasmQobjExperiment::import(*qc, circ);
}
std::cout << *qc << std::endl;
}
} catch (std::exception const& e) {
std::stringstream ss{};
Expand Down
Loading