#10468: Cache of infinite polynomial rings is broken
-----------------------------------+----------------------------------------
Reporter: SimonKing | Owner: malb
Type: defect | Status: new
Priority: major | Milestone:
Component: commutative algebra | Keywords: infinite polynomial ring
cache
Author: Simon King | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------------+----------------------------------------
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.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10468>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.