Skip to content

Commit

Permalink
another bugfix for symbolic global phase treatment
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Jun 19, 2024
1 parent ec012e1 commit 45abd5f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qrisp/simulator/unitary_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ def u3matrix(theta, phi, lam, global_phase, use_sympy = False):
if not use_sympy:
module = numpy
I = 1j
res = numpy.empty(shape=(2, 2), dtype=numpy.complex64)
res = numpy.empty(shape=(2, 2), dtype=np_dtype)
exp_gphase = module.exp(I * global_phase, dtype = np_dtype)
else:
module = sympy
I = sympy.I
res = numpy.empty(shape=(2, 2), dtype=numpy.dtype("O"))

exp_gphase = module.exp(I * global_phase)



Expand All @@ -63,7 +66,7 @@ def u3matrix(theta, phi, lam, global_phase, use_sympy = False):
res[1, 0] = module.exp(I * phi) * module.sin(theta / 2)
res[1, 1] = module.exp(I * (phi + lam)) * module.cos(theta / 2)

return res * module.exp(I * global_phase, dtype = np_dtype)
return res*exp_gphase


# Efficient function to generate the unitary of a controlled gate
Expand Down

0 comments on commit 45abd5f

Please sign in to comment.