-
Notifications
You must be signed in to change notification settings - Fork 66
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
Fix Order(K, [ ... ])
#1239
Fix Order(K, [ ... ])
#1239
Conversation
Would be great if you could squash and add a comment explaining the algorithm, including the |
17b098d
to
33988fd
Compare
I don't have counterexamples, but this feels wrong.
|
Sorry, never mind about the start thing. I missed a later line. |
Ah, there's a difference between what's in B and what's in |
Yes, |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1239 +/- ##
==========================================
- Coverage 74.59% 74.53% -0.06%
==========================================
Files 346 346
Lines 110839 110840 +1
==========================================
- Hits 82681 82618 -63
- Misses 28158 28222 +64
☔ View full report in Codecov by Sentry. |
@fagu thanks for having a look. @joschmitt Can you add a test case for the line with missing coverage? @fieker any comments? |
I have not tried to check the math, but it looks fine to me. Do you happen to recall the examples that sparked the |
The algorithm looks correct to me now. Thanks for the fixes and clarifications! Lines 1016-1018 and 1084-1086 seem unnecessary, but maybe I'm wrong. Small comments / questions on the modular HNF:
|
# Make an explicit check | ||
@hassert :NfOrd 1 defines_order(K, B)[1] | ||
return Order(K, B, cached = cached, check = check) | ||
return Order(K, B, cached = cached, check = check)::order_type(K) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't check = false
or check = (check && extends !== nothing)
suffice, depending on whether or not we're supposed to check that extends
is actually an order?
You've already checked that the generators are integral.
The Order
constructor with check = true
reduces all products of pairs of basis elements modulo the (Hermite reduced) basis. For example if there is only one generator, this seems like an unnecessary amount of work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the general philosophy, I think. My understanding so far is that we by default rather check correctness one time too often, but let the user turn off the checks, if they know what they are doing.
33988fd
to
8d29375
Compare
I added the test. |
A real life example would be good. In the tiny examples I had from the tests also the modular approach never really made sense. |
Lines 1016-1018 are exactly to catch the case that somebody submits an empty array like in #1223 Issue 2.
I do not know.
This modular business is always confusing to me when 'fractional types' are involved. My understanding is the following: I have the
It is not clear to me whether the computation of the determinants (in practise) is worth the effort of finding a (slightly) better modulus. Here a real world example might help. |
commit 401a711 Author: Johannes Schmitt <[email protected]> Date: Fri Oct 6 15:47:13 2023 +0200 Fix `_order(::NumField, ::Vector{NumFieldElem})` commit 48c9923 Author: Tommy Hofmann <[email protected]> Date: Mon Sep 25 09:19:26 2023 +0200 Fixing Order([...])
8d29375
to
03dd36d
Compare
I added a specialized determinant for triangular matrices and tuned the modular stuff a bit as discussed with @thofma . For me, this is good to go (assuming CI agrees). If anybody needs it to be faster, I would need a real-life example. |
Closes #1223 .
I basically reimplemented the functionality now and all the errors in #1223 should be solved. In the examples collected from the tests by @thofma , this is always faster or at least comparable to the runtime of the old function.
I am not sure I take the best modulus for the modular HNF; maybe some guru could have a look.