Fix eigenvalue solver for complex matrices

This commit is contained in:
jan 2017-09-24 19:11:56 -07:00
parent 6748181f8f
commit c14298484d

View File

@ -64,7 +64,7 @@ def solve_waveguide_mode_2d(mode_number: int,
eigval = None
for _ in range(40):
eigval = v @ A @ v
eigval = v.conj() @ A @ v
if numpy.linalg.norm(A @ v - eigval * v) < 1e-13:
break
w = spalg.spsolve(A - eigval * sparse.eye(A.shape[0]), v)