Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 18, 2024
1 parent 7573826 commit 54bbaf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions mdopt/mps/explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down
4 changes: 1 addition & 3 deletions tests/mps/test_explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 54bbaf2

Please sign in to comment.