Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fix repr sorting issue and add some small tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkarn committed Jun 21, 2022
1 parent be97491 commit b1eca07
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/sage/algebras/clifford_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def list(self):
sage: elt.list()
[(1, 5), (01, 1)]
"""
return sorted(self._monomial_coefficients.items(), key=lambda m_c : (-len(m_c[0]), m_c))
return sorted(self._monomial_coefficients.items(), key=lambda m : (-len(m[0]), list(m[0])))

def support(self):
"""
Expand All @@ -197,7 +197,7 @@ def support(self):
sage: elt.support()
[1, 01]
"""
return sorted(self._monomial_coefficients.keys(), key=lambda x: (-len(x), x))
return sorted(self._monomial_coefficients.keys(), key=lambda x: (-len(x), list(x)))

def reflection(self):
r"""
Expand Down Expand Up @@ -545,8 +545,7 @@ def __init__(self, Q, names, category=None):
sage: Q = QuadraticForm(ZZ, 9)
sage: Cl = CliffordAlgebra(Q)
sage: ba = Cl.basis().keys()
sage: all( tuple(sorted(S)) in ba
....: for S in Subsets(range(9)) )
sage: all(FrozenBitset(format(i,'b')[::-1]) in ba for i in range(2**9))
True
"""
self._quadratic_form = Q
Expand Down Expand Up @@ -583,6 +582,8 @@ def _repr_term(self, m):
sage: Cl.<x,y,z> = CliffordAlgebra(Q)
sage: Cl._repr_term((0,2))
'x*z'
sage: Cl._repr_term(FrozenBitset('101'))
'x*z'
sage: Cl._repr_term(())
'1'
sage: Cl._repr_term((1,))
Expand Down

0 comments on commit b1eca07

Please sign in to comment.