From 8984f0bc25a9947f0a89ebfe111313083a260e12 Mon Sep 17 00:00:00 2001 From: BeckebanzeF1 Date: Wed, 28 Feb 2024 16:29:20 +0100 Subject: [PATCH] formatting correction in iomath.py --- pymrio/tools/iomath.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pymrio/tools/iomath.py b/pymrio/tools/iomath.py index 59ec7c3f..323b0fd8 100644 --- a/pymrio/tools/iomath.py +++ b/pymrio/tools/iomath.py @@ -274,7 +274,9 @@ def calc_G(As, L=None, x=None): recix = recix.reshape((1, -1)) if type(L) is pd.DataFrame: - return pd.DataFrame(recix * np.transpose(L.values * x), index=Z.index, columns=Z.columns) + return pd.DataFrame( + recix * np.transpose(L.values * x), index=Z.index, columns=Z.columns + ) else: # G = hat(x)^{-1} * L^T * hat(x) in mathematical form np.linalg.inv(hatx).dot(L.transpose()).dot(hatx). # it is computationally much faster to multiply element-wise because hatx is a diagonal matrix. @@ -282,7 +284,9 @@ def calc_G(As, L=None, x=None): else: # calculation of the inverse of I-As has a high computational cost. I = np.eye(As.shape[0]) # noqa if type(As) is pd.DataFrame: - return pd.DataFrame(np.linalg.inv(I - As), index=As.index, columns=As.columns) + return pd.DataFrame( + np.linalg.inv(I - As), index=As.index, columns=As.columns + ) else: return np.linalg.inv(I - As) # G = inverse matrix of (I - As)