Skip to content

Commit

Permalink
gh-37088: Remove deprecated methods from QuaternionFractionalIdeal_ra…
Browse files Browse the repository at this point in the history
…tional

    
This removes two methods of `QuaternionFractionalIdeal_rational`
deprecated in #31583 (because of ambiguous behaviour; both could return
either the left or the right order):
- `quaternion_order()`; users should call `left_order()` or
`right_order()` as appropriate
- `ring()`; calling `ring()` still works but calls the method from the
parent class, which returns the ambient quaternion algebra.
    
URL: #37088
Reported by: Peter Bruin
Reviewer(s):
  • Loading branch information
Release Manager committed Feb 1, 2024
2 parents e03f1b8 + bba916a commit d36263f
Showing 1 changed file with 3 additions and 66 deletions.
69 changes: 3 additions & 66 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2164,18 +2164,16 @@ def quaternion_algebra(self):
"""
Return the ambient quaternion algebra that contains this fractional ideal.
OUTPUT: a quaternion algebra
This is an alias for `self.ring()`.
EXAMPLES::
sage: I = BrandtModule(3,5).right_ideals()[1]; I
sage: I = BrandtModule(3, 5).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
sage: I.quaternion_algebra()
Quaternion Algebra (-1, -3) with base ring Rational Field
"""
# TODO: when the ring() method is removed from this class, the
# following line can be changed to self.ring().
return Ideal_fractional.ring(self)
return self.ring()

def _compute_order(self, side='left'):
r"""
Expand Down Expand Up @@ -2334,67 +2332,6 @@ def random_element(self, *args, **kwds):
"""
return sum(ZZ.random_element(*args, **kwds) * g for g in self.gens())

def quaternion_order(self):
"""
Return the order for which this ideal is a left or right
fractional ideal.
If this ideal has both a left and right
ideal structure, then the left order is returned. If it has
neither structure, then an error is raised.
OUTPUT: QuaternionOrder
EXAMPLES::
sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.unit_ideal().quaternion_order() is R
doctest:...: DeprecationWarning: quaternion_order() is deprecated,
please use left_order() or right_order()
See https://github.com/sagemath/sage/issues/31583 for details.
True
"""
from sage.misc.superseded import deprecation
deprecation(31583, 'quaternion_order() is deprecated, please use left_order() or right_order()')
try:
return self.__quaternion_order
except AttributeError:
pass
if self.__left_order is not None:
A = self.__left_order
elif self.__right_order is not None:
A = self.__right_order
else:
raise RuntimeError("unable to determine quaternion order of ideal without known order")
self.__quaternion_order = A
return A

def ring(self):
"""
Return ring that this is a fractional ideal for.
The :meth:`ring` method will be removed from this class in the
future. Calling :meth:`ring` will then return the ambient
quaternion algebra. This is consistent with the behaviour for
number fields.
EXAMPLES::
sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.unit_ideal().ring() is R
doctest:...: DeprecationWarning: ring() will return the quaternion algebra in the future, please use left_order() or right_order()
See https://github.com/sagemath/sage/issues/31583 for details.
True
"""
from sage.misc.superseded import deprecation
deprecation(31583, 'ring() will return the quaternion algebra in the future, please use left_order() or right_order()')
if self.__left_order is not None:
return self.__left_order
elif self.__right_order is not None:
return self.__right_order
else:
raise RuntimeError("unable to determine quaternion order of ideal without known order")

def basis(self):
"""
Return a basis for this fractional ideal.
Expand Down

0 comments on commit d36263f

Please sign in to comment.