softwareQinc / staq

Full-stack quantum processing toolkit
https://iopscience.iop.org/article/10.1088/2058-9565/ab9359/pdf
MIT License
154 stars 28 forks source link

A simple test case to reveal a potential bug #10

Closed DevelopDaily closed 4 years ago

DevelopDaily commented 4 years ago

I've attached two files: input and output QASM files input_output.zip as a result of running this:

./staq -S -m -O1 -d tokyo -M swap -l linear -f qasm -o output.qasm input.qasm

The input is as simple as this:

OPENQASM 2.0; include "qelib1.inc";

qreg a[4]; qreg b[4];

CX b[0], a[0]; CX a[3], b[1];

But the output.qasm file has something like this in it:

qreg q[8]; //... CX q[4],q[8];

Since only 8 qubits are available, we cannot have the CX q[4],q[8];, can we?

meamy commented 4 years ago

Thanks for the bug report, I just pushed a fix. Only the number of qubits used were being "allocated" rather than the number of qubits present on the device. Closing.