sqrtm increases precision, so cast back to double
This commit is contained in:
parent
be620f7137
commit
d8ec46674d
@ -578,7 +578,7 @@ def eigsolve(
|
|||||||
|
|
||||||
trace_U = real(trace(U))
|
trace_U = real(trace(U))
|
||||||
if trace_U > 1e8 * num_modes:
|
if trace_U > 1e8 * num_modes:
|
||||||
Z = Z @ scipy.linalg.sqrtm(U).conj().T
|
Z = Z @ scipy.linalg.sqrtm(U).astype(numpy.complex128).conj().T
|
||||||
prev_traceGtKG = 0
|
prev_traceGtKG = 0
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
@ -741,7 +741,7 @@ def eigsolve(
|
|||||||
# Recover eigenvectors from Z
|
# Recover eigenvectors from Z
|
||||||
#
|
#
|
||||||
U = numpy.linalg.inv(ZtZ)
|
U = numpy.linalg.inv(ZtZ)
|
||||||
Y = Z @ scipy.linalg.sqrtm(U)
|
Y = Z @ scipy.linalg.sqrtm(U).astype(numpy.complex128)
|
||||||
W = Y.conj().T @ (scipy_op @ Y.copy())
|
W = Y.conj().T @ (scipy_op @ Y.copy())
|
||||||
|
|
||||||
eigvals, W_eigvecs = numpy.linalg.eig(W)
|
eigvals, W_eigvecs = numpy.linalg.eig(W)
|
||||||
|
Loading…
Reference in New Issue
Block a user