DNAOAD (FPM Version)
September 15, 2025 ยท View on GitHub
Dual Numbers for Arbitrary Order Automatic Differentiation in Modern Fortran
This repository provides a Fortran Package Manager (fpm) compatible version of the dual number implementation for arbitrary-order automatic differentiation (DNAOAD).
โ ๏ธ Note: The core code is essentially the same as in the original repository fpenunuri/DNAOAD, with some changes for FPM compatibility. For more information, see the preprint: ๐ arXiv:2501.04159
๐ Project Structure
src/โ Fortran source modulesapp/โ Executable programsdocs/โ Documentation of module functionsfpm.tomlโ Project configuration file
๐ฆ Requirements
- A Fortran compiler (e.g.,
gfortran,ifx) - A recent version of
fpm
To install fpm, visit:
๐ https://github.com/fortran-lang/fpm
๐ ๏ธ Building with ifx (default: real64)
From the project root:
FPM_FC=ifx fpm build
โถ๏ธ Running Examples
Example 1 (default real64, max order = 5)
FPM_FC=ifx fpm run ex1
Example 2 (requires higher order derivatives)
By default, MAX_ORDER_DUALZN = 5. The example ex2 requires at least 10:
FPM_FC=ifx fpm run --flag "-DMAX_ORDER_DUALZN=10" ex2
โ๏ธ Using real128 Precision
To build and run using real128 precision:
FPM_FC=ifx fpm build --flag "-DUSE_REAL128"
Run ex2 with higher derivative order:
FPM_FC=ifx fpm run --flag "-DUSE_REAL128 -DMAX_ORDER_DUALZN=10" ex2