Open Roger-luo opened 4 years ago
Ah, yes, this is generally problematic. I always do something similar to what you've done (I'll usually add the identity to x * x'
to ensure it's reasonably well conditioned though), but it's not a particularly satisfying solution.
Perhaps a bit of an old issue, but just wanted to remark that there is also the solution of using forward_fdm
instead of central_fdm
:
julia> x = randn(2, 2); x = x'x;
julia> v = randn(2, 2); v = v'v;
julia> forward_fdm(5, 1)(ε -> logdet(x + ε .* v), 0)
38.547460846816136
central_fdm
will cause problem when one wants the input always being positive semidefinite, e.g the real valuelogdet
function. It cause the gradcheck oflogdet
in Zygote fails occasionally, any idea how to preserve this property while doing FDM?Update: I workaround it by doing