Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pablo Piskunow
kwant
Commits
10ad6730
Commit
10ad6730
authored
Dec 10, 2020
by
Joseph Weston
Browse files
refactor to reduce code duplication
parent
180855fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
kwant/solvers/common.py
View file @
10ad6730
...
...
@@ -989,9 +989,8 @@ class GreensFunction(BlockResult):
result
=
np
.
trace
(
attdagainv
).
real
if
lead_out
==
lead_in
:
# For reflection we have to be more careful
gamma
=
1j
*
(
self
.
lead_info
[
lead_in
]
-
self
.
lead_info
[
lead_in
].
conj
().
T
)
sigma
=
self
.
lead_info
[
lead_in
]
gamma
=
1j
*
(
sigma
-
sigma
.
conj
().
T
)
gf
=
self
.
submatrix
(
lead_out
,
lead_in
)
# The number of channels is given by the number of
...
...
@@ -1000,9 +999,10 @@ class GreensFunction(BlockResult):
# Golub; van Loan, chapter 5.5.8
# We use ‖Σ‖, not ‖Γ‖, for the tolerance as ‖Γ‖~0 when there
# are no open modes.
eps
=
np
.
finfo
(
gamma
.
dtype
).
eps
*
1000
N
=
np
.
sum
(
np
.
linalg
.
eigvalsh
(
gamma
)
>
eps
*
np
.
linalg
.
norm
(
sigma
,
np
.
inf
))
eps
=
(
1e3
*
np
.
finfo
(
gamma
.
dtype
).
eps
*
np
.
linalg
.
norm
(
sigma
,
np
.
inf
)
)
N
=
np
.
sum
(
np
.
linalg
.
eigvalsh
(
gamma
)
>
eps
)
result
+=
2
*
np
.
trace
(
np
.
dot
(
gamma
,
gf
)).
imag
+
N
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment