Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define behaviour of < and > for fractional ideals in a quaternion algebra #37113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2393,8 +2393,35 @@

sage: I != I # indirect doctest
False

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L2396 was not covered by tests
TESTS::

sage: B = QuaternionAlgebra(QQ,-1,-11)
sage: i,j,k = B.gens()
sage: I = B.ideal([1,i,j,i*j])
sage: I == I
True
sage: O = B.ideal([1,i,(i+j)/2,(1+i*j)/2])
sage: I <= O
True
sage: I >= O
False
sage: I != O
True
sage: I == O
False
sage: I != I
False
sage: I < I
False
sage: I < O
True
sage: I <= I
True
sage: O >= O
True
"""
return self.basis_matrix()._richcmp_(right.basis_matrix(), op)
return self.free_module().__richcmp__(right.free_module(), op)

def __hash__(self):
"""
Expand Down
5 changes: 4 additions & 1 deletion src/sage/modular/quatalg/brandt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,10 @@ def right_ideals(self, B=None):
ideals_theta[J_theta] = [J]
verbose("found %s of %s ideals" % (len(ideals), self.dimension()), level=2)
if len(ideals) >= self.dimension():
ideals = tuple(sorted(ideals))
# order by basis matrix (as ideals were previously
# ordered) for backward compatibility and
# deterministic order of the output
ideals = tuple(sorted(ideals, key=lambda x: x.basis_matrix()))
self.__right_ideals = ideals
return ideals
got_something_new = True
Expand Down
Loading