Closed WrathfulSpatula closed 2 years ago
At this moment, it seems that the problem might have been exactly, in fact, "something like 'Gimbal lock.'"
When Decompose()
or Dispose()
is called, they assume that the state is already exactly separable. In this case, there is implicitly no ambiguity in subset of the Hilbert space from which to decouple the sub-state. However, depending on differences between cache and "shard unit," or else slightly higher than normal rounding error, this implicit assumption might fail. ff68f1d seems to fix this, for QUnit
with IAI()
/AI()
separability checks.
(It's "like Gimbal lock" in the sense that, if the state is separable, all options for this implicit choice should be exactly the same in consequence, but there's too much deviation, in test 19, like if a subspace with 0 amplitude multiplier "up front" is chosen, or a very small multiplier to re-normalize out.)
I can't definitively rule out an unrelated invalid cache state bug, but 7482b7a admittedly sidesteps the problem by using all 3 axes as equivalent to Z. However, this also makes TrySeparate()
faster for these cases. We'll address any bug that comes up, even if it turns out to be another case of "this one" again.
There is still a bug in the case of
test_mirror_circuit_19
, despite the current CI status. I'll be able to debug tonight. It might be single qubit shard caches falling out of sync, or it might be something like "Gimbal lock," as far I can tell for now. The bug is avoided ifQUnit::TrySeparate()
stops short of reverse state preparation withIAI()
/AI()
, but that isn't an acceptable fix, in itself.