-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Raise an overflow error if the exponent of a multivariate polynomial flows over #11856
Comments
Author: Simon King |
comment:1
The attached patch seems to solve the problem. It wraps the attribute With the patch, I get (as a new doctest):
I did not run the doc tests yet, but I think a reviewer can already have a look on it. I wonder, though, whether the speed will be fine: I use the |
comment:2
It seems |
comment:3
I did some tests with Cython functions either testing whether (for cdefined a,b,c) we have I don't know whether max_exponent_size is used somewhere else. |
comment:4
Very tricky. Singular correctly computes
So, internally the degree is correct. Even more tricky: In the case of
That happens when I remove the max_exponent_size. I suppose I shouldd revert that removal... |
comment:5
The latest patch version checks both whether the exponent exceeds max_exponent_size (which avoids some bugs that occur in Singular) and whether it is illegal in Singular (which avoids the bugs in Sage that led to the creation of this ticket). We now have
I wonder whether the test, that became more expensive, led to an inacceptable speed regression. That should be investigated. The tests in sage/rings/polynomial pass for me. I don't know about the rest. Needs review! |
comment:6
Code looks okay. So modulo the possible speed regression and doctests passing this should get a positive review. |
comment:7
Here are some timings. With the patch:
Without the patch:
These are only few data points, but they seem to show that the overhead is sufficiently small. |
Reviewer: Martin Albrecht |
comment:10
Alexander found (while reviewing #4539) that the patch from here results in two doctest errors on 32-bit machines (reasonable, since an overflow error will occur earlier on 32 bit than on 64 bit). He provided a fix at #4539, but actually I think it should be included here. What do people think? |
Work Issues: 32bit doctests |
comment:12
Replying to @simon-king-jena:
Indeed, I also had to apply https://github.com/sagemath/sage-prod/files/10642668/trac4539_fix_docs_32bit.patch.gz here for 32-bit systems. So, I think, it is necessary. BTW: it seems that this ticket depends on #11115. |
comment:13
Replying to @alexanderdreyer:
What ticket are you referring to by "this"? If "this" is #4539: #4539 depends on #11068, which depends on #11115. But if "this" is #11856 then I don't see a dependency. What do you mean? Is there fuzz when applying my or your patch? Does it not work without #11115? |
comment:14
I just tested: attachment: trac11856_exponent_overflow.patch followed by trac4539_fix_docs_32bit.patch cleanly applies to sage-4.7.2.alpha3-prerelease. Thus, if Alexander finds that trac4539_fix_docs_32bit.patch fixes the problem on 32-bit (I can not test it, myself), then I suggest that Alexander's patch should be moved from #4539 to here and turned into a reviewer patch; and if Alexander says that it is fixed, then we should return to a positive review. |
comment:15
Indeed, I thought that #11856 would depend on #11115. But it turned out, that my Sage becomes corrupted when popping the patches of. #11115. So starting with a brand new clone of devel/sage-main does the trick. So I can confirm, https://github.com/sagemath/sage-prod/files/10642668/trac4539_fix_docs_32bit.patch.gz fixes the problem on 23 Bit platforms. |
Changed reviewer from Martin Albrecht to Martin Albrecht, Alexander Dreyer |
This comment has been minimized.
This comment has been minimized.
comment:17
Let's try to sort things out: The patch that Alexander posted at #4539 should better be a reviewer patch here. Thus, I copied his patch, added a commit message, and posted it here under a new name reflecting the ticket number. The positive review can be kept (I hope we agree on that), and: Apply trac11856_exponent_overflow.patch trac11856_fix_docs_32bit.patch |
Changed work issues from 32bit doctests to none |
This comment has been minimized.
This comment has been minimized.
comment:19
This seems to conflict with #11339. |
Work Issues: Conflict with #11339 |
comment:20
The first patch has been rebased on top of #11339. The patch from #11339 did some cosmetic changes, such as replacing Since it is a very simple editorial change, without changing the code, I am directly reinstating the positive review. Apply trac11856_exponent_overflow.patch trac11856_fix_docs_32bit.patch |
Dependencies: #11339 |
Changed work issues from Conflict with #11339 to none |
Changed dependencies from #11339 to none |
Work Issues: Rebase without #11339 |
Changed work issues from Rebase without #11339 to none |
comment:24
Since this ticket fixes a critical bug, I think it would be good to merge it in sage-4.7.2, rather than waiting for 4.7.3. Since #11339 seems to need work, I returned to the original first patch and hope that it is ok to renew Martin's and Alexander's positive review. Apply trac11856_exponent_overflow.patch trac11856_fix_docs_32bit.patch |
Mimmick Singular's exponent overflow check but still avoids some bugs that Singular provides |
Dependencies: #10903 |
comment:25
Attachment: trac11856_exponent_overflow.patch.gz It seems that I should not have rebased my ticket wrt #11339, but wrt #10903 (which in turn has #11339 as a dependency). Namely, #11339 only works together with #10903. Solution: Both #11339 and #10903 have a positive review. Hence, it is fine to make #10903 (and thus #11339 by transitivity) a dependency. Running doctests now, again. Apply trac11856_exponent_overflow.patch trac11856_fix_docs_32bit.patch |
comment:26
FWIW: The doctests are fine. So, it is justified to keep the positive review of Martin and Alexander. |
Merged: sage-4.7.2.alpha4 |
The following happens at least since sage-4.6.2 and was detected in #4539 by a new doctest:
According to Hans, the maximal exponent of a variable in a monomial does depend on the number of variables in the ring. There is no function that returns that maximal exponent, but it is stored in the
bitmask
attribute of a ring. The Singular interpreter actually only tests whether the total degree is below what is provided by bitmask; in theory, any exponent (not only the totall degree) can go up to that bound.Here is the corresponding code in Singular's
iparith.cc
:Apply
Depends on #10903
CC: @malb @burcin @alexanderdreyer @sagetrac-jakobkroeker
Component: commutative algebra
Keywords: exponent overflow
Author: Simon King
Reviewer: Martin Albrecht, Alexander Dreyer
Merged: sage-4.7.2.alpha4
Issue created by migration from https://trac.sagemath.org/ticket/11856
The text was updated successfully, but these errors were encountered: