From 54bbaf2bf180f4945e9e120319d4007e0468450f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 17:42:41 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mdopt/mps/explicit.py | 4 +--- tests/mps/test_explicit.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/mdopt/mps/explicit.py b/mdopt/mps/explicit.py index 07c98c67..782da449 100644 --- a/mdopt/mps/explicit.py +++ b/mdopt/mps/explicit.py @@ -343,9 +343,7 @@ def entanglement_entropy(self) -> np.ndarray: singular_values = self.singular_values[bond].copy() singular_values = np.array(singular_values) # type: ignore singular_values[singular_values < self.tolerance] = 0 - singular_values2 = [ - singular_value**2 for singular_value in singular_values - ] + singular_values2 = [singular_value**2 for singular_value in singular_values] entropy[bond] = -1 * np.sum( np.fromiter((xlogy(s, s) for s in singular_values2), dtype=np.float32) ) diff --git a/tests/mps/test_explicit.py b/tests/mps/test_explicit.py index bb626f0e..890735ce 100644 --- a/tests/mps/test_explicit.py +++ b/tests/mps/test_explicit.py @@ -360,9 +360,7 @@ def test_explicit_density_mpo(): density_matrix_mpo = density_matrix_mpo.transpose(correct_order) # Reshaping to the matrix form. - density_matrix_mpo = density_matrix_mpo.reshape( - (2**num_sites, 2**num_sites) - ) + density_matrix_mpo = density_matrix_mpo.reshape((2**num_sites, 2**num_sites)) # Original density matrix. density_matrix = np.tensordot(psi, np.conjugate(psi), 0)