From a41e59bb271d715d93200d13ed1b88448cc0acb3 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Wed, 17 Jul 2024 17:54:17 +0200 Subject: [PATCH] Fix a remaining issue with numpy 2.0 compatibility of the tests --- docs/modules/fluid_properties.rst | 2 +- src/tespy/networks/network.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/modules/fluid_properties.rst b/docs/modules/fluid_properties.rst index eb1366578..8395c7839 100644 --- a/docs/modules/fluid_properties.rst +++ b/docs/modules/fluid_properties.rst @@ -118,7 +118,7 @@ to use the `iapws` back end: >>> nwk.solve("design") >>> round(tu.eta_s.val, 3) - 0.841 + np.float64(0.841) Implementing a custom engine diff --git a/src/tespy/networks/network.py b/src/tespy/networks/network.py index c41963a1f..73c03ed12 100644 --- a/src/tespy/networks/network.py +++ b/src/tespy/networks/network.py @@ -2231,12 +2231,14 @@ def matrix_inversion(self): if self.use_cuda: self.increment = cu.asnumpy(cu.dot( cu.linalg.inv(cu.asarray(self.jacobian)), - -cu.asarray(self.residual))) + -cu.asarray(self.residual) + )) else: self.increment = np.linalg.inv( - self.jacobian).dot(-self.residual) + self.jacobian + ).dot(-self.residual) self.lin_dep = False - except np.linalg.linalg.LinAlgError: + except np.linalg.LinAlgError: self.increment = self.residual * 0 def update_variables(self):