Update Frobenius norms for better accuracy. #290
Merged
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.
This fixes issue #261.
I added
scombssq
anddcombssq
to merge two sum-of-squares quantities. These functions are taken from ScaLAPACK (TOOLS/pdtreecomb.f), just the documentation is updated to match LAPACK's style.Updated norms were tested via the LAPACK++ tester, comparing single to double precision on identical matrices, and results from new code with results from old code.
For instance, original results (output abbreviated):
Using double precision (type d) as reference, this gives a relative error for single precision (type s) of 1.5360e-02.
With updated code:
Again using double-precision as reference, this gives a much better relative error for single precision of 2.8808e-07. Note also that the double-precision result is close to that generated by the old code.
For reference, in LAPACK++ test I ran:
and compared those files. I modified the LAPACK++ matrix_generator.cc to generate exactly the same matrix for single and double precision, e.g., for all i, j:
instead of using
larnv
.I did not address RFP matrix norms (
dlansf
, ...). Nor tridiagonal matrices (dlangt
, ...), which due to having fewer entries (only O(n) instead of O(n^2)), are less affected by the accuracy issue.