Tutorials
These tutorials will guide you through using diffstruc for automatic differentiation in Fortran.
The tutorials are organised to build your understanding progressively:
Basics - Get started with automatic differentiation using diffstruc
Forward Mode - Learn how to use forward-mode automatic differentiation
Reverse Mode - Learn how to use reverse-mode (backpropagation) automatic differentiation
Higher-Order Derivatives - Learn how to compute second and higher-order derivatives
Operations - Learn about the supported mathematical operations and how to define custom ones
Memory Management - Learn how to manage memory effectively when using diffstruc
Before starting these tutorials, make sure you have:
Installed diffstruc (see Installation)
A working Fortran compiler (gfortran >= 14.3.0 or ifx >= 2025.2.0)
Basic understanding of Fortran programming
Familiarity with calculus and derivatives
Basics of Automatic Differentiation:
1st order Derivatives:
Higher-Order Derivatives:
Supported Operations and Custom Definitions: