Qiskit / qiskit-addon-cutting

Reduce width and depth of quantum circuits by cutting gates and wires.
https://qiskit.github.io/qiskit-addon-cutting/
Apache License 2.0
81 stars 28 forks source link

Filter out duplicate subexperiments before execution #262

Open garrison opened 1 year ago

garrison commented 1 year ago

The QPD bases we have considered so far each have 6 unique elements in their maps. However, if one looks at only a single qubit (either one), there are actually only 5 unique operations, as two of them are the same QPDMeasure operation:

https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/blob/58376677cffdf9e0579b7f2ae3c2b8bd92e13ad0/circuit_knitting/cutting/qpd/qpd.py#L243-L250

For a separable circuit, when it comes time to run the sub-experiments, it's only necessary to run 5 distinct sub-experiments on each partition. However, right now, 6 subexperiments are run instead. We already have a test to make sure we can recognize these duplicate subexperiments. We should resolve this issue once we no longer send duplicate experiments to the backends.

More advanced thoughts regarding wire cutting

A lot of cases of duplicate circuits are straightforward, and we should start with them.

A tricky case, however, is in wire cutting. The I measurement and the Z measurement can be made through exactly the same circuit; the only difference is whether the corresponding bit of the qpd register is considered or ignored.

https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/blob/669d9fdfa075ab31cc110be7a75940857c0a249c/circuit_knitting_toolbox/circuit_cutting/qpd/qpd.py#L337 https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/blob/669d9fdfa075ab31cc110be7a75940857c0a249c/circuit_knitting_toolbox/circuit_cutting/qpd/qpd.py#L340

Currently, we always take the parity of all available qpd measurement bits, but if we were to have a bit more control in post-processing, we could do this without running each circuit separately.

garrison commented 1 year ago

To do this, we'll need to store the weights in a bit more complicated way (https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/pull/385#discussion_r1310677757) and be also to map between subexperiment index and (sample, observable) index #387.