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
172 stars 38 forks source link

Only allow QStabilizer to QBdt::Attach() #956

Closed WrathfulSpatula closed 2 years ago

WrathfulSpatula commented 2 years ago

Per #954, I notice that QBdt::Attach() is very bugged for a ket simulator attachment. In general, we probably need to revert and complete d742e03 for this to work, via PushStateVector() and PopStateVector(), by multiplying out amplitudes to full tree depth. This is surmountable, but the need to multiply out amplitudes would seem to limit our ability to attach stabilizer representation. However, if we limit our gate set to entirely Clifford/Pauli, QStabilizer attachments already work, (about 98% of the time on test_mirror_quantum_volume if "hacked" for only stabilizer gates, to 100%, indicating that there is only a small bug, at most). There seems to be a symmetry to stabilizer sub-states that precludes the need for PushStateVector() and PopStateVector().

Seeing as QBdt::Attach() is really only useful for QStabilizer, we can force this as a design requirement, and exclude ket simulator attachments. (If we first restrict the domain of our implementation just to barely what we need, we might re-orient ourselves faster in debugging.)