Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gha3mi/fordiff
ForDiff - A Fortran library for numerical differentiation
https://github.com/gha3mi/fordiff
complex-step-differentiation derivative differentiation finite-difference fortran fortran-package-manager
Last synced: about 1 month ago
JSON representation
ForDiff - A Fortran library for numerical differentiation
- Host: GitHub
- URL: https://github.com/gha3mi/fordiff
- Owner: gha3mi
- License: bsd-3-clause
- Created: 2023-07-02T19:32:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-26T08:21:21.000Z (12 months ago)
- Last Synced: 2024-01-26T15:53:50.044Z (12 months ago)
- Topics: complex-step-differentiation, derivative, differentiation, finite-difference, fortran, fortran-package-manager
- Language: Fortran
- Homepage: https://gha3mi.github.io/fordiff/
- Size: 700 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GitHub](https://img.shields.io/badge/GitHub-fordiff-blue.svg?style=social&logo=github)](https://github.com/gha3mi/fordiff)
[![Version](https://img.shields.io/github/release/gha3mi/fordiff.svg)](https://github.com/gha3mi/fordiff/releases/latest)
[![Documentation](https://img.shields.io/badge/ford-Documentation%20-blueviolet.svg)](https://gha3mi.github.io/fordiff/)
[![License](https://img.shields.io/github/license/gha3mi/fordiff?color=green)](https://github.com/gha3mi/fordiff/blob/main/LICENSE)
[![Build](https://github.com/gha3mi/fordiff/actions/workflows/CI_test.yml/badge.svg)](https://github.com/gha3mi/fordiff/actions/workflows/CI_test.yml)**ForDiff**: A Fortran library for numerical differentiation
- [fpm dependency](#fpm-dependency)
- [Usage](#usage)
- [Run Demos](#run-demos)
- [Run Tests](#run-tests)
- [TODO](#todo)
- [API documentation](#api-documentation)
- [Contributing](#contributing)## fpm dependency
To use `ForDiff` as a dependency in your fpm project, include the following line in your `fpm.toml` file:
```toml
[dependencies]
fordiff = {git="https://github.com/gha3mi/fordiff.git"}
```## Usage
```fortran
use fordiff
dfdx = derivative(f, x, h, method)
```## Run Demos
`example/demo1.f90` demonstrates how to compute the derivative of a scalar-valued function w.r.t to a scalar variable using complex-step and finite-difference methods.
```bash
fpm run --example demo1
````example/demo2.f90` demonstrates how to compute the derivative of a scalar-valued function w.r.t to a vector variable using complex-step and finite-difference methods.
```bash
fpm run --example demo2
````example/demo3.f90` demonstrates how to compute the derivative of a vector-valued function w.r.t to a vector variable using complex-step and finite-difference methods.
```bash
fpm run --example demo3
```## Run Tests
The `tests` directory contains test programs to verify the functionality of the `fordiff` module. To run the tests using `fpm`, you can use response files for specific compilers:
```bash
fpm @test-
````: gfortran, ifx, ifort, nvfortran`
## TODO
- [x] Complex-step: f(x) f is a scalar-valued function and x is a scalar variable
- [x] Complex-step: f(x) f is a scalar-valued function and x is a vector variable
- [x] Complex-step: f(x) f is a vector-valued function and x is a vector variable
- [x] Finite Difference: f(x) f is a scalar-valued function and x is a scalar variable
- [x] Finite Difference: f(x) f is a scalar-valued function and x is a vector variable
- [x] Finite Difference: f(x) f is a vector-valued function and x is a vector variable
- [ ] Automatic Differentiation## API documentation
The most up-to-date API documentation for the main branch is available
[here](https://gha3mi.github.io/fordiff/).
To generate the API documentation for `ForDiff` using
[ford](https://github.com/Fortran-FOSS-Programmers/ford) run the following
command:```shell
ford ford.yml
```## Contributing
Contributions to fordiff are welcome! If you find any issues or would like to suggest improvements, please open an issue or submit a pull request.