forked from jan/fdfd_tools
In-place normalization during eigensolve
This commit is contained in:
parent
7342c8efd7
commit
17fa2aa3d3
@ -67,8 +67,8 @@ def solve_waveguide_mode_2d(mode_number: int,
|
||||
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)
|
||||
v = w / numpy.linalg.norm(w)
|
||||
v = spalg.spsolve(A - eigval * sparse.eye(A.shape[0]), v)
|
||||
v /= numpy.linalg.norm(v)
|
||||
|
||||
# Calculate the wave-vector (force the real part to be positive)
|
||||
wavenumber = numpy.sqrt(eigval)
|
||||
|
Loading…
Reference in New Issue
Block a user