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

CircuitOptimizer throws assertion failure on CZs following CNOTs #478

Open
ausbin opened this issue Aug 16, 2021 · 0 comments
Open

CircuitOptimizer throws assertion failure on CZs following CNOTs #478

ausbin opened this issue Aug 16, 2021 · 0 comments

Comments

@ausbin
Copy link
Contributor

ausbin commented Aug 16, 2021

The following test QCOR program:

__qpu__ void cz(qreg q) {
    CNOT(q[0], q[1]);
    CZ(q[0], q[1]);
    Measure(q[0]);
    Measure(q[1]);
}

int main() {
    set_shots(1024);
    set_verbose(true);

    auto q = qalloc(2);
    cz(q);
    q.print();
}

will throw the following error when running ./cz after compiling with -opt 1 passed to qcor:

cz: /home/austin/Documents/school/gatech/grad/xacc/xacc/quantum/plugins/optimizers/simple/CircuitOptimizer.cpp:681: bool xacc::quantum::CircuitOptimizer::tryRotationMergingUsingPhasePolynomials(std::shared_ptr<xacc::CompositeInstruction>&): Assertion `instruction->name() == "CNOT"' failed.
Aborted (core dumped)

I believe this is thrown by this line of CircuitOptimizer:

assert(instruction->name() == "CNOT");
. I tried to take a look at it and fix it, but I honestly do not quite understand how that part of the code works

1tnguyen pushed a commit to 1tnguyen/xacc that referenced this issue Aug 17, 2021
The procedure was not properly taking into account non-IBM gateset, i.e., 2-q gates may not be CNOT.

Signed-off-by: Thien Nguyen <[email protected]>
ausbin pushed a commit to ausbin/xacc that referenced this issue Aug 18, 2021
The procedure was not properly taking into account non-IBM gateset, i.e., 2-q gates may not be CNOT.

Signed-off-by: Thien Nguyen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant