Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings #306

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mrmustard/math/backend_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def reorder_AB_bargmann(self, A: tf.Tensor, B: tf.Tensor) -> Tuple[tf.Tensor, tf
r"""In mrmustard.math.compactFock.compactFock~ dimensions of the Fock representation are ordered like [mode0,mode0,mode1,mode1,...]
while in mrmustard.physics.bargmann the ordering is [mode0,mode1,...,mode0,mode1,...]. Here we reorder A and B.
"""
ordering = np.arange(2 * A.shape[0] // 2).reshape(2, -1).T.flatten()
ordering = np.arange(2 * A.shape[0] // 2).reshape(2, -1).T.flatten() # ordering is [0,2,4,...,1,3,5,...]
A = tf.gather(A, ordering, axis=1)
A = tf.gather(A, ordering)
B = tf.gather(B, ordering)
Expand Down
4 changes: 2 additions & 2 deletions mrmustard/physics/fock.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def f_hermite_polys(xi):
poly = math.hermite_renormalized(
R, 2 * math.astensor([xi], "complex128"), 1 + 0j, (cutoff,)
)
return math.cast(poly, "float64")
return math.real(poly)

hermite_polys = math.map_fn(f_hermite_polys, x_tensor)

Expand Down Expand Up @@ -844,7 +844,7 @@ def quadrature_distribution(
else math.abs(math.einsum("n,nj->j", state, psi_x)) ** 2
)

return x, math.cast(pdf, "float64")
return x, math.real(pdf)


def sample_homodyne(state: Tensor, quadrature_angle: float = 0.0) -> Tuple[float, float]:
Expand Down
Loading