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

Unit tests: mirror circuits #13

Closed
WrathfulSpatula opened this issue Mar 5, 2022 · 4 comments
Closed

Unit tests: mirror circuits #13

WrathfulSpatula opened this issue Mar 5, 2022 · 4 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed unitaryhack-bounty

Comments

@WrathfulSpatula
Copy link
Contributor

We rely on Qrack library unit tests, but a random mirror circuit integration test should be adapted from the underlying Qrack test suite. It can give excellent coverage in a fast test, though it's not modular. At least, it's a tractable atomic step toward PyQrack unit tests and tooling.

@WrathfulSpatula WrathfulSpatula added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 5, 2022
@WrathfulSpatula
Copy link
Contributor Author

More generally, we need a PyQrack-specific unit test suite. This is worth a unitaryhack.dev bounty.

@golanor
Copy link
Contributor

golanor commented May 31, 2023

I've started to look into this, one thing I'm missing is how to create circuits in PyQrack without using Qiskit. Is there a way to do this without supplying gates/loading from file? OR should I install qiskit alongside PyQrack and add it as a test dependency?

@WrathfulSpatula
Copy link
Contributor Author

WrathfulSpatula commented May 31, 2023

Historically, Qrack always worked in terms of "immediate" gates on simulator instances, not circuit definitions. To "save a circuit," you would simply write (and save) a Qrack program in terms of immediate gates on a simulator.

However, we've recently added QrackCircuit. (https://pyqrack.readthedocs.io/en/latest/autoapi/pyqrack/qrack_circuit/index.html)

The point of saving to and loading from file is that you can store the optimized circuit compilation result at all: otherwise, you're still writing a Qrack program, loaded at run time, which is no different from how Qiskit does it, as far as I know.

I would suggest simply writing a program in terms of "immediate" Qrack gates, particularly as QrackCircuit might optimize away parts of logical tests you want to check.

@WrathfulSpatula
Copy link
Contributor Author

WrathfulSpatula commented May 31, 2023

It's also worth pointing out that here's an example of a mirror circuit integration test, for PyQrack:

https://github.com/unitaryfund/research/blob/main/qrack-report/plots/Qrack_mirror_circuit_validation.ipynb

This test mirrors the definition of a "forward" circuit in QrackCircuit, with an "uncomputation" by immediate gates. This way, both QrackCircuit and QrackSimulator are reasonably well-covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed unitaryhack-bounty
Projects
None yet
Development

No branches or pull requests

2 participants