Codes that calculates sqrt or eigen on Hermitian matrices works in the v0.10.39 branch, but hangs in the v1.x releases, example mwe:
using GenericLinearAlgebra
using ForwardDiff
const sx = Matrix{ComplexF64}([0 1; 1 0])
const sy = Matrix{ComplexF64}([0 -im; im 0])
const sz = Matrix{ComplexF64}([1 0; 0 -1])
const ms = [sx, sy, sz]
const hs = [kron(x, x) for x in ms]
function f(g; hs)
m = sin(g) * hs[1] + cos(g^2) * hs[2] + sin(cos(g / 2)) * hs[3]
mh = Hermitian(m)
mhs = Hermitian(sqrt(mh))
l = abs.(eigvals(mhs))
sum(l) - maximum(l) / 2
end
g(x) = f(x; hs)
@time ForwardDiff.derivative(g, 0.1)
may be more related to sqrt
since it works fine it's not there, test with mhs = mh
.