Skip to content

Commit

Permalink
use strings as labels
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Jan 9, 2025
1 parent 2f6971c commit 180cef2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/sage/operads/associative_operad.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def associative_product(self, x, y):
sage: A.associative_product(x, y)
B[word: abdc]
"""
gen = self.basis()[self.basis().keys()([0, 1])]
return gen.compose(x, 0).compose(y, 1)
gen = self.basis()[self.basis().keys()(["0", "1"])]
return gen.compose(x, "0").compose(y, "1")

def operad_generators(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/operads/commutative_operad.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def commutative_product(self, x, y):
sage: A.commutative_product(x, y)
B[word: abcd]
"""
gen = self.basis()[self.basis().keys()([0, 1])]
return gen.compose(x, 0).compose(y, 1)
gen = self.basis()[self.basis().keys()(["0", "1"])]
return gen.compose(x, "0").compose(y, "1")

def operad_generators(self):
"""
Expand Down
30 changes: 15 additions & 15 deletions src/sage/operads/dendriform_operad.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ def pre_Lie_product(self, x, y):
-B[a[b[., .], c[d[., .], .]]] + B[a[c[d[., .], b[., .]], .]] + B[a[b[c[d[., .], .], .], .]]
"""
LT = self.basis().keys()
expr = self.monomial(LT([LT([], label=1), None], label=0)) - self.monomial(LT([None, LT([], label=1)], label=0))
return expr.compose(x, 0).compose(y, 1)
expr = self.monomial(LT([LT([], label="1"), None], label="0")) - self.monomial(LT([None, LT([], label="1")], label="0"))
return expr.compose(x, "0").compose(y, "1")

def associative_product(self, x, y):
"""
Expand All @@ -253,8 +253,8 @@ def associative_product(self, x, y):
B[a[b[., .], c[d[., .], .]]] + B[c[a[b[., .], d[., .]], .]] + B[c[d[a[b[., .], .], .], .]]
"""
LT = self.basis().keys()
expr = self.monomial(LT([LT([], label=0), None], label=1)) + self.monomial(LT([None, LT([], label=1)], label=0))
return expr.compose(x, 0).compose(y, 1)
expr = self.monomial(LT([LT([], label="0"), None], label="1")) + self.monomial(LT([None, LT([], label="1")], label="0"))
return expr.compose(x, "0").compose(y, "1")

def chosen_product(self, x, y, name='assoc'):
"""
Expand Down Expand Up @@ -285,18 +285,18 @@ def chosen_product(self, x, y, name='assoc'):
"""
LT = self.basis().keys()
if name == 'assoc':
expr = self.monomial(LT([LT([], label=0), None], label=1))
expr += self.monomial(LT([None, LT([], label=1)], label=0))
expr = self.monomial(LT([LT([], label="0"), None], label="1"))
expr += self.monomial(LT([None, LT([], label="1")], label="0"))
elif name == 'prelie':
expr = self.monomial(LT([LT([], label=1), None], label=0))
expr -= self.monomial(LT([None, LT([], label=1)], label=0))
expr = self.monomial(LT([LT([], label="1"), None], label="0"))
expr -= self.monomial(LT([None, LT([], label="1")], label="0"))
elif name == 'lie':
expr = self.monomial(LT([LT([], label=0), None], label=1))
expr += self.monomial(LT([None, LT([], label=1)], label=0))
expr -= self.monomial(LT([LT([], label=1), None], label=0))
expr -= self.monomial(LT([None, LT([], label=0)], label=1))
expr = self.monomial(LT([LT([], label="0"), None], label="1"))
expr += self.monomial(LT([None, LT([], label="1")], label="0"))
expr -= self.monomial(LT([LT([], label="1"), None], label="0"))
expr -= self.monomial(LT([None, LT([], label="0")], label="1"))
elif name == 'left_dend':
expr = self.monomial(LT([LT([], label=0), None], label=1))
expr = self.monomial(LT([LT([], label="0"), None], label="1"))
elif name == 'right_dend':
expr = self.monomial(LT([None, LT([], label=1)], label=0))
return expr.compose(x, 0).compose(y, 1)
expr = self.monomial(LT([None, LT([], label="1")], label="0"))
return expr.compose(x, "0").compose(y, "1")
4 changes: 2 additions & 2 deletions src/sage/operads/free_operad.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def magmatic_product(self, x, y):
B[@[a[b[]], c[d[]]]]
"""
LT = self.basis().keys()
t = LT([LT([], label=0), LT([], label=1)], label='@')
t = LT([LT([], label="0"), LT([], label="1")], label='@')
gen = self.monomial(t)
return gen.compose(x, 0).compose(y, 1)
return gen.compose(x, "0").compose(y, "1")

def operad_morphism_on_basis(self, t, cod, fun=None):
"""
Expand Down

0 comments on commit 180cef2

Please sign in to comment.