Skip to content

Commit

Permalink
Fixed random_element() for rational quaternionic fractional ideals
Browse files Browse the repository at this point in the history
Added QuaternionFractionalIdeal_rational.random_element() to overwrite the ideal.random_element()-method, which doesn't work for fractional ideals; fixed whitespace detected by Lint checks.
  • Loading branch information
S17A05 committed Jan 19, 2024
1 parent 439065e commit 22f63e0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,20 @@ def __repr__(self):
"""
return 'Fractional ideal %s' % (self.gens(),)

def random_element(self, *args, **kwds):
"""
Return a random element in the rational fractional ideal ``self``.
EXAMPLES::
sage: B.<i,j,k> = QuaternionAlgebra(211)
sage: I = B.ideal([1, 1/4*j, 20*(i+k), 2/3*i])
sage: x = I.random_element() # random
sage: x in I
True
"""
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
Expand Down

0 comments on commit 22f63e0

Please sign in to comment.