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

dgesdd: Handle norm nan value #471

Merged
merged 1 commit into from
Jan 8, 2021
Merged

Conversation

jschueller
Copy link
Contributor

Closes #469

@langou
Copy link
Contributor

langou commented Jan 8, 2021

Thanks Julien. We probably want to propagate the fix to SGESDD, CGESDD, and ZGESDD then.

@jschueller
Copy link
Contributor Author

ok, done

@thijssteel
Copy link
Collaborator

minor suggestion, return info = N+1 instead of 1, that lets users distinguish non-convergence from NAN entries. Otherwise, looks good.

@langou
Copy link
Contributor

langou commented Jan 8, 2021

Right, same as @thijssteel. I like the direct return if there is a NaN in the input matrix A. I am not sure about INFO=1 though.
I was planning to write in the comments:
INFO = 1: NaN present in input matrix A; or
INFO > 0: DBDSDC did not converge, updating process failed.
But the overlap of INFO > 0 and INFO =1 was not great. (Though I could live with it.)

What about INFO=-4 ? That would be for "invalid input A".

That would be consistent with INFO = -2 for example when the input M is invalid. Or INFO = -3 when the input N is invalid, etc.

I do not think we return INFO = -4 (invalid input) for an invalid array yet, but I think we can start on this.

So: INFO = -4 ?

@jschueller
Copy link
Contributor Author

yes!

@codecov
Copy link

codecov bot commented Jan 8, 2021

Codecov Report

Merging #471 (22f2ee7) into master (adbc021) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #471      +/-   ##
==========================================
- Coverage   83.23%   83.23%   -0.01%     
==========================================
  Files        1820     1820              
  Lines      170835   170847      +12     
==========================================
+ Hits       142195   142199       +4     
- Misses      28640    28648       +8     
Impacted Files Coverage Δ
SRC/cgesdd.f 95.70% <33.33%> (-0.30%) ⬇️
SRC/dgesdd.f 94.84% <33.33%> (-0.42%) ⬇️
SRC/sgesdd.f 94.84% <33.33%> (-0.42%) ⬇️
SRC/zgesdd.f 95.70% <33.33%> (-0.30%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adbc021...22f2ee7. Read the comment docs.

@langou
Copy link
Contributor

langou commented Jan 8, 2021

So now, codecov is not happy because we do not have a test to check that INFO=-4 is triggered correctly. Oh well. So, during the tester, we should do a 4x4 matrix (for example), put a NaN in it, send it to xGESDD and make sure xGESDD returns INFO=-4. So, maybe we put this (adding a check for INFO=-4 to xGESDD) on our TODO list and accept this Pull Request from @jschueller. BTW: thanks @jschueller

@langou langou merged commit 6e125a4 into Reference-LAPACK:master Jan 8, 2021
@langou
Copy link
Contributor

langou commented Jan 8, 2021

Of note, Jim Demmel made a nice presentation a year ago on "Correctness of Floating-Point Programs: Exception Handling and Reproducibility". The slides are https://people.eecs.berkeley.edu/~demmel/ExceptionHandling_Reproducibility_Feb20.pptx
Slides 18-21 are the most relevant to this discussion. And I think @jschueller patch is more or less what is suggested on slide 21

@martin-frbg
Copy link
Collaborator

This has now caused a regression in NumPy by way of OpenBLAS - numpy/numpy#18914 so there appear to be some codebases who rely on the previous behaviour of silently propagating the NaN

@jschueller
Copy link
Contributor Author

it should probably added to the doc then

christoph-conrads pushed a commit to christoph-conrads/lapack that referenced this pull request May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DGESDD with nan exits with: On entry to DLASCL parameter number 4 had an illegal value
4 participants