Skip to content

Commit

Permalink
Account for block structure in degeneracy check
Browse files Browse the repository at this point in the history
Co-authored-by: Lander Burgelman <[email protected]>
  • Loading branch information
pbrehmer and leburgel authored Mar 12, 2024
1 parent 6e3ab2b commit c13bb72
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utility/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ end
function is_degenerate_spectrum(
S; atol::Real=0, rtol::Real=atol > 0 ? 0 : sqrt(eps(scalartype(S)))
)
s = diag(S.data)
for i in 1:(length(s) - 1)
isapprox(s[i], s[i + 1]; atol, rtol) && return true
for (_, b) in blocks(S)
s = real(diag(b))
for i in 1:(length(s) - 1)
isapprox(s[i], s[i + 1]; atol, rtol) && return true
end
end
return false
end
Expand Down

0 comments on commit c13bb72

Please sign in to comment.