diff options
author | Nao Pross <np@0hm.ch> | 2024-06-07 11:21:34 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-06-07 11:21:34 +0200 |
commit | 477d7aa799b93b63d03f50cb085e26597c21e04f (patch) | |
tree | a237bf99690a37e97d95fbf3c787398dd94736ad | |
parent | Fix bug when working with new shapes (e, 5) where e is an expression (diff) | |
download | polymatrix-477d7aa799b93b63d03f50cb085e26597c21e04f.tar.gz polymatrix-477d7aa799b93b63d03f50cb085e26597c21e04f.zip |
Add more __str__ methods to Impl classes
-rw-r--r-- | polymatrix/expression/impl.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/polymatrix/expression/impl.py b/polymatrix/expression/impl.py index 764cab8..81a624e 100644 --- a/polymatrix/expression/impl.py +++ b/polymatrix/expression/impl.py @@ -105,6 +105,9 @@ class ARangeExprImpl(ARangeExprMixin): class BlockDiagExprImpl(BlockDiagExprMixin): blocks: tuple[ExpressionBaseMixin, ...] + def __str__(self): + return f"blkdiag({self.underlying})" + @dataclassabc.dataclassabc(frozen=True) class CacheExprImpl(CacheExprMixin): @@ -153,6 +156,9 @@ class DerivativeExprImpl(DerivativeExprMixin): class DiagExprImpl(DiagExprMixin): underlying: ExpressionBaseMixin + def __str__(self): + return f"diag({self.underlying})" + @dataclassabc.dataclassabc(frozen=True) class DivergenceExprImpl(DivergenceExprMixin): @@ -174,6 +180,9 @@ class EvalExprImpl(EvalExprMixin): underlying: ExpressionBaseMixin substitutions: tuple + def __str__(self): + return f"eval({self.underlying}, {self.substitutions})" + @dataclassabc.dataclassabc(frozen=True) class EyeExprImpl(EyeExprMixin): @@ -278,6 +287,9 @@ class LinearMonomialsExprImpl(LinearMonomialsExprMixin): class LowerTriangularExprImpl(LowerTriangularExprMixin): underlying: ExpressionBaseMixin + def __str__(self): + return f"tril({self.underlying})" + @dataclassabc.dataclassabc(frozen=True) class LegendreSeriesImpl(LegendreSeriesMixin): @@ -437,6 +449,9 @@ class SliceExprImpl(SliceExprMixin): underlying: ExpressionBaseMixin slice: tuple # See SlicePolyMatrixMixin + def __str__(self): + return f"{self.underlying}[{self.slice}]" + @dataclassabc.dataclassabc(frozen=True) class SqueezeExprImpl(SqueezeExprMixin): |