This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Description 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.
Reactions are currently unavailable
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
Also,
H3is not really sparse.