Adaptive Gaussian Quadrature with Modern Fortran

Find us on…

GitHub

quadrature-fortran

quadrature-fortran

Adaptive Gaussian Quadrature with Modern Fortran

Status

GitHub release CI Status codecov last-commit

Brief description

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: 2D integration: 3D integration: 4D integration: 5D integration: 6D 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.

Compiling

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" }

Documentation

The API documentation for the current master branch can be found here. This is generated by processing the source files with FORD.

License

The quadrature-fortran source code and related files and documentation are distributed under a permissive free software license (BSD-style).

See also

  • quadpack -- Modern Fortran QUADPACK Library for 1D numerical quadrature

Keywords

  • adaptive quadrature, automatic integrator, gauss quadrature, numerical integration

Developer Info

Jacob Williams

Source Files