You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into the same issue, the problem only appears when there are variables in the expression that are not taken derivatives with respect to, e.g.,
julia>@variables a[1:2]
1-element Vector{Symbolics.Arr{Num, 1}}:
a[1:2]
julia> a =collect(a)
2-element Vector{Num}:
a[1]
a[2]
julia> ex = (a[1]+a[2])^2
(a[1] + a[2])^2
julia> Symbolics.hessian(ex, [a[1]]) # non-sparse hessian works1×1 Matrix{Num}:2
julia> Symbolics.sparsehessian(ex, [a[1]]) # Include only one variable => error
ERROR: Failed to apply rule (~f)(~x, ~y) =>begin#= /home/fredrikb/.julia/packages/Symbolics/1OrKJ/src/diff.jl:556 =#ifhaslinearity_2(~f)
#= /home/fredrikb/.julia/packages/Symbolics/1OrKJ/src/diff.jl:557 =#
julia> Symbolics.sparsehessian(ex, a) # Include both a => no error2×2 SparseArrays.SparseMatrixCSC{Num, Int64} with 4 stored entries:2222
This is on the latest
master
of Symbolics.jl:┆Issue is synchronized with this Trello card by Unito
The text was updated successfully, but these errors were encountered: