Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tril #203

Open
ArnoStrouwen opened this issue Oct 8, 2022 · 0 comments
Open

tril #203

ArnoStrouwen opened this issue Oct 8, 2022 · 0 comments

Comments

@ArnoStrouwen
Copy link
Contributor

the symmetry of the hessian is exploited for extra compression (casadi also does this):
https://github.com/JuliaDiff/SparseDiffTools.jl/blob/master/test/test_sparse_hessian.jl#L12
But I don't immediately see how that extra compression is then later recovered:
https://github.com/JuliaDiff/SparseDiffTools.jl/blob/master/src/differentiation/compute_hessian_ad.jl#L142

using Pkg; Pkg.activate(".")
using SparsityDetection
using SparseDiffTools
function f(x)
    y = zero(eltype(x))
    for i in firstindex(x):lastindex(x)-1
        y += x[i]*x[i+1]
    end
    return y
end
f(rand(10))

x = randn(5)
sparsity = hessian_sparsity(f, x)

colors = matrix_colors(tril(sparsity))
colors2 = matrix_colors(sparsity)

ncolors = maximum(colors)
ncolors2 = maximum(colors2)

hescache = ForwardAutoColorHesCache(f, x, colors, sparsity)
hescache2 = ForwardAutoColorHesCache(f, x, colors2, sparsity)

H = SparseDiffTools.autoauto_color_hessian(f, x, hescache)
H2 = SparseDiffTools.autoauto_color_hessian(f, x, hescache2)
H3 = SparseDiffTools.autoauto_color_hessian(f, x)

Also, H3 is not really sparse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant