diff options
Diffstat (limited to '')
-rw-r--r-- | mdpoly/abc.py | 10 | ||||
-rw-r--r-- | mdpoly/representations.py | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/mdpoly/abc.py b/mdpoly/abc.py index 1ceac87..618d3cd 100644 --- a/mdpoly/abc.py +++ b/mdpoly/abc.py @@ -73,6 +73,16 @@ class Expr(Protocol): It can also be used for more advanced replacements since ``old`` and ``new`` are free to be any expression. """ + # FIXME: this doesn't work if old is something like y ** 2, + # TODO: Define equality on expr object + if not isinstance(old, Leaf): + import warnings + warnings.warn( + "FIXME: You are trying to replace an expression with another " + "expression, but this does not work yet. Currently it is only " + "possible to replace leaves (Variable, Constant, Parameter) with " + "leaves / expressions.") + def replace_all(node): if node == old: return new diff --git a/mdpoly/representations.py b/mdpoly/representations.py index 802167b..da038bd 100644 --- a/mdpoly/representations.py +++ b/mdpoly/representations.py @@ -20,6 +20,7 @@ class HasRepr(Protocol): See also :py:class:`mdpoly.state.State`. """ + class SparseRepr(Repr): """ Sparse representation of polynomial. """ |