Code Generation for Gradients and Hessians Using Symbolic AD

This package provides symbolic automatic differentiation tools for efficient code generation of gradients and Hessians.
5 download
Aggiornato 22 apr 2025

Visualizza la licenza

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.

Cita come

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

Compatibilità della release di MATLAB
Creato con R2024b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Tag Aggiungi tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0