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

Allow singular matrices in saturate #1102

Merged
merged 3 commits into from
Jun 23, 2023
Merged

Conversation

mgkurtz
Copy link
Contributor

@mgkurtz mgkurtz commented Jun 2, 2023

Possible fix for #1101.

@thofma thofma requested a review from fieker June 2, 2023 07:49
@fieker
Copy link
Collaborator

fieker commented Jun 2, 2023

probably correct - but I'd expect it to be much slower (for suitable evil examples)

  • hnf_with_transform is much slower than hnf without
  • inv(T) is inverting a much larger matrix than inverting H - furthermore, H is square, upper triangular, so inverting is just writing it down. inv(T) is hard...

@mgkurtz
Copy link
Contributor Author

mgkurtz commented Jun 2, 2023

I had some fun, adapting the original concept to the singular case. Indeed, the hnf_with_transform takes longer than the whole saturate. Curiously, for random input, inverting the unimodular transform U was faster than inverting the hnf matrix H. Probably, because (U⁻¹)ᵀ is the pretty looking result matrix, while the hnf and its inverse may have a few large entries.

@mgkurtz
Copy link
Contributor Author

mgkurtz commented Jun 2, 2023

Hmph, I should listen better. You told me, not to compute the inverses, but to just solve the linear system directly. Well, this reduces the code to less than it was before, works out of the box for singular matrices, and speeds it up.

Copy link
Contributor Author

@mgkurtz mgkurtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just look at commit ea0b343 – unless you are interested in all the comments in the previous commits.

@codecov
Copy link

codecov bot commented Jun 3, 2023

Codecov Report

Patch coverage: 83.33% and project coverage change: +0.01 🎉

Comparison is base (e22dabd) 69.30% compared to head (ea0b343) 69.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1102      +/-   ##
==========================================
+ Coverage   69.30%   69.32%   +0.01%     
==========================================
  Files         349      349              
  Lines      112890   112895       +5     
==========================================
+ Hits        78237    78259      +22     
+ Misses      34653    34636      -17     
Impacted Files Coverage Δ
src/Misc/Matrix.jl 70.27% <83.33%> (-0.13%) ⬇️

... and 30 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fieker fieker merged commit 7c40d37 into thofma:master Jun 23, 2023
@mgkurtz mgkurtz deleted the mgk/saturate branch June 26, 2023 10:44
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.

2 participants