Skip to content

Commit

Permalink
Added check for fractional ideal basis length, removed "local" checks
Browse files Browse the repository at this point in the history
  • Loading branch information
S17A05 committed Feb 3, 2024
1 parent 92d03a9 commit be80895
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check warning on line 2335 in src/sage/algebras/quatalg/quaternion_algebra.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/quatalg/quaternion_algebra.py#L2335

Added line #L2335 was not covered by tests
self.__left_order = left_order
self.__right_order = right_order
Ideal_fractional.__init__(self, Q, basis)
Expand Down Expand Up @@ -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:
Expand All @@ -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")

Check warning on line 2688 in src/sage/algebras/quatalg/quaternion_algebra.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/quatalg/quaternion_algebra.py#L2688

Added line #L2688 was not covered by tests

Expand Down Expand Up @@ -3252,9 +3251,6 @@ def is_principal(self, certificate=False):
raise NotImplementedError('principality test not implemented in'

Check warning on line 3251 in src/sage/algebras/quatalg/quaternion_algebra.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/quatalg/quaternion_algebra.py#L3251

Added line #L3251 was not covered by tests
' 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
Expand Down

0 comments on commit be80895

Please sign in to comment.