Adaptive Gaussian Quadrature with Modern Fortran
An object-oriented modern Fortran library to integrate functions using adaptive Gaussian quadrature. There are five selectable methods to use:
- Adaptive 6-point Legendre-Gauss
- Adaptive 8-point Legendre-Gauss
- Adaptive 10-point Legendre-Gauss
- Adaptive 12-point Legendre-Gauss
- Adaptive 14-point Legendre-Gauss
The library supports:
1D integration:
The core code is based on the SLATEC routine DGAUS8 (which is the source of the 8-point routine). Coefficients for the others were obtained from here. The original 1D code has been generalized for multi-dimensional integration.
A Fortran Package Manager manifest file is included, so that the library and test cases can be compiled with FPM. For example:
fpm build --profile release
fpm test --profile release
By default, the library is built with double precision (real64
) real values. Explicitly specifying the real kind can be done using the following preprocessor 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"
To use quadrature-fortran
within your fpm project, add the following to your fpm.toml
file:
[dependencies]
quadrature-fortran = { git="https://github.com/jacobwilliams/quadrature-fortran.git" }
or, to use a specific version:
[dependencies]
quadrature-fortran = { git="https://github.com/jacobwilliams/quadrature-fortran.git", tag = "1.0.0" }
The API documentation for the current master
branch can be found here. This is generated by processing the source files with FORD.
The quadrature-fortran source code and related files and documentation are distributed under a permissive free software license (BSD-style).
- quadpack -- Modern Fortran QUADPACK Library for 1D numerical quadrature
- adaptive quadrature, automatic integrator, gauss quadrature, numerical integration