#9054: create a class for basic function_field arithmetic for Sage
---------------------------------------------------------------------------------+
Reporter: was
| Owner: was
Type: enhancement
| Status: new
Priority: major
| Milestone: sage-wishlist
Component: algebra
| Resolution:
Keywords:
| Work_issues:
Upstream: N/A
| Reviewer:
Author: William Stein, Robert Bradshaw, Maarten Derickx, Moritz Minzlaff
| Merged:
Dependencies: #9094, #11034
|
---------------------------------------------------------------------------------+
Comment(by SimonKing):
I really think that `is_Ring` should be ''globally'' improved. For
example, it already helps to define
{{{
def is_Ring(x):
"""
Return True if x is a ring.
EXAMPLES::
sage: from sage.rings.ring import is_Ring
sage: is_Ring(ZZ)
True
"""
if isinstance(x, Ring):
return True
from sage.categories.rings import Rings
return x in Rings()
}}}
hence, only do the import when needed.
The timings become
{{{
sage: from sage.rings.ring import is_Ring
sage: P.<x,y,z> = QQ[]
sage: is_Ring(P)
True
sage: %timeit is_Ring(P)
625 loops, best of 3: 243 ns per loop
sage: MS = MatrixSpace(QQ,2)
sage: is_Ring(MS)
True
sage: %timeit is_Ring(MS)
625 loops, best of 3: 21.5 µs per loop
}}}
versus
{{{
sage: from sage.rings.ring import is_Ring
sage: sage: P.<x,y,z> = QQ[]
sage: is_Ring(P)
True
sage: %timeit is_Ring(P)
625 loops, best of 3: 4.93 µs per loop
sage: MS = MatrixSpace(QQ,2)
sage: sage: is_Ring(MS)
True
sage: %timeit is_Ring(MS)
625 loops, best of 3: 26.4 µs per loop
}}}
But I think I'll move it to #10667.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9054#comment:46>
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.