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

Conveying Initial Layout and Output Permutations #11

Closed
burgholzer opened this issue Sep 29, 2021 · 1 comment · Fixed by #76
Closed

Conveying Initial Layout and Output Permutations #11

burgholzer opened this issue Sep 29, 2021 · 1 comment · Fixed by #76
Labels
feature New feature or request good first issue Good for newcomers

Comments

@burgholzer
Copy link
Member

At the moment, our mappers track the initial layout (initial logical to physical qubit mapping) and output permutation (which physical qubit has to be measured to obtain which logical qubit result) of the mapped circuits and, upon dumping the respective circuits to .qasm, emit them as comments of the form

// i 0 1 ... n
// o 0 1 ... m

This is not standardized in any way and might even change in our own toolset in the future.

At least for the output permutation a possible fix would be to add appropriate measurements to the mapped circuits. For example:

// o 1 0
OPENQASM 2.0;
include "qelib1.inc";

qreg q[2];
creg c[2];

[... circuit ...]

could become

OPENQASM 2.0;
include "qelib1.inc";

qreg q[2];
creg c[2];

[... circuit ...]
measure q[1] -> c[0];
measure q[0] -> c[1];

At the moment there does not seem to exist an apparent/standardized solution for conveying the initial layout in .qasm other than the solution available right now.

At least for the Python bindings, circumventing the .qasm dump and directly constructing a Qiskit QuantumCircuit should be possible. At the moment, Qiskit hides the initial layout in a private member _layout of QuantumCircuit.
Setting this member appropriately and adding measurements to convey the output permutation should allow to use the resulting circuits, e.g., for our verification tool QCEC.

If anyone is interested in working on this, feel free to reach out!

@burgholzer burgholzer added feature New feature or request good first issue Good for newcomers labels Sep 29, 2021
@burgholzer
Copy link
Member Author

#50 introduces measurements at the end of mapped circuits according to the tracked output permutation.

As for the initial layout, cda-tum/mqt-core#35 tracks the corresponding feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant