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

Handle adjoint as well



For some reason, get_provider() impl was not found (linker errors b/c adjoint() used it to construct IR), hence added accordingly.
Signed-off-by: Nguyen, Thien Minh's avatarThien Nguyen <nguyentm@ornl.gov>
parent 0ccce01d
......@@ -31,7 +31,9 @@ class pyxasm_visitor : public pyxasmBaseVisitor {
pyxasmParser::Atom_exprContext *context) override {
// Handle kernel::ctrl(...), kernel::adjoint(...)
if (!context->trailer().empty() && context->trailer()[0]->getText() == ".ctrl") {
if (!context->trailer().empty() &&
(context->trailer()[0]->getText() == ".ctrl" ||
context->trailer()[0]->getText() == ".adjoint")) {
std::cout << "HELLO: " << context->getText() << "\n";
std::cout << context->trailer()[0]->getText() << "\n";
std::cout << context->atom()->getText() << "\n";
......@@ -41,7 +43,10 @@ class pyxasm_visitor : public pyxasmBaseVisitor {
auto arg_list = context->trailer()[1]->arglist();
std::stringstream ss;
ss << context->atom()->getText() << "::ctrl(parent_kernel";
// Remove the first '.' character
const std::string methodName = context->trailer()[0]->getText().substr(1);
ss << context->atom()->getText() << "::" << methodName
<< "(parent_kernel";
for (int i = 0; i < arg_list->argument().size(); i++) {
ss << ", " << arg_list->argument(i)->getText();
}
......@@ -50,7 +55,6 @@ class pyxasm_visitor : public pyxasmBaseVisitor {
std::cout << "HELLO SS: " << ss.str() << "\n";
result.first = ss.str();
return 0;
}
if (context->atom()->NAME() != nullptr) {
auto inst_name = context->atom()->NAME()->getText();
......
......@@ -38,6 +38,11 @@ get_transformation(const std::string &transform_type) {
xacc::internal_compiler::compiler_InitializeXACC();
return xacc::getService<xacc::IRTransformation>(transform_type);
}
std::shared_ptr<qcor::IRProvider> get_provider() {
return xacc::getIRProvider("quantum");
}
std::shared_ptr<qcor::CompositeInstruction>
decompose_unitary(const std::string algorithm, UnitaryMatrix &mat,
const std::string buffer_name) {
......
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