From 6066e8708d95f5f45051b5325a35693c109448f0 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Mon, 26 Jul 2021 22:01:09 +0200 Subject: [PATCH] fix shape equality check in solver The proper way to compare shapes of `evaluable.Array` instances is using `evaluable.equalshape`. This patch replaces two `shape1 == shape2` checks with `evaluable.equalshape(shape1, shape2)` in the `solver` module. --- nutils/solver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nutils/solver.py b/nutils/solver.py index 3a31a3aa5..d89e775af 100644 --- a/nutils/solver.py +++ b/nutils/solver.py @@ -614,7 +614,7 @@ def __init__(self, target, residual:integraltuple, inertia:optionalintegraltuple if len(residual) != len(inertia): raise Exception('length of residual and inertia do no match') for inert, res in zip(inertia, residual): - if inert and inert.shape != res.shape: + if inert and not evaluable.equalshape(inert.shape, res.shape): raise ValueError('expected `inertia` with shape {} but got {}'.format(res.shape, inert.shape)) self.target = target self.timesteptarget = '_pseudotime_timestep' @@ -704,7 +704,7 @@ def __init__(self, target, residual:integraltuple, inertia:optionalintegraltuple if len(residual) != len(inertia): raise Exception('length of residual and inertia do no match') for inert, res in zip(inertia, residual): - if inert and inert.shape != res.shape: + if inert and not evaluable.equalshape(inert.shape, res.shape): raise ValueError('expected `inertia` with shape {} but got {}'.format(res.shape, inert.shape)) self.target = target self.newtonargs = newtonargs