NumDiff provides a modern Fortran interface for computing the Jacobian (derivative) matrix of m
nonlinear functions which depend on n
variables. The Jacobian matrix is required for various applications, including numerical optimization. It can also be used to test the accuracy of gradients computed by other means. The library also provides for computing the sparsity of this matrix, and returning the Jacobian in sparse or dense form.
This is currently a work in progress. The goal is a comprehensive library that contains a full suite of computationally efficient implementations of algorithms for sparsity determination and numerical differentiation. This code is hosted on GitHub at: https://github.com/jacobwilliams/NumDiff
true
A Fortran Package Manager manifest file is included, so that the library and tests cases can be compiled with FPM. For example:
fpm build --profile release
fpm test --profile release
To use NumDiff
within your FPM project, add the following to your fpm.toml
file:
[dependencies]
NumDiff = { git="https://github.com/jacobwilliams/NumDiff.git" }
or, to use a specific version:
[dependencies]
NumDiff = { git="https://github.com/jacobwilliams/NumDiff.git", tag = "1.7.0" }
To generate the documentation using FORD, run:
ford ford.md
By default, the library is built with double precision (real64
) real values. Explicitly specifying the real kind can be done using the following processor flags:
Preprocessor flag | Kind | Number of bytes |
---|---|---|
REAL32 |
real(kind=real32) |
4 |
REAL64 |
real(kind=real64) |
8 |
REAL128 |
real(kind=real128) |
16 |
For example, to build a single precision version of the library, use:
fpm build --profile release --flag "-DREAL32"
Note that the pyplot-fortran library is a dependency for one of the test cases. FPM will automatically download the right version.
The latest API documentation can be found here. This was generated from the source code using FORD (note that the included build.sh
script will also generate these files).
The NumDiff source code and related files and documentation are distributed under a permissive free software license (BSD-style).