Skip to content

Commit

Permalink
some fixes in function fields
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Feb 6, 2024
1 parent a7c11be commit 55226d6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
55 changes: 0 additions & 55 deletions src/sage/categories/rings.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,61 +795,6 @@ def ideal(self, *args, **kwds):
gens = gens[0]
return C(self, gens, **kwds)

def _ideal_class_(self, n=0):
"""
Return the class that is used to implement ideals of this ring.
.. NOTE::
We copy the code from :class:`~sage.rings.ring.Ring`. This is
necessary because not all rings inherit from that class, such
as matrix algebras.
INPUT:
- ``n`` (optional integer, default 0): The number of generators
of the ideal to be created.
OUTPUT:
The class that is used to implement ideals of this ring with
``n`` generators.
.. NOTE::
Often principal ideals (``n==1``) are implemented via
a different class.
EXAMPLES::
sage: MS = MatrixSpace(QQ, 2, 2) # needs sage.modules
sage: MS._ideal_class_() # needs sage.modules
<class 'sage.rings.noncommutative_ideals.Ideal_nc'>
We do not know of a commutative ring in Sage that does not inherit
from the base class of rings. So, we need to cheat in the next
example::
sage: super(Ring,QQ)._ideal_class_.__module__
'sage.categories.commutative_rings'
sage: super(Ring,QQ)._ideal_class_()
<class 'sage.rings.ideal.Ideal_generic'>
sage: super(Ring,QQ)._ideal_class_(1)
<class 'sage.rings.ideal.Ideal_principal'>
sage: super(Ring,QQ)._ideal_class_(2)
<class 'sage.rings.ideal.Ideal_generic'>
"""
from sage.rings.noncommutative_ideals import Ideal_nc
try:
if not self.is_commutative():
return Ideal_nc
except (NotImplementedError, AttributeError):
return Ideal_nc
from sage.rings.ideal import Ideal_generic, Ideal_principal
if n == 1:
return Ideal_principal
return Ideal_generic

##
# Quotient rings
def quotient(self, I, names=None, **kwds):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def __init__(self, R):
sage: M = O.ideal_monoid()
sage: TestSuite(M).run()
"""
self.Element = R._ideal_class
self.Element = R._ideal_class_
Parent.__init__(self, category=Monoids())

self.__R = R
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, field, ideal_class=FunctionFieldIdeal, category=None):
category = IntegralDomains().or_subcategory(category).Infinite()
Parent.__init__(self, category=category, facade=field)

self._ideal_class = ideal_class # element class for parent ideal monoid
self._ideal_class_ = ideal_class # element class for parent ideal monoid
self._field = field

def is_field(self, proof=True):
Expand Down

0 comments on commit 55226d6

Please sign in to comment.