I am here to reporting some dubious results from the derivative of a matrix inversion for the diagonal matrix. Package version: [f6369f11] ForwardDiff v0.10.14 `A = [0.5 0 0 ; 0 0.5 0; 0 0 0.5]` ```julia ForwardDiff.gradient(A -> sum(inv(A)), A) ``` result: ```julia 3×3 Array{Float64,2}: -4.0 -4.0 -4.0 0.0 -4.0 -4.0 0.0 0.0 -4.0 ``` However, the analytical result should be: ```julia -inv(A) * ones(3,3) * inv(A) ``` result: ```julia 3×3 Array{Float64,2}: -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 ``` The Zygote gradient function ```julia Zygote.gradient(A -> sum(inv(A)), A)[1] ``` result: ```julia 3×3 Array{Float64,2}: -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 -4.0 ```