From acb47a6782b982a8af0939e07b1d5bbc2ab54ffb Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Thu, 12 May 2022 15:10:24 +0100 Subject: [PATCH] fix: check for CObs in linalg._mat_mat_op generalized. --- pyerrors/linalg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyerrors/linalg.py b/pyerrors/linalg.py index 61740e40..079174f8 100644 --- a/pyerrors/linalg.py +++ b/pyerrors/linalg.py @@ -233,7 +233,7 @@ def _scalar_mat_op(op, obs, **kwargs): def _mat_mat_op(op, obs, **kwargs): """Computes the matrix to matrix operation op to a given matrix of Obs.""" # Use real representation to calculate matrix operations for complex matrices - if isinstance(obs.ravel()[0], CObs): + if any(isinstance(o, CObs) for o in obs.ravel()): A = np.empty_like(obs) B = np.empty_like(obs) for (n, m), entry in np.ndenumerate(obs):