diff options
Diffstat (limited to '')
54 files changed, 327 insertions, 82 deletions
diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py index f52a0ea..4ef955d 100644 --- a/polymatrix/expression/expression.py +++ b/polymatrix/expression/expression.py @@ -1,15 +1,19 @@ +from __future__ import annotations + import abc import dataclasses import dataclassabc import typing import numpy as np +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + import polymatrix.expression.init from polymatrix.utils.getstacklines import get_stack_lines from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.expression.op import ( diff, @@ -21,7 +25,6 @@ from polymatrix.expression.op import ( degree, ) - class Expression( ExpressionBaseMixin, abc.ABC, diff --git a/polymatrix/expression/mixins/additionexprmixin.py b/polymatrix/expression/mixins/additionexprmixin.py index 200c328..02b45a4 100644 --- a/polymatrix/expression/mixins/additionexprmixin.py +++ b/polymatrix/expression/mixins/additionexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import math +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.expression.utils.broadcastpolymatrix import broadcast_poly_matrix diff --git a/polymatrix/expression/mixins/blockdiagexprmixin.py b/polymatrix/expression/mixins/blockdiagexprmixin.py index 18af1f3..77edf2b 100644 --- a/polymatrix/expression/mixins/blockdiagexprmixin.py +++ b/polymatrix/expression/mixins/blockdiagexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import itertools import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/cacheexprmixin.py b/polymatrix/expression/mixins/cacheexprmixin.py index 7947a74..374cf95 100644 --- a/polymatrix/expression/mixins/cacheexprmixin.py +++ b/polymatrix/expression/mixins/cacheexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixAsDictMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/combinationsexprmixin.py b/polymatrix/expression/mixins/combinationsexprmixin.py index 56a1d64..fb27f70 100644 --- a/polymatrix/expression/mixins/combinationsexprmixin.py +++ b/polymatrix/expression/mixins/combinationsexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import itertools +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/degreeexprmixin.py b/polymatrix/expression/mixins/degreeexprmixin.py index 5518d0a..1498569 100644 --- a/polymatrix/expression/mixins/degreeexprmixin.py +++ b/polymatrix/expression/mixins/degreeexprmixin.py @@ -1,10 +1,14 @@ +from __future__ import annotations import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary diff --git a/polymatrix/expression/mixins/derivativeexprmixin.py b/polymatrix/expression/mixins/derivativeexprmixin.py index 31a1e31..301166a 100644 --- a/polymatrix/expression/mixins/derivativeexprmixin.py +++ b/polymatrix/expression/mixins/derivativeexprmixin.py @@ -1,10 +1,14 @@ +from __future__ import annotations + import abc import typing +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/determinantexprmixin.py b/polymatrix/expression/mixins/determinantexprmixin.py index 2c034d1..4659ded 100644 --- a/polymatrix/expression/mixins/determinantexprmixin.py +++ b/polymatrix/expression/mixins/determinantexprmixin.py @@ -1,12 +1,16 @@ +from __future__ import annotations + import abc import collections import dataclasses -from numpy import var +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class DeterminantExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/diagexprmixin.py b/polymatrix/expression/mixins/diagexprmixin.py index 1feec9d..66d5a6c 100644 --- a/polymatrix/expression/mixins/diagexprmixin.py +++ b/polymatrix/expression/mixins/diagexprmixin.py @@ -1,8 +1,13 @@ +from __future__ import annotations + import abc import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/divergenceexprmixin.py b/polymatrix/expression/mixins/divergenceexprmixin.py index 3477ee1..ac16c5b 100644 --- a/polymatrix/expression/mixins/divergenceexprmixin.py +++ b/polymatrix/expression/mixins/divergenceexprmixin.py @@ -1,11 +1,15 @@ +from __future__ import annotations + import abc import collections import typing +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/divisionexprmixin.py b/polymatrix/expression/mixins/divisionexprmixin.py index f2a7f0a..6dd2bd6 100644 --- a/polymatrix/expression/mixins/divisionexprmixin.py +++ b/polymatrix/expression/mixins/divisionexprmixin.py @@ -1,5 +1,11 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.elemmultexprmixin import ElemMultExprMixin from polymatrix.utils.getstacklines import FrameSummary @@ -7,7 +13,6 @@ from polymatrix.utils.tooperatorexception import to_operator_exception from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class DivisionExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/elemmultexprmixin.py b/polymatrix/expression/mixins/elemmultexprmixin.py index fe5d6ab..f8121a8 100644 --- a/polymatrix/expression/mixins/elemmultexprmixin.py +++ b/polymatrix/expression/mixins/elemmultexprmixin.py @@ -1,15 +1,16 @@ +from __future__ import annotations + import abc import itertools import typing -import dataclassabc + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix, init_broadcast_poly_matrix from polymatrix.polymatrix.typing import MonomialIndex from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState -from polymatrix.polymatrix.utils.mergemonomialindices import merge_monomial_indices class ElemMultExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/evalexprmixin.py b/polymatrix/expression/mixins/evalexprmixin.py index 881ee83..8ed90fb 100644 --- a/polymatrix/expression/mixins/evalexprmixin.py +++ b/polymatrix/expression/mixins/evalexprmixin.py @@ -1,11 +1,16 @@ +from __future__ import annotations + import abc import itertools import math +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/expressionbasemixin.py b/polymatrix/expression/mixins/expressionbasemixin.py index 7f58339..8ca6afd 100644 --- a/polymatrix/expression/mixins/expressionbasemixin.py +++ b/polymatrix/expression/mixins/expressionbasemixin.py @@ -1,7 +1,11 @@ +from __future__ import annotations + import abc +import typing -from polymatrix.expressionstate.mixins import ExpressionStateMixin -from polymatrix.polymatrix.mixins import PolyMatrixMixin +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin + from polymatrix.polymatrix.mixins import PolyMatrixMixin class ExpressionBaseMixin(abc.ABC): diff --git a/polymatrix/expression/mixins/eyeexprmixin.py b/polymatrix/expression/mixins/eyeexprmixin.py index 47f5a0e..e3b28c2 100644 --- a/polymatrix/expression/mixins/eyeexprmixin.py +++ b/polymatrix/expression/mixins/eyeexprmixin.py @@ -1,11 +1,15 @@ +from __future__ import annotations + import abc -import itertools import dataclassabc -from polymatrix.polymatrix.mixins import PolyMatrixMixin +import typing +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + +from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class EyeExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/filterexprmixin.py b/polymatrix/expression/mixins/filterexprmixin.py index c8fa427..51f05a4 100644 --- a/polymatrix/expression/mixins/filterexprmixin.py +++ b/polymatrix/expression/mixins/filterexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class FilterExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/fromnumbersexprmixin.py b/polymatrix/expression/mixins/fromnumbersexprmixin.py index 397f6c5..48d2b12 100644 --- a/polymatrix/expression/mixins/fromnumbersexprmixin.py +++ b/polymatrix/expression/mixins/fromnumbersexprmixin.py @@ -1,8 +1,13 @@ +from __future__ import annotations + from abc import abstractmethod from typing_extensions import override +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromnumpyexprmixin.py b/polymatrix/expression/mixins/fromnumpyexprmixin.py index 92132f8..eec7fce 100644 --- a/polymatrix/expression/mixins/fromnumpyexprmixin.py +++ b/polymatrix/expression/mixins/fromnumpyexprmixin.py @@ -1,11 +1,17 @@ +from __future__ import annotations + import math from abc import abstractmethod from typing_extensions import override, cast from numpy.typing import NDArray +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin + from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py b/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py index c7d90a1..e59500e 100644 --- a/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py +++ b/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py @@ -1,12 +1,14 @@ +from __future__ import annotations import abc -import dataclasses -import math -from polymatrix.expression.utils.getvariableindices import get_variable_indices_from_variable +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState +from polymatrix.expression.utils.getvariableindices import get_variable_indices_from_variable from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin @@ -43,4 +45,4 @@ class FromSymmetricMatrixExprMixin(ExpressionBaseMixin): shape=(var_index, 1), ) - return state, poly_matrix
\ No newline at end of file + return state, poly_matrix diff --git a/polymatrix/expression/mixins/fromsympyexprmixin.py b/polymatrix/expression/mixins/fromsympyexprmixin.py index 301dce3..5625651 100644 --- a/polymatrix/expression/mixins/fromsympyexprmixin.py +++ b/polymatrix/expression/mixins/fromsympyexprmixin.py @@ -1,11 +1,16 @@ +from __future__ import annotations + import sympy import math from abc import abstractmethod from typing_extensions import override, cast +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromtermsexprmixin.py b/polymatrix/expression/mixins/fromtermsexprmixin.py index e99fc9a..a8a0cc8 100644 --- a/polymatrix/expression/mixins/fromtermsexprmixin.py +++ b/polymatrix/expression/mixins/fromtermsexprmixin.py @@ -1,8 +1,12 @@ +from __future__ import annotations import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.typing import MonomialData diff --git a/polymatrix/expression/mixins/getitemexprmixin.py b/polymatrix/expression/mixins/getitemexprmixin.py index dbefe00..f8fece4 100644 --- a/polymatrix/expression/mixins/getitemexprmixin.py +++ b/polymatrix/expression/mixins/getitemexprmixin.py @@ -1,12 +1,16 @@ +from __future__ import annotations + import abc import dataclasses import dataclassabc -from polymatrix.polymatrix.mixins import PolyMatrixMixin +import typing -from polymatrix.polymatrix.init import init_poly_matrix +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + +from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class GetItemExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py b/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py index 52e5814..808a0c3 100644 --- a/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py +++ b/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py @@ -1,7 +1,14 @@ +from __future__ import annotations + import abc import dataclasses import itertools import math +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, @@ -9,7 +16,6 @@ from polymatrix.expression.utils.getvariableindices import ( from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/integrateexprmixin.py b/polymatrix/expression/mixins/integrateexprmixin.py index 38cf522..00bbdf1 100644 --- a/polymatrix/expression/mixins/integrateexprmixin.py +++ b/polymatrix/expression/mixins/integrateexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import itertools +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/legendreseriesmixin.py b/polymatrix/expression/mixins/legendreseriesmixin.py index bec4c6c..bd8552f 100644 --- a/polymatrix/expression/mixins/legendreseriesmixin.py +++ b/polymatrix/expression/mixins/legendreseriesmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/linearinexprmixin.py b/polymatrix/expression/mixins/linearinexprmixin.py index 8354754..b5e59c1 100644 --- a/polymatrix/expression/mixins/linearinexprmixin.py +++ b/polymatrix/expression/mixins/linearinexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import collections +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/linearmatrixinexprmixin.py b/polymatrix/expression/mixins/linearmatrixinexprmixin.py index 8239947..e7fd38a 100644 --- a/polymatrix/expression/mixins/linearmatrixinexprmixin.py +++ b/polymatrix/expression/mixins/linearmatrixinexprmixin.py @@ -1,11 +1,15 @@ +from __future__ import annotations + import abc import collections -from numpy import var +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/linearmonomialsexprmixin.py b/polymatrix/expression/mixins/linearmonomialsexprmixin.py index c4a5df7..8374670 100644 --- a/polymatrix/expression/mixins/linearmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/linearmonomialsexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/matrixmultexprmixin.py b/polymatrix/expression/mixins/matrixmultexprmixin.py index 9402a19..953aa9c 100644 --- a/polymatrix/expression/mixins/matrixmultexprmixin.py +++ b/polymatrix/expression/mixins/matrixmultexprmixin.py @@ -1,10 +1,14 @@ +from __future__ import annotations import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.utils.tooperatorexception import to_operator_exception diff --git a/polymatrix/expression/mixins/maxexprmixin.py b/polymatrix/expression/mixins/maxexprmixin.py index 650dc68..7bcfa52 100644 --- a/polymatrix/expression/mixins/maxexprmixin.py +++ b/polymatrix/expression/mixins/maxexprmixin.py @@ -1,8 +1,13 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/parametrizeexprmixin.py b/polymatrix/expression/mixins/parametrizeexprmixin.py index 290b2eb..ec14240 100644 --- a/polymatrix/expression/mixins/parametrizeexprmixin.py +++ b/polymatrix/expression/mixins/parametrizeexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/parametrizematrixexprmixin.py b/polymatrix/expression/mixins/parametrizematrixexprmixin.py index 175a5c3..4c585bf 100644 --- a/polymatrix/expression/mixins/parametrizematrixexprmixin.py +++ b/polymatrix/expression/mixins/parametrizematrixexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/productexprmixin.py b/polymatrix/expression/mixins/productexprmixin.py index 6089a1d..3500e29 100644 --- a/polymatrix/expression/mixins/productexprmixin.py +++ b/polymatrix/expression/mixins/productexprmixin.py @@ -1,12 +1,18 @@ +from __future__ import annotations + import abc import itertools +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.typing import PolynomialData from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/quadraticinexprmixin.py b/polymatrix/expression/mixins/quadraticinexprmixin.py index 144fbab..c323d09 100644 --- a/polymatrix/expression/mixins/quadraticinexprmixin.py +++ b/polymatrix/expression/mixins/quadraticinexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import collections +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py index 6880dcf..1066861 100644 --- a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/repmatexprmixin.py b/polymatrix/expression/mixins/repmatexprmixin.py index e5d7606..324a298 100644 --- a/polymatrix/expression/mixins/repmatexprmixin.py +++ b/polymatrix/expression/mixins/repmatexprmixin.py @@ -1,8 +1,13 @@ +from __future__ import annotations + import abc import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/reshapeexprmixin.py b/polymatrix/expression/mixins/reshapeexprmixin.py index b74ee0d..84c2581 100644 --- a/polymatrix/expression/mixins/reshapeexprmixin.py +++ b/polymatrix/expression/mixins/reshapeexprmixin.py @@ -1,12 +1,16 @@ +from __future__ import annotations + import abc import functools import itertools import operator import dataclassabc -import numpy as np +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/setelementatexprmixin.py b/polymatrix/expression/mixins/setelementatexprmixin.py index 207d1b2..9757a28 100644 --- a/polymatrix/expression/mixins/setelementatexprmixin.py +++ b/polymatrix/expression/mixins/setelementatexprmixin.py @@ -1,13 +1,17 @@ +from __future__ import annotations + import abc import dataclasses -import typing import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import expressionstate + from polymatrix.polymatrix.mixins import PolyMatrixMixin -from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class SetElementAtExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/squeezeexprmixin.py b/polymatrix/expression/mixins/squeezeexprmixin.py index 67ade46..e82e67d 100644 --- a/polymatrix/expression/mixins/squeezeexprmixin.py +++ b/polymatrix/expression/mixins/squeezeexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState # remove? diff --git a/polymatrix/expression/mixins/substituteexprmixin.py b/polymatrix/expression/mixins/substituteexprmixin.py index d2ab740..dd07363 100644 --- a/polymatrix/expression/mixins/substituteexprmixin.py +++ b/polymatrix/expression/mixins/substituteexprmixin.py @@ -1,13 +1,17 @@ +from __future__ import annotations + import abc import collections import itertools import math import typing +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/subtractmonomialsexprmixin.py b/polymatrix/expression/mixins/subtractmonomialsexprmixin.py index 6bac539..3cb8e07 100644 --- a/polymatrix/expression/mixins/subtractmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/subtractmonomialsexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.polymatrix.utils.sortmonomials import sort_monomials diff --git a/polymatrix/expression/mixins/sumexprmixin.py b/polymatrix/expression/mixins/sumexprmixin.py index 4ade032..d2b3f30 100644 --- a/polymatrix/expression/mixins/sumexprmixin.py +++ b/polymatrix/expression/mixins/sumexprmixin.py @@ -1,10 +1,14 @@ +from __future__ import annotations + import abc import collections -import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/symmetricexprmixin.py b/polymatrix/expression/mixins/symmetricexprmixin.py index c8020f9..8bc398f 100644 --- a/polymatrix/expression/mixins/symmetricexprmixin.py +++ b/polymatrix/expression/mixins/symmetricexprmixin.py @@ -1,12 +1,16 @@ +from __future__ import annotations + import abc import collections -import itertools import dataclassabc -from polymatrix.polymatrix.mixins import PolyMatrixMixin +import typing +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.abc import PolyMatrix + +from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class SymmetricExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/toconstantexprmixin.py b/polymatrix/expression/mixins/toconstantexprmixin.py index 9c8b9b7..c86a5ee 100644 --- a/polymatrix/expression/mixins/toconstantexprmixin.py +++ b/polymatrix/expression/mixins/toconstantexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import collections +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class ToConstantExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/toquadraticexprmixin.py b/polymatrix/expression/mixins/toquadraticexprmixin.py index 936ec76..27fe628 100644 --- a/polymatrix/expression/mixins/toquadraticexprmixin.py +++ b/polymatrix/expression/mixins/toquadraticexprmixin.py @@ -1,11 +1,16 @@ +from __future__ import annotations + import abc import collections import dataclasses +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class ToQuadraticExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/tosortedvariablesmixin.py b/polymatrix/expression/mixins/tosortedvariablesmixin.py index 4dfa518..973c941 100644 --- a/polymatrix/expression/mixins/tosortedvariablesmixin.py +++ b/polymatrix/expression/mixins/tosortedvariablesmixin.py @@ -1,4 +1,11 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) @@ -6,7 +13,6 @@ from polymatrix.expression.utils.getvariableindices import ( from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState # to be deleted? diff --git a/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py b/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py index 3c50f76..3f41920 100644 --- a/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py +++ b/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py @@ -1,11 +1,13 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin -from polymatrix.expression.utils.getvariableindices import ( - get_variable_indices_from_variable, -) from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/transposeexprmixin.py b/polymatrix/expression/mixins/transposeexprmixin.py index 1f01c60..fbd5f30 100644 --- a/polymatrix/expression/mixins/transposeexprmixin.py +++ b/polymatrix/expression/mixins/transposeexprmixin.py @@ -1,10 +1,15 @@ +from __future__ import annotations + import abc import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class TransposeExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/truncateexprmixin.py b/polymatrix/expression/mixins/truncateexprmixin.py index 3171221..6a8b929 100644 --- a/polymatrix/expression/mixins/truncateexprmixin.py +++ b/polymatrix/expression/mixins/truncateexprmixin.py @@ -1,9 +1,14 @@ +from __future__ import annotations + import abc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/variablemixin.py b/polymatrix/expression/mixins/variablemixin.py index 67ee481..916c29d 100644 --- a/polymatrix/expression/mixins/variablemixin.py +++ b/polymatrix/expression/mixins/variablemixin.py @@ -1,13 +1,18 @@ +from __future__ import annotations + from abc import abstractmethod from itertools import product from typing_extensions import override +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.typing import PolyMatrixDict, PolyDict, MonomialIndex, VariableIndex from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -from polymatrix.expressionstate.mixins import ExpressionStateMixin class VariableMixin(ExpressionBaseMixin): @@ -27,6 +32,7 @@ class VariableMixin(ExpressionBaseMixin): @override def apply(self, state: ExpressionStateMixin) -> tuple[ExpressionStateMixin, PolyMatrixMixin]: state, indices = state.index(self) + print(f"indexing {self}, got index {indices}") p = PolyMatrixDict() rows, cols = self.shape diff --git a/polymatrix/expression/mixins/vstackexprmixin.py b/polymatrix/expression/mixins/vstackexprmixin.py index 2dec7bf..ab23ee6 100644 --- a/polymatrix/expression/mixins/vstackexprmixin.py +++ b/polymatrix/expression/mixins/vstackexprmixin.py @@ -1,11 +1,16 @@ +from __future__ import annotations import abc import itertools import dataclassabc +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.expressionstate.abc import ExpressionState class VStackExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/utils/getderivativemonomials.py b/polymatrix/expression/utils/getderivativemonomials.py index d671976..54ea035 100644 --- a/polymatrix/expression/utils/getderivativemonomials.py +++ b/polymatrix/expression/utils/getderivativemonomials.py @@ -1,9 +1,13 @@ +from __future__ import annotations + import collections import dataclasses import itertools +import typing -from polymatrix.expressionstate.abc import ExpressionState -from polymatrix.polymatrix.typing import PolynomialData +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.polymatrix.typing import PolynomialData # NP: why does this return a dict? diff --git a/polymatrix/expression/utils/getmonomialindices.py b/polymatrix/expression/utils/getmonomialindices.py index 9145002..be0e7d7 100644 --- a/polymatrix/expression/utils/getmonomialindices.py +++ b/polymatrix/expression/utils/getmonomialindices.py @@ -1,5 +1,9 @@ -from polymatrix.expressionstate.abc import ExpressionState -from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from __future__ import annotations +import typing + +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin def get_monomial_indices( diff --git a/polymatrix/expression/utils/getvariableindices.py b/polymatrix/expression/utils/getvariableindices.py index aebdeb0..3177735 100644 --- a/polymatrix/expression/utils/getvariableindices.py +++ b/polymatrix/expression/utils/getvariableindices.py @@ -1,7 +1,11 @@ +from __future__ import annotations + import itertools import typing -from polymatrix.expressionstate.abc import ExpressionState +if typing.TYPE_CHECKING: + from polymatrix.expressionstate.abc import ExpressionState + from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin |