Commit 044bff71 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Aer to support print out of native code (QObj) as well

Note: Aer can simulate conditional (bfunc) in the QObj and XACC translate IfStmt to bfunc appropriately.
Signed-off-by: Nguyen, Thien Minh's avatarThien Nguyen <>
parent 5367a4b0
......@@ -832,6 +832,14 @@ IbmqNoiseModel::averageTwoQubitGateFidelity() const {
return result;
AerAccelerator::getNativeCode(std::shared_ptr<CompositeInstruction> program,
const HeterogeneousMap &config) {
auto qobj_str = xacc_to_qobj->translate(program);
nlohmann::json j = nlohmann::json::parse(qobj_str)["qObject"];
return j.dump(2);
} // namespace quantum
} // namespace xacc
......@@ -60,7 +60,8 @@ public:
void apply(std::shared_ptr<AcceleratorBuffer> buffer,
std::shared_ptr<Instruction> inst) override;
bool isInitialized() const { return initialized; }
std::string getNativeCode(std::shared_ptr<CompositeInstruction> program,
const HeterogeneousMap &config = {}) override;
static double calcExpectationValueZ(
const std::vector<std::pair<double, double>> &in_stateVec,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment