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)