aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdpoly/abc.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/mdpoly/abc.py b/mdpoly/abc.py
index 0a2e783..6637db5 100644
--- a/mdpoly/abc.py
+++ b/mdpoly/abc.py
@@ -4,10 +4,17 @@ from .index import Number, Shape, MatrixIndex, PolyIndex
from .constants import NUMERICS_EPS
from .util import iszero
-from typing import Self, Iterable, Sequence, Protocol
+from typing import Self, Iterable, Sequence
+from enum import Enum, auto
from abc import ABC, abstractmethod
+class Algebra(Enum):
+ """ Types of algebras. """
+ poly_ring = auto()
+ matrix_ring = auto()
+
+
class Leaf(ABC):
""" Leaf of the binary tree. """
name: str
@@ -27,6 +34,10 @@ class Expr(ABC):
@property
@abstractmethod
+ def algebra(self) -> Algebra: ...
+
+ @property
+ @abstractmethod
def shape(self) -> Shape:
""" Computes the shape of the expression. This method is also used to
check if the operation described by *Expr* can be perfomed with *left*