Opened 12 years ago
Closed 12 years ago
#10468 closed defect (fixed)
Cache of infinite polynomial rings is broken
Reported by: | Simon King | Owned by: | Martin Albrecht |
---|---|---|---|
Priority: | major | Milestone: | sage-4.6.2 |
Component: | commutative algebra | Keywords: | infinite polynomial ring cache |
Cc: | Merged in: | sage-4.6.2.alpha1 | |
Authors: | Simon King | Reviewers: | Mike Hansen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
At #10467, I had some example of a computation of a symmetric Gröbner basis of an ideal in an infinite polynomial ring; the patch there provided quite a speedup.
However, I found that the actual reason for the original slowness is the fact that in the method tensor_with_ring
, the InfinitePolynomialRing
constructor is not used. Therefore, (a) the cache breaks, and (b) much time is wasted by creating the same infinite polynomial ring over and over again. Here is a new patch, independent of #10467, solving the issue.
Without the patch:
sage: R.<x,y> = InfinitePolynomialRing(QQ) sage: R.tensor_with_ring(QQ) is R False sage: I = R.ideal([x[1]^2+y[2]*y[3], x[2]*y[1]*x[3]-y[1]*y[2]]) sage: %time I.groebner_basis() CPU times: user 23.09 s, sys: 0.02 s, total: 23.11 s Wall time: 23.67 s [y_2*y_1^3 + y_2*y_1^2, y_2^2*y_1 - y_2*y_1^2, y_3*y_1 - y_2*y_1, x_1*y_2*y_1^2 + x_1*y_2*y_1, x_1^2 + y_2*y_1, x_2*y_2*y_1 - x_1*y_2*y_1, x_2*x_1*y_3 - y_2*y_1, x_3*y_2*y_1 - x_1*y_2*y_1, x_3*x_1*y_2 - y_2*y_1, x_3*x_2*y_1 - y_2*y_1]
With the new patch:
sage: R.<x,y> = InfinitePolynomialRing(QQ) sage: R.<x,y> = InfinitePolynomialRing(QQ) sage: R.tensor_with_ring(QQ) is R True sage: I = R.ideal([x[1]^2+y[2]*y[3], x[2]*y[1]*x[3]-y[1]*y[2]]) sage: %time I.groebner_basis() CPU times: user 1.68 s, sys: 0.02 s, total: 1.70 s Wall time: 2.17 s [y_2*y_1^3 + y_2*y_1^2, y_2^2*y_1 - y_2*y_1^2, y_3*y_1 - y_2*y_1, x_1*y_2*y_1^2 + x_1*y_2*y_1, x_1^2 + y_2*y_1, x_2*y_2*y_1 - x_1*y_2*y_1, x_2*x_1*y_3 - y_2*y_1, x_3*y_2*y_1 - x_1*y_2*y_1, x_3*x_1*y_2 - y_2*y_1, x_3*x_2*y_1 - y_2*y_1]
The fix is doc tested.
Attachments (1)
Change History (9)
Changed 12 years ago by
Attachment: | 10468_infinite_polynomial_ring_cache.patch added |
---|
comment:1 Changed 12 years ago by
Status: | new → needs_review |
---|
comment:4 Changed 12 years ago by
Milestone: | → sage-4.6.1 |
---|
Since it has a positive review, I choose the next possible milestone.
comment:5 Changed 12 years ago by
Milestone: | sage-4.6.1 → sage-4.6.2 |
---|
comment:6 Changed 12 years ago by
Reviewers: | → Mike Hansen |
---|
comment:8 Changed 12 years ago by
Merged in: | → sage-4.6.2.alpha1 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Use the InfinitePolynomialRing? constructor in the tensor_with_ring methods