JuliaDiff / SparseDiffTools.jl

Fast jacobian computation through sparsity exploitation and matrix coloring
MIT License
238 stars 41 forks source link

Hessian is wrong with intervals #67

Closed dpsanders closed 4 years ago

dpsanders commented 4 years ago
julia> using IntervalArithmetic, SparseDiffTools

julia> f(X) = ( (x, y) = X; x^2 + y^2 )
f (generic function with 2 methods)

julia> @edit forwarddiff_color_jacobian(∇(f), IntervalBox(0..0, 2).v)

julia> forwarddiff_color_jacobian(∇(f), IntervalBox(0..0, 2).v)
2×2 StaticArrays.MArray{Tuple{2,2},Interval{Float64},2,4} with indices SOneTo(2)×SOneTo(2):
 [0, 2]  [0, 0]
 [0, 0]  [0, 2]

The result should be [2..2 0..0; 0..0; 2..2].

dpsanders commented 4 years ago

The same thing happens with ForwardDiff.

dpsanders commented 4 years ago

This seems to be due to something in IntervalArithmetic; the released version of IntervalArithmetic works correctly. Sorry for the noise.