Closed WrathfulSpatula closed 1 year ago
More generally, we need a PyQrack-specific unit test suite. This is worth a unitaryhack.dev bounty.
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?
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.
It's also worth pointing out that here's an example of a mirror circuit integration test, for PyQrack:
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.
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.