Repository navigation
Make gauge fixing stable for tied magnitudes - #334
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
lkdvos
left a comment
There was a problem hiding this comment.
Feel free to go ahead and merge without my approval, just wanted to chime in that it seems a bit artificial to change the gauge just because some AD tests otherwise complain, and the extra tolerance is somewhat annoying to set values for. In general, my understanding was that a global smooth gauge is impossible, so no matter what we do there will be jumps somewhere (also in this implementation when the value crosses the threshold), so code that depends on this will still spuriously fail. I understand that this might be less common with the new implementation, but it still feels a bit hacky to work around that by altering the gauging strategy.
Note though that I am definitely sympathetic to just having this fixed, if this doesn't end up costing much more and this is the faster solution, probably it is the better approach, but in a perfect world the AD tests would be robust against this
|
Is this really about AD specifically? I thought it was just about making the gauge fixing result a bit more deterministic, in the case of equal magnitude entries in the eigenvectors / singular vectors. If two entries have the same magnitude, then which of those is chosen to fix the sign/phase of the eigenvector can depend on machine precision differences, and so it could change between two different algorithms or even two different hardware platforms. This would be fixed by this PR. I agree that this merely shifts the problem, cause now the algorithm/hardware dependence will kick in when two entries have a magnitude that differs exactly by the tolerance. That however is perhaps slightly less likely than exact equal magnitudes, which often happen (e.g. eigenvectors of sigma^x). |
To me, it was revealed by AD, but it's not really unique to AD or making AD happy, and it's exactly what your last two sentences are describing. |
Right now, we can end up picking gauge indices based on
argmax, which is really vulnerable to splitting effectively equal values based on differences of like 10^-17. Modified this to use a tolerance to avoid being so vulnerable to minute floating point differences.