Skip to content

Commit e2f9913

Browse files
committed
PiecewiseCrazyFunction._acted_upon_: New
1 parent 145afb5 commit e2f9913

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cutgeneratingfunctionology/igp/crazy_perturbation.sage

+9
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ class PiecewiseCrazyFunction(ModuleElement):
121121

122122
_rmul_ = _lmul_
123123

124+
# Adding the following method helps the coercion system
125+
# discover the action of multiplication with a scalar that is not the base ring.
126+
def _acted_upon_(self, actor, self_on_left):
127+
r"""
128+
Multiply self by a matrix from left or right.
129+
"""
130+
return self.__class__(self.pwl * actor, [cp * actor for cp in self.crazy_pieces],
131+
parent=self.parent())
132+
124133
def __truediv__(self, other):
125134
return self * (QQ(1) / other)
126135

0 commit comments

Comments
 (0)