Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for *TRTRS should note it only detects exact singularity #918

Closed
1 task done
TiborGY opened this issue Oct 31, 2023 · 1 comment · Fixed by #924
Closed
1 task done

Documentation for *TRTRS should note it only detects exact singularity #918

TiborGY opened this issue Oct 31, 2023 · 1 comment · Fixed by #924

Comments

@TiborGY
Copy link

TiborGY commented Oct 31, 2023

Description
The current description of DTRTRS claims that A check is made to verify that A is nonsingular.. Initially I assumed that nonsingular meant "nonsingular within acceptable numerical precision", but after reading the code itself it has become evident that only exact singularity (as in 0.0d+0) triggers an error.

I know it is too late to change this behavior, but was this a good design decision? I would think that at the very least, any subnormally small (< 2^−1022 for FP64) diagonal element is ought to trip the error exit. Perhaps something like tiny(0.0d+0) would have been more appropriate.
This does not only affect *TRTRS, but many of the callers of it, which rely on *TRTRS for their rank-deficiency/singularity checking. For example, DGELS only errors out if the least squares matrix has an exact rank deficiency, even though it is reasonable to assume that being only a subnormal number away from rank deficiency will result in a loss of numerical precision in the computed linear coefficients.

Admittedly all of the above is purely academic. Even if I am correct, it would not be nice to the users if the behaviour of the function was changed, so I am proposing to change the documentation instead, making it immediately clear to the reader that these checks only detect exact singularity/rank-deficiency, and that near-singular cases are not caught.

Checklist

  • [N/A] I've included a minimal example to reproduce the issue
  • I'd be willing to make a PR to solve this issue
@langou
Copy link
Contributor

langou commented Nov 1, 2023

it would not be nice to the users if the behaviour of the function was changed, so I am proposing to change the documentation instead, making it immediately clear to the reader that these checks only detect exact singularity/rank-deficiency, and that near-singular cases are not caught.

This sounds great to me and would be a welcome contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants