Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jacobwilliams/quadrature-fortran

1D-6D Adaptive Gaussian Quadrature with Modern Fortran
https://github.com/jacobwilliams/quadrature-fortran

fortran fortran-package-manager integration numerical-integration quadrature quadrature-integration

Last synced: about 6 hours ago
JSON representation

1D-6D Adaptive Gaussian Quadrature with Modern Fortran

Awesome Lists containing this project

README

        

![quadrature-fortran](media/logo.png)
============

Adaptive Gaussian Quadrature with Modern Fortran

### Status
[![GitHub release](https://img.shields.io/github/release/jacobwilliams/quadrature-fortran.svg)](https://github.com/jacobwilliams/quadrature-fortran/releases/latest)
[![CI Status](https://github.com/jacobwilliams/quadrature-fortran/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/quadrature-fortran/actions)
[![codecov](https://codecov.io/gh/jacobwilliams/quadrature-fortran/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/quadrature-fortran)
[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/quadrature-fortran)](https://github.com/jacobwilliams/quadrature-fortran/commits/master)

### 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:
$$\int_{x_l}^{x_u} f(x) dx$$
2D integration:
$$\int_{y_l}^{y_u} \int_{x_l}^{x_u} f(x,y) dx dy$$
3D integration:
$$\int_{z_l}^{z_u} \int_{y_l}^{y_u} \int_{x_l} ^{x_u} f(x,y,z) dx dy dz$$
4D integration:
$$\int_{q_l}^{q_u} \int_{z_l}^{z_u} \int_{y_l} ^{y_u} \int_{x_l}^{x_u} f(x,y,z,q) dx dy dz dq$$
5D integration:
$$\int_{r_l}^{r_u} \int_{q_l}^{q_u} \int_{z_l} ^{z_u} \int_{y_l}^{y_u} \int_{x_l}^{x_u} f(x, y,z,q,r) dx dy dz dq dr$$
6D integration:
$$\int_{s_l}^{s_u} \int_{r_l}^{r_u} \int_{q_l} ^{q_u} \int_{z_l}^{z_u} \int_{y_l}^{y_u} \int_ {x_l}^{x_u} f(x,y,z,q,r,s) dx dy dz dq dr ds$$

The core code is based on the SLATEC routine [DGAUS8](http://www.netlib.org/slatec/src/dgaus8.f) (which is the source of the 8-point routine). Coefficients for the others were obtained from [here](http://processingjs.nihongoresources.com/bezierinfo/legendre-gauss-values.php). The original 1D code has been generalized for multi-dimensional integration.

### Compiling

A [Fortran Package Manager](https://github.com/fortran-lang/fpm) 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:
```toml
[dependencies]
quadrature-fortran = { git="https://github.com/jacobwilliams/quadrature-fortran.git" }
```

or, to use a specific version:
```toml
[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](https://jacobwilliams.github.io/quadrature-fortran/). This is generated by processing the source files with [FORD](https://github.com/Fortran-FOSS-Programmers/ford).

### License

The quadrature-fortran source code and related files and documentation are distributed under a permissive free software [license](https://github.com/jacobwilliams/quadrature-fortran/blob/master/LICENSE) (BSD-style).

### See also

* [quadpack](https://github.com/jacobwilliams/quadpack) -- Modern Fortran QUADPACK Library for 1D numerical quadrature

### Keywords

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