Skip to content

Commit

Permalink
reformated test_decompositions.py using black -l 100
Browse files Browse the repository at this point in the history
  • Loading branch information
RyosukeNORO committed Jul 6, 2024
1 parent 74c05b8 commit c81cfbb
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions thewalrus/tests/test_decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,15 @@ def _create_cov(nbar):

# interferometer 1
U1 = haar_measure(n)
S1 = np.vstack(
[np.hstack([U1.real, -U1.imag]), np.hstack([U1.imag, U1.real])]
)
S1 = np.vstack([np.hstack([U1.real, -U1.imag]), np.hstack([U1.imag, U1.real])])

# squeezing
r = np.log(0.2 * np.arange(n) + 2)
Sq = block_diag(np.diag(np.exp(-r)), np.diag(np.exp(r)))

# interferometer 2
U2 = haar_measure(n)
S2 = np.vstack(
[np.hstack([U2.real, -U2.imag]), np.hstack([U2.imag, U2.real])]
)
S2 = np.vstack([np.hstack([U2.real, -U2.imag]), np.hstack([U2.imag, U2.real])])

# final symplectic
S_final = S2 @ Sq @ S1
Expand Down Expand Up @@ -103,9 +99,7 @@ def test_even_validation(self):
"""Test that the graph_embed decomposition raises exception if not even number of rows"""
A = np.random.rand(5, 5) + 1j * np.random.rand(5, 5)
A += A.T
with pytest.raises(
ValueError, match="must have an even number of rows/columns"
):
with pytest.raises(ValueError, match="must have an even number of rows/columns"):
williamson(A)

def test_positive_definite_validation(self):
Expand Down Expand Up @@ -178,9 +172,7 @@ def _create_transform(n, passive=True):

# interferometer 1
U1 = haar_measure(n)
S1 = np.vstack(
[np.hstack([U1.real, -U1.imag]), np.hstack([U1.imag, U1.real])]
)
S1 = np.vstack([np.hstack([U1.real, -U1.imag]), np.hstack([U1.imag, U1.real])])

Sq = np.identity(2 * n)
if not passive:
Expand All @@ -190,9 +182,7 @@ def _create_transform(n, passive=True):

# interferometer 2
U2 = haar_measure(n)
S2 = np.vstack(
[np.hstack([U2.real, -U2.imag]), np.hstack([U2.imag, U2.real])]
)
S2 = np.vstack([np.hstack([U2.real, -U2.imag]), np.hstack([U2.imag, U2.real])])

# final symplectic
S_final = S2 @ Sq @ S1
Expand Down

0 comments on commit c81cfbb

Please sign in to comment.