unitaryfund / qrack

Comprehensive, GPU accelerated framework for developing universal virtual quantum processors
https://qrack.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
177 stars 38 forks source link

Improve 2-qubit `TrySeparate()` #974

Closed WrathfulSpatula closed 2 years ago

WrathfulSpatula commented 2 years ago

If a single qubit is actually separable, Qrack is always able to determine this upon request, by using a triple-axis set of |0>/|1> probability measurements and the AI() gate, ("azimuth-inclination," basically a single qubit state preparation gate). It has long seemed that a singly-controlled CAI() gate could ultimately achieve the same total successful separation of 2-qubit subsystems, but I've debated the usefulness for the complexity.

With our recent work in noise models, (see #765 and d5fdf00, besides work in PyQrack,) it seems even more obvious that such a CAI() gate could uncompute "strong" simulation condition depolarizing noise channels, for example, though that particular application probably wouldn't be commonly demanded, for realism. Though, it's the same principle as implementing total successful separation of all perfectly separable 2-qubit subsystems, relative qubit system bulk.

We should implement this, despite its complexity. It will be a weekend project for me, at least, whether we have input from other contributors.

WrathfulSpatula commented 2 years ago

Rotating the depolarizing noise channel "trick" work to an equivalent orthogonal basis, this needs to be done in terms of a CRZ() gate, as like the "partially entangling" gate in the noise channel simulation, as opposed CRY(), as we otherwise usually formulate it. (There's no particular practical limitation, in that change of basis.) This is because QUnit 2-qubit controlled gate buffers are designed to accommodate only phase and inversion target qubit payloads, but CRZ() fits the bill just fine.

WrathfulSpatula commented 2 years ago

We could use a CProb() (and ACProb()) gate for this, "conditional probability." I'm guessing that having such a convenience method would make determining the CRZ() angle significantly simpler and maybe less costly.

WrathfulSpatula commented 2 years ago

So, in general, I think we need CAI() and CIAI() to disentangle the pair of qubits from each other in a separable 2-qubit subsystem. This is not generally conducive to making them separably represented from each other with the controlled gate buffers in QUnit, (though sometimes it is). However, if we faithfully carry out the process with CAI() and CIAI(), analogous to a controlled variant of TrySeparate() for single qubits, we do separate both qubits from a larger bulk, even if buffers flush and the pair end up entangled with each other, again.

So, we need CAI() and CIAI(), next. This is trivial to implement.

WrathfulSpatula commented 2 years ago

Closed by 9780402.