Closed yourball closed 3 years ago
Hi,
I just pushed a new update which contains Python bindings for the tool.
you should be able to install them using pip
. See the updated README for the available options.
Let me know if this works for you, or if you encountered any problems.
Hi, thanks a lot for doing this!
Just a side question. Do I understand correctly that two circuits which are different by a diagonal gate just before the measurements will be interpreted as non-equivalent? Say, two circuits like:
qc1: X q[0]; measure q[0] -> c[0];
and qc2: X q[0]; Z q[0]; measure q[0] -> c[0];
Qiskit has a RemoveDiagnoalBeforeMeasure subroutine as a part of transpiler
Hi,
you're welcome. I am currently working on making the Python package available through PyPi so it is even easier to incorporate.
On your question: Thatβs correct. Technically the two circuits do not represent the same unitary functionality. Although you are right, that these two circuits behave the same upon measurement.
I could implement an (optional) optimization pass for our tool which mimics Qiskitβs transpiler pass. Would that help?
Cool, pypi indeed would be an ideal option.
Yeah, if you could implement such an optional pass, it would be great!
Would you mind creating a separate issue for this in order to keep everything self-contained?
JKQ QCEC is now available via PyPI π
pip install jkq.qcec
It can then be used in Python via
from jkq import qcec
qcec.verify(...)
where the verify
function is defined as follows:
"""
Interface to the JKQ QCEC tool for verifying quantum circuits
Params:
file1 β Path to first file (required)
file2 β Path to second file (required)
method β Equivalence checking method to use (reference | naive | *proportional* | lookahead | simulation | compilation flow)
tolerance β Numerical tolerance used during computation
nsims β Number of simulations to conduct (for simulation method)
fidelity β Fidelity limit for comparison (for simulation method)
csv β Create CSV string for result
statistics β Print statistics
swapGateFusion β Optimization pass reconstructing SWAP operations
singleQubitGateFusion β Optimization pass fusing consecutive single qubit gates
removeDiagonalGatesBeforeMeasure β Optimization pass removing diagonal gates before measurements
Returns:
JSON object containing results
"""
def verify(file1: Union[str, bytes, PathLike],
file2: Union[str, bytes, PathLike],
method: Method = Method.proportional,
tolerance: float = 1e-13,
nsims: int = 16,
fidelity: float = 0.999,
csv: bool = False,
statistics: bool = False,
swapGateFusion: bool = False,
singleQubitGateFusion: bool = False,
removeDiagonalGatesBeforeMeasure: bool = False) -> object
Hi,
I was wondering if it is possible to add a Python interface for your project? That would be very helpful for the platform I'm working on (Arline Benchmarks, automated benchmarking for quantum compilers, https://github.com/ArlineQ/arline_benchmarks). Also it would be super helpful for a broad audience of quantum researchers and developers.
Me and my team looked into that, there are some automatic python wrappers for C++ code such as pybind11, SWIG. Did you guys consider something like that?
Thanks!