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

`QPager::PhaseParity()` bug #888

Closed WrathfulSpatula closed 3 years ago

WrathfulSpatula commented 3 years ago

QPager::PhaseParity() on main at the moment is bugged for all cases except equivalent to ZMask(). Parallel Z gates happen to add up to PhaseParity() for angle π, but not general angles, and this is how paged qubits are handled in QPager::PhaseParity().

PyQrack v0.5.0 isn't affected, on PyPi. If you don't use PhaseParity() directly, yet, you should not be affected.

WrathfulSpatula commented 3 years ago

In fact, you also should not be affected if QPager is not in your layer stack, when directly using PhaseParity().

WrathfulSpatula commented 3 years ago

Of course, it's after I tag the PyQrack release that I catch the last edge case in QPager::PhaseParity(). Sorry about that.

I will tag a second patch for PyQrack, later today, with 00d5b8d included. For now, the safest way to operate is building from the head of main for Qrack, for use with PyQrack.

WrathfulSpatula commented 3 years ago

Sorry for the rapid-fire release iterations on this. (I am basically a sole developer, with limited testing and development resources, and this is a somewhat difficult case to test.)

PyQrack v0.5.2 introduced a problem with invalid std::future instances. However, in QPager, basically no void return type simulator method should be dispatched in a std::future at all. This was a failure of oversight, in the original XMask and ZMask implementations. For the whole family of related methods, std::future is not necessary and has been totally removed. I'm iterating immediately PyQrack v0.5.3, with apologies for any headaches caused, but this issue finally appears to be satisfactorily resolved.