Commit 044bff71 authored by Nguyen, Thien's avatar Nguyen, Thien
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's avatarThien Nguyen <nguyentm@ornl.gov>
parent 5367a4b0
......@@ -832,6 +832,14 @@ IbmqNoiseModel::averageTwoQubitGateFidelity() const {
return result;
}
std::string
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;
private:
static double calcExpectationValueZ(
const std::vector<std::pair<double, double>> &in_stateVec,
......
Markdown is supported
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