diff options
author | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2024-02-27 07:39:52 +0100 |
---|---|---|
committer | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2024-02-27 07:39:52 +0100 |
commit | 6a9ca2e0c327281c1359b6152f6afc9165e6bf9b (patch) | |
tree | 1630c0c5a460ba4f9f207eafb8809da6f5619941 /polymatrix/expression/mixins/derivativeexprmixin.py | |
parent | replace indentation tabs with spaces (diff) | |
download | polymatrix-6a9ca2e0c327281c1359b6152f6afc9165e6bf9b.tar.gz polymatrix-6a9ca2e0c327281c1359b6152f6afc9165e6bf9b.zip |
improve typing with PolynomialData and MonomialData
Diffstat (limited to 'polymatrix/expression/mixins/derivativeexprmixin.py')
-rw-r--r-- | polymatrix/expression/mixins/derivativeexprmixin.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/polymatrix/expression/mixins/derivativeexprmixin.py b/polymatrix/expression/mixins/derivativeexprmixin.py index 1728a2d..38ea9cc 100644 --- a/polymatrix/expression/mixins/derivativeexprmixin.py +++ b/polymatrix/expression/mixins/derivativeexprmixin.py @@ -6,7 +6,7 @@ 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 get_derivative_monomials +from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import get_variable_indices_from_variable from polymatrix.utils.getstacklines import FrameSummary from polymatrix.utils.tooperatorexception import to_operator_exception @@ -60,23 +60,23 @@ class DerivativeExprMixin(ExpressionBaseMixin): for row in range(underlying.shape[0]): - underlying_terms = underlying.get_poly(row, 0) - if underlying_terms is None: + polynomial = underlying.get_poly(row, 0) + if polynomial is None: continue # derivate each variable and map result to the corresponding column for col, diff_wrt_variable in enumerate(diff_wrt_variables): - state, derivation_terms = get_derivative_monomials( - monomial_terms=underlying_terms, + state, derivation = differentiate_polynomial( + polynomial=polynomial, diff_wrt_variable=diff_wrt_variable, state=state, considered_variables=set(diff_wrt_variables), introduce_derivatives=self.introduce_derivatives, ) - if 0 < len(derivation_terms): - terms[row, col] = derivation_terms + if 0 < len(derivation): + terms[row, col] = derivation poly_matrix = init_poly_matrix( terms=terms, |