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

Commit 1550f9d

Browse files
committed
Fix coboundary on basis
1 parent b2f9f50 commit 1550f9d

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/sage/algebras/clifford_algebra.py

+17-13
Original file line numberDiff line numberDiff line change
@@ -2845,23 +2845,27 @@ def _on_basis(self, m):
28452845
cc = self._cos_coeff
28462846
keys = cc.keys()
28472847

2848-
s = E.base_ring().zero()
2848+
tot = E.zero()
28492849

2850-
sgn = 0
2850+
for sgn, i in enumerate(m):
2851+
k = FrozenBitset((i,))
2852+
if k in keys:
2853+
below = tuple(j for j in m if j < i)
2854+
above = tuple(j for j in m if j > i)
28512855

2852-
for i in m:
2853-
if FrozenBitset((i,)) in keys:
2854-
key_basis, key_coeff = cc[FrozenBitset((i,))].list()[0]
2855-
m_temp = Bitset(m)
2856-
if key_basis.intersection(m_temp):
2857-
continue
2858-
m_temp.discard(i)
2859-
m_temp.update(key_basis)
2856+
# a hack to deal with empty bitsets
2857+
if len(below) == 0:
2858+
below = FrozenBitset('0')
2859+
else:
2860+
below = FrozenBitset(below)
2861+
if len(above) == 0:
2862+
above = FrozenBitset('0')
2863+
else:
2864+
above = FrozenBitset(above)
28602865

2861-
s = s + (-1)**(sgn % 2) * key_coeff * E.monomial(FrozenBitset(m_temp))
2866+
tot = tot + (-1)**sgn * E.monomial(below) * cc[k] * E.monomial(above)
28622867

2863-
sgn += 1
2864-
return s
2868+
return tot
28652869

28662870
@cached_method
28672871
def chain_complex(self, R=None):

0 commit comments

Comments
 (0)