From be8089501fb43757043f6f53d6526b7792eaa350 Mon Sep 17 00:00:00 2001 From: Sebastian Spindler Date: Sat, 3 Feb 2024 02:53:11 +0100 Subject: [PATCH] Added check for fractional ideal basis length, removed "local" checks --- src/sage/algebras/quatalg/quaternion_algebra.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index a03b2e12208..3b63c2a98b6 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -2331,6 +2331,8 @@ def __init__(self, Q, basis, left_order=None, right_order=None, check=True): raise TypeError("basis must be a list or tuple") basis = tuple([Q(v) for v in (QQ**4).span([Q(v).coefficient_tuple() for v in basis], ZZ).basis()]) + if len(basis) != 4: + raise ValueError("fractional ideal must have rank 4") self.__left_order = left_order self.__right_order = right_order Ideal_fractional.__init__(self, Q, basis) @@ -2657,7 +2659,7 @@ def basis_matrix(self): def reduced_basis(self): r""" - Let `I` = ``self`` be a rank 4 quaternion ideal in a definite quaternion algebra. + Let `I` = ``self`` be a fractional ideal in a (rational) definite quaternion algebra. This function returns an LLL reduced basis of I. OUTPUT: @@ -2682,9 +2684,6 @@ def reduced_basis(self): sage: I.reduced_basis()[0] 1/2*i + j + 5/2*k """ - if len(self.basis()) < 4: - raise ValueError("basis must have rank 4") - if not self.quaternion_algebra().is_definite(): raise TypeError("The quaternion algebra must be definite") @@ -3252,9 +3251,6 @@ def is_principal(self, certificate=False): raise NotImplementedError('principality test not implemented in' ' indefinite quaternion algebras') - if len(self.basis()) < 4: - raise ValueError("basis must have rank 4") - c = self.theta_series_vector(2)[1] if not certificate: return c != 0