Skip to content

Commit

Permalink
slice test
Browse files Browse the repository at this point in the history
  • Loading branch information
apchytr committed Sep 19, 2024
1 parent b872b09 commit 4d47062
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_lab_dev/test_states/test_states_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,16 @@ def test_quadrature_multimode_dm(self):
)
assert math.allclose(state.quadrature(quad), bra * ket)
assert math.allclose(state.quadrature_distribution(q), math.abs(bra) ** 2)
# assert math.allclose(state.to_fock(40).quadrature(quad), bra * ket)
# assert math.allclose(state.to_fock(40).quadrature_distribution(q), math.abs(bra) ** 2)

quad_slice = math.transpose(math.astensor([q, q, q + 1, q + 1]))
q_slice = math.transpose(math.astensor([q] * state.n_modes))
ket_slice = coherent_state_quad(q + 1, x, y) * coherent_state_quad(q + 1, x, y)
bra_slice = np.conj(coherent_state_quad(q, x, y)) * np.conj(coherent_state_quad(q, x, y))

assert math.allclose(state.to_fock(40).quadrature(quad_slice), bra_slice * ket_slice)
assert math.allclose(
state.to_fock(40).quadrature_distribution(q_slice), math.abs(bra_slice) ** 2
)

def test_quadrature_multivariable_dm(self):
x, y = 1, 2
Expand Down

0 comments on commit 4d47062

Please sign in to comment.