aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mdpoly/abc.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mdpoly/abc.py b/mdpoly/abc.py
index 56507d6..77285aa 100644
--- a/mdpoly/abc.py
+++ b/mdpoly/abc.py
@@ -54,6 +54,7 @@ class Expr(Protocol):
class Repr(Protocol):
"""
Representation of a polynomial expression.
+
"""
@abstractmethod
def at(self, entry: MatrixIndex, term: PolyIndex) -> Number:
@@ -63,6 +64,10 @@ class Repr(Protocol):
def set(self, entry: MatrixIndex, term: PolyIndex, value: Number) -> None:
""" Set value of polynomial entry """
+ def is_zero(self, entry: MatrixIndex, term: PolyIndex, eps: Number = NUMERICS_EPS) -> bool:
+ """ Check if a polynomial entry is zero """
+ return self.at(entry, term) < eps
+
@abstractmethod
def set_zero(self, entry: MatrixIndex, term: PolyIndex) -> None:
""" Set an entry to zero """