Skip to content
Snippets Groups Projects
Verified Commit d1adb928 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

use that sqrt_hop is never None

parent 6d067c16
No related branches found
No related tags found
No related merge requests found
Pipeline #18181 passed with warnings
...@@ -174,11 +174,11 @@ class StabilizedModes: ...@@ -174,11 +174,11 @@ class StabilizedModes:
Translation eigenvectors divided by the corresponding eigenvalues. Translation eigenvectors divided by the corresponding eigenvalues.
nmodes : int nmodes : int
Number of left-moving (or right-moving) modes. Number of left-moving (or right-moving) modes.
sqrt_hop : numpy array or None sqrt_hop : numpy array
Part of the SVD of `h_hop`, or None if the latter is invertible. Part of the SVD of `h_hop`.
""" """
def __init__(self, vecs, vecslmbdainv, nmodes, sqrt_hop=None): def __init__(self, vecs, vecslmbdainv, nmodes, sqrt_hop):
kwargs = locals() kwargs = locals()
kwargs.pop('self') kwargs.pop('self')
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
......
...@@ -210,8 +210,7 @@ class SparseSolver(metaclass=abc.ABCMeta): ...@@ -210,8 +210,7 @@ class SparseSolver(metaclass=abc.ABCMeta):
iface_orbs = np.r_[tuple(slice(offsets[i], offsets[i + 1]) iface_orbs = np.r_[tuple(slice(offsets[i], offsets[i + 1])
for i in interface)] for i in interface)]
n_lead_orbs = (svd_v.shape[0] if svd_v is not None n_lead_orbs = svd_v.shape[0]
else u_out.shape[0])
if n_lead_orbs != len(iface_orbs): if n_lead_orbs != len(iface_orbs):
msg = ('Lead {0} has hopping with dimensions ' msg = ('Lead {0} has hopping with dimensions '
'incompatible with its interface dimension.') 'incompatible with its interface dimension.')
...@@ -221,25 +220,17 @@ class SparseSolver(metaclass=abc.ABCMeta): ...@@ -221,25 +220,17 @@ class SparseSolver(metaclass=abc.ABCMeta):
transf = sp.csc_matrix((np.ones(len(iface_orbs)), coords), transf = sp.csc_matrix((np.ones(len(iface_orbs)), coords),
shape=(iface_orbs.size, lhs.shape[0])) shape=(iface_orbs.size, lhs.shape[0]))
if svd_v is not None: v_sp = sp.csc_matrix(svd_v.T.conj()) * transf
v_sp = sp.csc_matrix(svd_v.T.conj()) * transf vdaguout_sp = (transf.T *
vdaguout_sp = (transf.T * sp.csc_matrix(np.dot(svd_v, u_out)))
sp.csc_matrix(np.dot(svd_v, u_out))) lead_mat = - ulinv_out
lead_mat = - ulinv_out
else:
v_sp = transf
vdaguout_sp = transf.T * sp.csc_matrix(u_out)
lead_mat = - ulinv_out
lhs = sp.bmat([[lhs, vdaguout_sp], [v_sp, lead_mat]], lhs = sp.bmat([[lhs, vdaguout_sp], [v_sp, lead_mat]],
format=self.lhsformat) format=self.lhsformat)
if leadnum in in_leads and nprop > 0: if leadnum in in_leads and nprop > 0:
if svd_v is not None: vdaguin_sp = transf.T * sp.csc_matrix(
vdaguin_sp = transf.T * sp.csc_matrix( -np.dot(svd_v, u_in))
-np.dot(svd_v, u_in))
else:
vdaguin_sp = transf.T * sp.csc_matrix(-u_in)
# defer formation of the real matrix until the proper # defer formation of the real matrix until the proper
# system size is known # system size is known
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment