Skip to content

Commit

Permalink
Fix gauge-fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrehmer committed Oct 28, 2024
1 parent cd309f7 commit 6ba61dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utility/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ end
# Compute √S⁻¹ for diagonal TensorMaps
_safe_inv(a, tol) = abs(a) < tol ? zero(a) : inv(a)
function sdiag_inv_sqrt(S::AbstractTensorMap; tol::Real=eps(eltype(S))^(3 / 4))
tol *= S[1]
invsq = similar(S)

if sectortype(S) == Trivial
tol *= S[1]
copyto!(
invsq.data,
LinearAlgebra.diagm(_safe_inv.(LinearAlgebra.diag(S.data), tol) .^ (1 / 2)),
)
else
for (k, b) in blocks(S)
tol *= b[1]
copyto!(
blocks(invsq)[k],
LinearAlgebra.diagm(_safe_inv.(LinearAlgebra.diag(b), tol) .^ (1 / 2)),
Expand Down

0 comments on commit 6ba61dc

Please sign in to comment.