Skip to content

Commit

Permalink
fix: HochschildHomology pretty print was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
pbelmans committed Jun 7, 2024
1 parent 20bdb28 commit 87cbabf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions diamond/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,16 +1416,18 @@ def __str__(self) -> str:
EXAMPLES::
sage: from diamond import *
sage: str(HochschildHomology.from_list([1,0,22,0,1]))
' range(-2, 3) [1, 0, 22, 0, 1]\n├──────────────┼──────────────────┤'
sage: print(HochschildHomology.from_list([1,0,22,0,1]))
-2 -1 0 1 2
├────┼────┼────┼───┼───┤
1 0 22 0 1
"""
return str(self.pprint())

def __table(self):
if self.is_zero():
return table([[0], [0]], header_row=True)

indices = range(-self.dimension(), self.dimension() + 1)
indices = list(range(-self.dimension(), self.dimension() + 1))

return table([indices, [self[i] for i in indices]], header_row=True)

Expand All @@ -1443,6 +1445,7 @@ def dimension(self):
sage: h = HochschildHomology.from_list([1,0,22,0,1])
sage: h.dimension()
2
"""
if self.is_zero():
return -1
Expand Down Expand Up @@ -1517,8 +1520,9 @@ def symmetric_power(self, k):
sage: k.symmetric_power(2)
Hochschild homology vector of dimension 4
sage: print(_)
range(-4, 5) [1, 0, 23, 0, 276, 0, 23, 0, 1]
├──────────────┼─────────────────────────────────┤
-4 -3 -2 -1 0 1 2 3 4
├────┼────┼────┼────┼─────┼───┼────┼───┼───┤
1 0 23 0 276 0 23 0 1
"""

def summand(f, k):
Expand Down

0 comments on commit 87cbabf

Please sign in to comment.