Slightly relax tolerance in a test case of Apply1InteriorArbitrary #671
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test case in
third_party/qsim/tests/mps_simulator_test.cc
on line 262 fails if the Eigen linear algebra library is updated to a recent version available from https://gitlab.com/libeigen/eigen. Specifically, commit 59498c96 in the Eigen repo (which can be seen at https://gitlab.com/libeigen/eigen/-/merge_requests/1663) changed the code inEigen/src/Core/arch/Complex.h
forpmul()
to use a fused multiply-add-subtract (FMA) instruction (fmaddsub
) instead of the previous separate multiply and add-subtract instructions. The new code improved accuracy for many of the tests inmps_simulator_test.cc
, slightly worsened accuracy for some of the tests, and in the case of the one on line 262, made it cross the absolute tolerance value of1e-5
by a very small amount. After considering various alternatives, the least-worst option seems to be to increase the tolerance for this one case.Note: the qsim repository on GitHub has its own vendored copy of Eigen, so this change is not strictly necessary; however, if we ever update qsim's internal copy of Eigen, then this change will become relevant.
The original debugging & solution are the work of @pavoljuhas.