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

[WIP] Specialize chklapackerror to improve error messages #51645

Merged
merged 4 commits into from
Jan 14, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Oct 9, 2023

This is an attempt at resolving #46636. Since each LAPACK function generally has a specific meaning attached to a positive error code, this PR tries to specialize chklapackerror for the caller to throw a more informative error instead of a LAPACKException. For example:

julia> U = UpperTriangular([1 2; 0 0])
2×2 UpperTriangular{Int64, Matrix{Int64}}:
 1  2
   0

julia> inv(U)
ERROR: SingularException(2)
[...]

Currently, I've only specialized it for trtrs!, but if this seems reasonable, I'll add others.

Functions to be implemented:

  • gbtrf
  • gbtrs
  • gebal!
  • gebak!
  • gebrd!
  • gelqf!
  • geqlf!
  • geqp3!
  • geqrt!
  • geqrt3!
  • geqrf!
  • gerqf!
  • getrf!
  • tzrzf!
  • ormrz!
  • gels!
  • gesv!
  • getrs!
  • getri!
  • gesvx!
  • gelsd!
  • gelsy!
  • gglse!
  • geev!
  • gesdd!
  • gesvd!
  • ggsvd!
  • ggsvd3!
  • geevx!
  • ggev!
  • ggev3!
  • gtsv!
  • gttrf!
  • gttrs!
  • orglq!
  • orgqr!
  • orgql!
  • orgrq!
  • ormlq!
  • ormqr!
  • ormql!
  • ormrq!
  • gemqrt!
  • potrs!
  • ptsv!
  • pttrf!
  • pttrs!
  • trtri!
  • trtrs!
  • trcon!
  • trevc!
  • trrfs!
  • stev!
  • stebz!
  • stegr!
  • stein!
  • syconv!
  • sytrs!
  • sytrs_rook!
  • syconvf_rook!
  • hesv!
  • hetri!
  • hetrs!
  • hesv_rook!
  • hetri_rook!
  • hetrs_rook!
  • sytri!
  • sytri_rook!
  • syconvf_rook!
  • syev!
  • syevr!
  • syevd!
  • bdsqr!
  • bdsdc!
  • gecon!
  • gehrd!
  • orghr!
  • ormhr!
  • hseqr!
  • hetrd!
  • ormtr!
  • gees!
  • gges!
  • gges3!
  • trexc!
  • trsen!
  • tgsen!
  • trsyl!

@jishnub jishnub added the domain:linear algebra Linear algebra label Oct 9, 2023
@jishnub jishnub marked this pull request as draft October 9, 2023 17:31
@jishnub jishnub marked this pull request as ready for review October 10, 2023 10:16
@ViralBShah
Copy link
Member

ViralBShah commented Oct 10, 2023

I like it. @dkarrasch Thoughts?

IIUC, this would need to include all the other methods before we merge it. In that sense, it is not ready to merge and is WIP. Is that right?

@jishnub
Copy link
Contributor Author

jishnub commented Oct 10, 2023

Yes, this is WIP. I'll try to create a checklist.

@ViralBShah ViralBShah changed the title Specialize chklapackerror to improve error messages [WIP] Specialize chklapackerror to improve error messages Oct 10, 2023
@ViralBShah ViralBShah marked this pull request as draft October 10, 2023 13:59
@dkarrasch
Copy link
Member

I like it as well. That will put the LAPACK errors in line with the corresponding ones in our generic functions, right?

@jishnub
Copy link
Contributor Author

jishnub commented Oct 10, 2023

Yes. At least in the triangular case, it now throws the same error as in the generic function

@jam-khan
Copy link
Contributor

Hi, I am quite interested in this issue, so I plan to implement some of the functions. I am learning Julia right now and reading documentation. If I could get some guidance on getting started on this issue, that would be great. Thanks!

@jishnub
Copy link
Contributor Author

jishnub commented Jan 14, 2024

Hey, you may certainly contribute by creating a list of LAPACK error codes and what they correspond to for the functions in the list above.

@ViralBShah
Copy link
Member

Should we merge this PR, and move the list of LAPACK functions to a tracking issue?

@jishnub
Copy link
Contributor Author

jishnub commented Jan 14, 2024

That's ok with me. It might take a while to implement it all, and this is an improvement as it stands

@jishnub jishnub marked this pull request as ready for review January 14, 2024 13:59
@ViralBShah
Copy link
Member

Please merge. This way, the others can all be added one at a time.

@jishnub jishnub merged commit 681816c into master Jan 14, 2024
8 checks passed
@jishnub jishnub deleted the jishnub/lapackerror branch January 14, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants