diff options
-rw-r--r-- | mdpoly/algebra.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mdpoly/algebra.py b/mdpoly/algebra.py index d603eee..d087785 100644 --- a/mdpoly/algebra.py +++ b/mdpoly/algebra.py @@ -202,7 +202,8 @@ class PolyRingExpr(Expr): @dataclassabc(frozen=True, repr=False) class PolyVar(Var, PolyRingExpr): """ Variable TODO: desc """ - name: str + name: str # overloads Leaf.name + shape: Shape = Shape.scalar() # ovearloads PolyRingExpr.shape def to_repr(self, repr_type: type, state: State) -> tuple[Repr, State]: r = repr_type() @@ -214,8 +215,9 @@ class PolyVar(Var, PolyRingExpr): @dataclassabc(frozen=True, repr=False) class PolyConst(Const, PolyRingExpr): """ Constant TODO: desc """ - value: Number - name: str = "" + value: Number # overloads Const.value + name: str = "" # overloads Leaf.name + shape: Shape = Shape.scalar() # ovearloads PolyRingExpr.shape def to_repr(self, repr_type: type, state: State) -> tuple[Repr, State]: r = repr_type() @@ -226,7 +228,8 @@ class PolyConst(Const, PolyRingExpr): @dataclassabc(frozen=True, repr=False) class PolyParam(Param, PolyRingExpr): """ Polynomial parameter TODO: desc """ - name: str + name: str # overloads Leaf.name + shape: Shape = Shape.scalar() # overloads PolyRingExpr.shape def to_repr(self, repr_type: type, state: State) -> tuple[Repr, State]: if self not in state.parameters: @@ -457,10 +460,9 @@ class MatConst(Const, MatrixExpr): """ A matrix constant """ - value: Sequence[Sequence[Number]] # Row major - shape: Shape - name: str = "" - algebra: Algebra = Algebra.matrix_ring + value: Sequence[Sequence[Number]] # Row major, overloads Const.value + shape: Shape # overloads Expr.shape + name: str = "" # overloads Leaf.name def to_repr(self, repr_type: type, state: State) -> tuple[Repr, State]: r = repr_type() @@ -487,9 +489,8 @@ class MatVar(Var, MatrixExpr): """ Matrix polynomial variable """ - name: str - shape: Shape - algebra: Algebra = Algebra.matrix_ring + name: str # overloads Leaf.name + shape: Shape # overloads Expr.shape def to_scalars(self, scalar_var_type: Type[T]) -> Iterable[tuple[MatrixIndex, T]]: for row in range(self.shape.rows): @@ -520,7 +521,6 @@ class MatParam(Param, MatrixExpr): """ name: str shape: Shape - algebra: Algebra = Algebra.poly_ring def to_repr(self, repr_type: type, state: State) -> tuple[Repr, State]: if self not in state.parameters: |