Allow more rings to be used with libsingular & rework signal detection system#39075
Allow more rings to be used with libsingular & rework signal detection system#39075vbraun merged 18 commits intosagemath:developfrom
Conversation
acfbf30 to
2e88a31
Compare
|
Documentation preview for this PR (built with commit 963dde6; changes) is ready! 🎉 |
| sage: P.<x,y,z> = PolynomialRing(Integers(2^32), order='lex') | ||
| sage: P(2^32-1) | ||
| 4294967295 | ||
| -1 |
There was a problem hiding this comment.
This is harmless, but technically modifies the behavior. (New behavior is probably better though.)
| sage: I.groebner_basis() | ||
| [2*z^4, y*z^2 + 81*z^3, 248166372176*z^3, 9*x^2 - y*z, y^2 + z^2, x*z + | ||
| 2233497349581*y*z, 248166372176*y*z] | ||
| [2*z^4, y*z^2 + 81*z^3, 248166372176*z^3, 9*x^2 + 2233497349583*y*z, y^2 + z^2, x*z + 2233497349581*y*z, 248166372176*y*z] |
There was a problem hiding this comment.
This time around the new behavior is worse. Thoughts?
p/s. See also #39018
|
Should be fixed now. I clean up the code:
Looks like Side note: I don't think correct handling of ctrl-c work yet. |
|
Alright, ctrl-c should works properly now. Nevertheless, note that most interruptibility tests in SageMath are not that useful — those which are useful must run >10 minutes if not interrupted; in other words, the tests with In some cases, I delete checks like Related: my write-up on Let's see if the tests pass. p/s there's no interrupt test for |
|
The failure is sage -t --long --warn-long 30.0 --random-seed=286735480429121101562228604801325644303 src/sage/rings/polynomial/polynomial_element.pyx # Timed outLooks irrelevant. Also I can't reproduce it locally. On the other hand the Conda 3.11 exception is LogIt does pertain to singular, but looks like it comes from the line maybe the library is somehow just nonexistent on Conda? (weird?) The Conda 3.9 exception is Logwhich… is pretty weird because as far as I can see all route leads to that line must have filled in that attribute already. → → Unless one of the following lines can error out. (my best guess is Edit: actually thinking about it the test server is passing |
|
Maybe @mantepse would be interested in reviewing? |
| _res = self.call_handler.handle_call(argument_list, si_ring) | ||
| sig_off() | ||
| finally: | ||
| s = check_error() |
There was a problem hiding this comment.
maybe a more descriptive name, e.g., e, or error, instead of s would be good?
| if currentVoice: | ||
| currentVoice = NULL |
There was a problem hiding this comment.
I could not find any use of currentVoice within sage, do you know what this is? (It does appear in local/include/singular/Singular/sdb.h and local/include/singular/Singular/fevoices.h)
There was a problem hiding this comment.
No idea, but given the naming, my best guess is "who is speaking to Singular" i.e. "where is Singular taking commands from". The example has currentVoice=feInitStdin(NULL); (read: stdin) and we certainly don't want it to read from stdin.
6babf2c to
55b698f
Compare
Wow, you are quick. For reference: cython/cython#6546 |
mantepse
left a comment
There was a problem hiding this comment.
Thank you! To me this looks good. However, since I feel not qualified enough, I'll ask for an additional look, let's say, within a week, on sage-devel. Otherwise I'll carry the responsibility :-)
sagemathgh-39075: Allow more rings to be used with libsingular & rework signal detection system Somewhat related: sagemath#33319 Anyway, this allows many more rings to be used with libsingular. Previously it fallback to the expect interface. It seems weird that both Sage and Singular has different types for `GF(5)` and `Zmod(5)`, but okay. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39075 Reported by: user202729 Reviewer(s): Martin Rubey, user202729
|
I'm getting (possibly computer too fast? Ryzen 9900X) |
|
Sounds about right. I already made the buffer 2× on my computer though. Will make it 4×. |
sagemathgh-40855: Fix singular Z2m ring creation and polynomial comparison See the new test, previously it fails. The `n_Z2m` ring creation is caused by sagemath#39075. Singular source code contains ``` // is exponent <=2^(8*sizeof(unsigned long)) mp_bitcnt_t l=mpz_scan1 (modBase,0); if ((l>0) && (l<=8*sizeof(unsigned long))) { ``` so the limit is taken from there. The polynomial comparison fix is workaround for Singular/Singular#1293. sagemath#39018 touches this part of the code, although I think it doesn't introduce the bug. Fix sagemath#40838 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40855 Reported by: user202729 Reviewer(s): Travis Scrimshaw
sagemathgh-40855: Fix singular Z2m ring creation and polynomial comparison See the new test, previously it fails. The `n_Z2m` ring creation is caused by sagemath#39075. Singular source code contains ``` // is exponent <=2^(8*sizeof(unsigned long)) mp_bitcnt_t l=mpz_scan1 (modBase,0); if ((l>0) && (l<=8*sizeof(unsigned long))) { ``` so the limit is taken from there. The polynomial comparison fix is workaround for Singular/Singular#1293. sagemath#39018 touches this part of the code, although I think it doesn't introduce the bug. Fix sagemath#40838 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40855 Reported by: user202729 Reviewer(s): Travis Scrimshaw
sagemathgh-40855: Fix singular Z2m ring creation and polynomial comparison See the new test, previously it fails. The `n_Z2m` ring creation is caused by sagemath#39075. Singular source code contains ``` // is exponent <=2^(8*sizeof(unsigned long)) mp_bitcnt_t l=mpz_scan1 (modBase,0); if ((l>0) && (l<=8*sizeof(unsigned long))) { ``` so the limit is taken from there. The polynomial comparison fix is workaround for Singular/Singular#1293. sagemath#39018 touches this part of the code, although I think it doesn't introduce the bug. Fix sagemath#40838 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40855 Reported by: user202729 Reviewer(s): Travis Scrimshaw
Somewhat related: #33319
Anyway, this allows many more rings to be used with libsingular. Previously it fallback to the expect interface.
It seems weird that both Sage and Singular has different types for
GF(5)andZmod(5), but okay.📝 Checklist
⌛ Dependencies