Skip to content

Commit

Permalink
Implemented reviewer feedback
Browse files Browse the repository at this point in the history
- Blank spaces in error warning
- Matrix definition
- List comprehension for discriminant computation, also updated in `.discriminant()` of an order
  • Loading branch information
S17A05 committed Apr 5, 2024
1 parent 08004b7 commit 71d8184
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,8 @@ def maximal_order(self, take_shortcuts=True):
True
"""
if self.base_ring() != QQ:
raise NotImplementedError("maximal order only implemented for"
" rational quaternion algebras")
raise NotImplementedError("maximal order only implemented for "
"rational quaternion algebras")

d_A = self.discriminant()

Expand Down Expand Up @@ -914,13 +914,8 @@ def maximal_order(self, take_shortcuts=True):

# Since e might not define an order at this point, we need to
# manually calculate the updated discriminant
L = []
for x in e:
MM = []
for y in e:
MM.append(x.pair(y))
L.append(MM)
disc = (MatrixSpace(QQ, 4, 4)(L)).determinant().sqrt()
L = [[x.pair(y) for y in e] for x in e]
disc = matrix(QQ, 4, 4, L).determinant().sqrt()

e_new_gens.extend(e[1:])

Expand Down Expand Up @@ -1826,14 +1821,9 @@ def discriminant(self):
sage: type(S.discriminant())
<... 'sage.rings.rational.Rational'>
"""
L = []
for d in self.basis():
MM = []
for e in self.basis():
MM.append(d.pair(e))
L.append(MM)

return (MatrixSpace(QQ, 4, 4)(L)).determinant().sqrt()
e = self.basis()
L = [[x.pair(y) for y in e] for x in e]
return matrix(QQ, 4, 4, L).determinant().sqrt()

def is_maximal(self):
r"""
Expand Down

0 comments on commit 71d8184

Please sign in to comment.