Skip to content

Take advantage of symmetry in hessian #836

Description

@gdalle

As the benchmarks of HyperHessians.jl suggest (@KristofferC), symmetry can probably speed up Hessians quite a bit, even though it is not the only factor. It would be nice to take advantage of it here!

Activity

  1. KristofferC commented on Aug 15, 2026

    @KristofferC
    Collaborator

    You won't get this clean code

    function hessian!(result::AbstractArray, f::F, x::AbstractArray, cfg::HessianConfig{T} = HessianConfig(f, x), ::Val{CHK}=Val{true}()) where {F,T,CHK}
    require_one_based_indexing(result, x)
    CHK && checktag(T, f, x)
    ∇f = y -> gradient(f, y, cfg.gradient_config, Val{false}())
    jacobian!(result, ∇f, x, cfg.jacobian_config, Val{false}())
    return result
    end
    but it is probably worth doing anyway.

  2. gdalle commented on Aug 15, 2026

    @gdalle
    MemberAuthor

    Worst-case scenario, we hide it behind a config option so that it is non-breaking and optional

  3. KristofferC commented on Aug 15, 2026

    @KristofferC
    Collaborator

    I don't see why it would be breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions