diff options
author | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2022-08-19 15:59:54 +0200 |
---|---|---|
committer | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2022-08-19 15:59:54 +0200 |
commit | 52b1615022730b3ceb4b3ced0f6426ab6c764328 (patch) | |
tree | 811ff4f94c179e8f865eb5a8127716018f731d9f /polymatrix/expression/mixins/derivativeexprmixin.py | |
parent | add function 'get_key_from_offset' (diff) | |
download | polymatrix-52b1615022730b3ceb4b3ced0f6426ab6c764328.tar.gz polymatrix-52b1615022730b3ceb4b3ced0f6426ab6c764328.zip |
'get_poly' returns None if (row, col) entry is empty, instead of raising a KeyError exception
Diffstat (limited to 'polymatrix/expression/mixins/derivativeexprmixin.py')
-rw-r--r-- | polymatrix/expression/mixins/derivativeexprmixin.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/polymatrix/expression/mixins/derivativeexprmixin.py b/polymatrix/expression/mixins/derivativeexprmixin.py index 87d5f5b..5fce215 100644 --- a/polymatrix/expression/mixins/derivativeexprmixin.py +++ b/polymatrix/expression/mixins/derivativeexprmixin.py @@ -41,9 +41,8 @@ class DerivativeExprMixin(ExpressionBaseMixin): for row in range(underlying.shape[0]): - try: - underlying_terms = underlying.get_poly(row, 0) - except KeyError: + underlying_terms = underlying.get_poly(row, 0) + if underlying_terms is None: continue # derivate each variable and map result to the corresponding column |