Skip to content

Commit

Permalink
some weird dtype bugfix to make tensorflow happy
Browse files Browse the repository at this point in the history
  • Loading branch information
arsalan-motamedi committed Oct 18, 2024
1 parent 2902e70 commit 58f2827
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mrmustard/physics/triples.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,18 +616,18 @@ def gaussian_random_noise_Abc(Y: RealMatrix) -> Union[Matrix, Vector, Scalar]:
The ``(A, b, c)`` triple of the Gaussian random noise channel.
"""
m = Y.shape[-1] // 2
xi = math.eye(2 * m) + Y / settings.HBAR
xi = math.eye(2 * m, dtype=math.complex128) + Y / settings.HBAR
xi_inv = math.inv(xi)
temp = math.block([[math.eye(2 * m) - xi_inv, xi_inv], [xi_inv, math.eye(2 * m) - xi_inv]])
R = (
1
/ np.sqrt(2)
* math.block(
[
[math.eye(m), 1j * math.eye(m), math.zeros((m, 2 * m))],
[math.zeros((m, 2 * m)), math.eye(m), -1j * math.eye(m)],
[math.eye(m), -1j * math.eye(m), math.zeros((m, 2 * m))],
[math.zeros((m, 2 * m)), math.eye(m), 1j * math.eye(m)],
[math.eye(m, dtype = math.complex128), 1j * math.eye(m, dtype = math.complex128), math.zeros((m, 2 * m), dtype = math.complex128)],
[math.zeros((m, 2 * m), dtype = math.complex128), math.eye(m, dtype = math.complex128), -1j * math.eye(m, dtype = math.complex128)],
[math.eye(m, dtype = math.complex128), -1j * math.eye(m, dtype = math.complex128), math.zeros((m, 2 * m), dtype = math.complex128)],
[math.zeros((m, 2 * m), dtype = math.complex128), math.eye(m, dtype = math.complex128), 1j * math.eye(m, dtype = math.complex128)],
]
)
)
Expand Down

0 comments on commit 58f2827

Please sign in to comment.