From eca1adccea4b25dd0cc70592b90e45704a8b601e Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Tue, 8 Jan 2019 10:03:31 +0100 Subject: [PATCH] remove unneeded numpy output storage The 'out' parameter is only used when you don't want numpy to allocate a new array for the result, which is not the case here. --- kwant/physics/dispersion.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kwant/physics/dispersion.py b/kwant/physics/dispersion.py index 4109be75..5c98bf26 100644 --- a/kwant/physics/dispersion.py +++ b/kwant/physics/dispersion.py @@ -139,8 +139,7 @@ class Bands: if derivative_order >= 2: # compute curvatures # ediff_{i,j} = 1 / (E_i - E_j) if i != j, else 0 ediff = energies.reshape((-1, 1)) - energies.reshape((1, -1)) - ediff = np.divide(1, ediff, out=np.zeros_like(ediff), - where=(ediff != 0)) + ediff = np.divide(1, ediff, where=(ediff != 0)) h2 = - (mat + mat.conjugate().transpose()) curvatures = np.sum(eigenvectors.conjugate() * (h2 @ eigenvectors) - 2 * ediff * np.abs(ph1p)**2, axis=0).real -- GitLab