Coder Social home page Coder Social logo

gha3mi / fordiff Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 717 KB

ForDiff - A Fortran library for numerical differentiation

Home Page: https://gha3mi.github.io/fordiff/

License: BSD 3-Clause "New" or "Revised" License

Fortran 100.00%
complex-step-differentiation derivative differentiation fortran fortran-package-manager finite-difference

fordiff's Introduction

GitHub Version Documentation License Build

ForDiff: A Fortran library for numerical differentiation

fpm dependency

To use ForDiff as a dependency in your fpm project, include the following line in your fpm.toml file:

[dependencies]
fordiff = {git="https://github.com/gha3mi/fordiff.git"}

Usage

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.

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.

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.

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:

fpm @test-<compiler>

<compiler>: gfortran, ifx, ifort, nvfortran

TODO

  • Complex-step: f(x) f is a scalar-valued function and x is a scalar variable
  • Complex-step: f(x) f is a scalar-valued function and x is a vector variable
  • Complex-step: f(x) f is a vector-valued function and x is a vector variable
  • Finite Difference: f(x) f is a scalar-valued function and x is a scalar variable
  • Finite Difference: f(x) f is a scalar-valued function and x is a vector variable
  • 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. To generate the API documentation for ForDiff using ford run the following command:

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.