Code Generation for Gradients and Hessians Using Symbolic AD

This package provides symbolic automatic differentiation tools for efficient code generation of gradients and Hessians.

Vous suivez désormais cette soumission

This package contains functions for performing symbolic automatic differentiation to efficiently generate code for gradient and Hessian expressions. It relies on Matlab’s Symbolic Math Toolbox, which must be available.
The examples "Example1" and "Example2" demonstrate how the automatic differentiation works, both with and without simplification of expressions. The corresponding scripts "Example1toC" and "Example2toC" show how to generate C code from the resulting expressions. The generated code can then be compiled into executable functions, as illustrated in the scripts "testExampleFun1", "testExampleFun2", and "testExampleFun1Fun2".
A C compiler must be installed for this step, see the Matlab documentation on mex.
There is also support for generating Hessians in sparse matrix format with block structure, demonstrated in "ExampleCameraEstimation1" and "ExampleCameraEstimation2". Generating this code takes longer due to the larger size and complexity of the symbolic expressions.

Citation pour cette source

Per Bergström (2026). Code Generation for Gradients and Hessians Using Symbolic AD (https://fr.mathworks.com/matlabcentral/fileexchange/180850-code-generation-for-gradients-and-hessians-using-symbolic-ad), MATLAB Central File Exchange. Extrait(e) le .

Add the first tag.

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0