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

Symbolics.hessian and Symbolics.sparsehessian discrepancy #1046

Open
asterycs opened this issue Jan 29, 2024 · 1 comment
Open

Symbolics.hessian and Symbolics.sparsehessian discrepancy #1046

asterycs opened this issue Jan 29, 2024 · 1 comment

Comments

@asterycs
Copy link
Contributor

Hello! I encountered a use case that errors with sparsehessian but not with hessian. Below is an MVE:

using Symbolics

function f(x, y)
    y[1] * x'*x + y[2] * x'*x
end

@variables x[1:10] y[1:2]

H = Symbolics.hessian(f(collect(x), collect(y)), collect(x))
# H = Symbolics.sparsehessian(f(collect(x), collect(y)), collect(x)) # errors

hfuns = Symbolics.build_function(H, collect(x), collect(y), expression = Val{false}())

@show hfuns[1](ones(10), [2.0, 3.0])

The error message is rather long but starts with:

ERROR: LoadError: Failed to apply rule (~f)(~x, ~y) => begin ...
...
[40] top-level scope
    @ (...)/main.jl:10

Could this be a bug or is it perhaps a limitation of sparsehessian?

@ChrisRackauckas
Copy link
Member

This looks like a bug.

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

2 participants