-
-
Notifications
You must be signed in to change notification settings - Fork 517
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 compilation and doctests with flintlib 3.2 #39413
base: develop
Are you sure you want to change the base?
Conversation
@antonio-rojas in case you find this useful when flintlib 3.2 is released. |
Thanks - haven't tested yet, but at first sight it looks like these functions are not used anywhere, can't we just remove the declarations so it works across all flint versions? |
[[1.00000000000 +/- ...e-12] + [+/- ...e-11]*I, | ||
[1.0000000000 +/- ...e-12] + [+/- ...e-12]*I] | ||
[[1.000000000... +/- ...] + [+/- ...]*I, | ||
[1.000000000... +/- ...] + [+/- ...]*I] |
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.
how about using abs tol
like what you used above?
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.
I tried but it refuses to work because of the doctest:...
above.
But
Removing may lead to some confusion (e.g. if some future person want to use the function), and also then we should probably make a blacklist in the autogen file itself. |
@@ -51,6 +51,7 @@ | |||
|
|||
#define PY_SSIZE_T_CLEAN | |||
#include <Python.h> | |||
#include "gmp.h" |
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.
Feel like flint bug to me? Surely the header should be usable standalone?
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.
I think it's by design: With
flintlib/flint@3604bb2 one needs to include the gmp header before using fmpz_get_mpz
.
Actually the breaking change is flintlib/flint#1964 … looks like backwards incompatibility wasn't intended but…? |
Makes sense, in fact those two functions are deprecated in flintlib 3.2. A few tests won't work for both versions, because the order of the roots is different. Sorting doesn't work for these. Using I can see a few improvements to doctesting may be useful here and there, but I don't have time right now to work on these:
The goals here would be:
|
Actually…
Yes, using |
Actually (2) that isn't the reason. If it were it would have printed out Meanwhile in IPython shell:
Probably there's some magic there. Confusingly dict keys seem to be sorted as well, while in sufficiently new version of Python dict entries are in fact ordered. Edit: apparently the magic is in
some are in SageMath.
|
Quick comments:
In any case, my suggestion of the |
that's what I mean, because of some magic (displayhook) in IPython and sage, dict and set are always sorted (first tried by element, if fail it retry by key=str), so it should be good. |
Ok, I added
The problem here seems to be that
|
Ugh, I guess you can do a If it's confusing only do it in a TESTS:: block, I suppose. |
For that it feels less hacky to do Anyway, what's going on with testing here? |
What do you mean (the CI failing? it's because of the randstate thing right? flintlib/flint#1964 ) |
No, it doesn't even start building sagemath, AFAICT. |
Now it should be ok for both flintlib 3.1 and 3.2. |
Documentation preview for this PR (built with commit 5f2cfff; changes) is ready! 🎉 |
It turns out sorting in `ComplexIntervalField` is broken. In this case, there are two elements that do not compare. ``` sage: x = PolynomialRing(CBF, 'x').gen() sage: _, a, b, _ = sorted((x^4 - 3).roots(ComplexIntervalField(100), multiplicities=False)) sage: a == b False sage: a < b False sage: a > b False sage: sorted([a,b]) [0.?e-37 + 1.31607401295249246081921890180?*I, 0.?e-37 - 1.31607401295249246081921890180?*I] sage: sorted([b,a]) [0.?e-37 - 1.31607401295249246081921890180?*I, 0.?e-37 + 1.31607401295249246081921890180?*I] ```
The sorting should be fixed now. The issue is not about complex sorting, but about real sorting:
🤷 |
In their defense, it works exactly how it is documented. Interval arithmetic does not satisfy trichotomy. The implementation of complex interval arithmetic comparison could probably be improved though…
If it is disabled then comparison will fallback to using repr. |
Tested with flintlib 3.2-rc1.
May not work with flintlib 3.1.
📝 Checklist