Skip to content

Commit

Permalink
Merge pull request #8 from jacobwilliams/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jacobwilliams authored Mar 20, 2022
2 parents 443fe83 + d0703c3 commit ff66550
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 256 deletions.
39 changes: 26 additions & 13 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
gcc_v: [9] # Version of GFortran we want to use.
python-version: [3.7]
gcc_v: [10] # Version of GFortran we want to use.
python-version: [3.9]
env:
FC: gfortran-${{ matrix.gcc_v }}
GCC_V: ${{ matrix.gcc_v }}
Expand All @@ -29,32 +29,45 @@ jobs:
uses: ts-graphviz/setup-graphviz@v1

- name: Setup Fortran Package Manager
uses: fortran-lang/setup-fpm@v3
uses: fortran-lang/setup-fpm@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Python dependencies
if: contains( matrix.os, 'ubuntu')
run: |
python -m pip install --upgrade pip
pip install ford
pip install matplotlib ford
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install GFortran Linux
if: contains( matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
sudo apt-get install lcov
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }}
- name: Compile
run: fpm build --profile release
# - name: Compile
# run: fpm build --profile release

- name: Run tests
run: fpm test
run: fpm test --profile debug --flag -coverage

- name: Create coverage report
run: |
mkdir -p ${{ env.COV_DIR }}
lcov --capture --initial --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.base
lcov --capture --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.capture
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
env:
COV_DIR: build/coverage

- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
files: build/coverage/coverage.info

- name: Build documentation
run: ford ./numdiff.md
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NumDiff -- Numerical Differentiation Library
https://github.com/jacobwilliams/NumDiff

Copyright (c) 2016-2021, Jacob Williams
Copyright (c) 2016-2022, Jacob Williams
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

## Status

[![GitHub release](https://img.shields.io/github/release/jacobwilliams/NumDiff.svg?style=plastic)](https://github.com/jacobwilliams/NumDiff/releases/latest)
![CI Status](https://github.com/jacobwilliams/NumDiff/actions/workflows/CI.yml/badge.svg)
[![codecov](https://codecov.io/gh/jacobwilliams/NumDiff/branch/master/graph/badge.svg?token=43HK33CSMY)](https://codecov.io/gh/jacobwilliams/NumDiff)

This is currently a work in progress. The goal is a comprehensive library that contains a full suite of computationally efficient implementations of algorithms for sparsity determination and numerical differentiation. This code is hosted on GitHub at: https://github.com/jacobwilliams/NumDiff

Expand Down Expand Up @@ -46,42 +48,48 @@ This is currently a work in progress. The goal is a comprehensive library that c

### FPM

A `fmp.toml` file is provided for compiling roots-fortran with the [Fortran Package Manager](https://github.com/fortran-lang/fpm). For example, to build:
A [Fortran Package Manager](https://github.com/fortran-lang/fpm) manifest file is included, so that the library and tests cases can be compiled with FPM. For example:

```
fpm build --profile release
fpm build --profile release
fpm test --profile release
```

And to run the unit tests:

```
fpm test
To use `NumDiff` within your FPM project, add the following to your `fpm.toml` file:
```toml
[dependencies]
NumDiff = { git="https://github.com/jacobwilliams/NumDiff.git" }
```

### FoBiS
To generate the documentation using [FORD](https://github.com/Fortran-FOSS-Programmers/ford), run:

A [FoBiS](https://github.com/szaghi/FoBiS) configuration file (`numdiff.fobis`) is also provided that can also build the library and examples. Use the `mode` flag to indicate what to build. For example:
```
ford numdiff.md
```

* To build all the examples using gfortran: `FoBiS.py build -f numdiff.fobis -mode tests-gnu`
* To build all the examples using ifort: `FoBiS.py build -f numdiff.fobis -mode tests-intel`
* To build a static library using gfortran: `FoBiS.py build -f numdiff.fobis -mode static-gnu`
* To build a static library using ifort: `FoBiS.py build -f numdiff.fobis -mode static-intel`
By default, the library is built with double precision (`real64`) real values. Explicitly specifying the real kind can be done using the following processor flags:

The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`
Preprocessor flag | Kind | Number of bytes
----------------- | ----- | ---------------
`REAL32` | `real(kind=real32)` | 4
`REAL64` | `real(kind=real64)` | 8
`REAL128` | `real(kind=real128)` | 16

To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBis.py rule --execute makedoc -f numdiff.fobis```
For example, to build a single precision version of the library, use:

To run the test programs, run: ```FoBis.py rule --execute tests -f numdiff.fobis```
```
fpm build --profile release --flag "-DREAL32"
```

## Documentation

The latest API documentation can be found [here](http://jacobwilliams.github.io/NumDiff/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (note that the included `build.sh` script will also generate these files).
The latest API documentation can be found [here](https://jacobwilliams.github.io/NumDiff/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (note that the included `build.sh` script will also generate these files).

## License

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

## References

* J. Oliver, "An algorithm for numerical differentiation of a function of one real variable", Journal of Computational and Applied Mathematics 6 (2) (1980) 145160. Fortran 77 code from [NIST](ftp://math.nist.gov/pub/repository/diff/src/DIFF)
* J. Oliver, "An algorithm for numerical differentiation of a function of one real variable", Journal of Computational and Applied Mathematics 6 (2) (1980) 145-160. Fortran 77 code from [NIST](ftp://math.nist.gov/pub/repository/diff/src/DIFF)
* Thomas F. Coleman, Burton S. Garbow, Jorge J. More, "Algorithm 618: FORTRAN subroutines for estimating sparse Jacobian Matrices", ACM Transactions on Mathematical Software (TOMS), Volume 10 Issue 3, Sept. 1984, Pages 346-347
52 changes: 0 additions & 52 deletions build.sh

This file was deleted.

13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
comment:
layout: header, changes, diff, sunburst
coverage:
ignore:
- test
- doc
status:
patch:
default:
target: 20%
project:
default:
target: 60%
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "NumDiff"
version = "1.5.1"
author = "Jacob Williams"
maintainer = "Jacob Williams"
copyright = "Copyright (c) 2016-2021, Jacob Williams"
copyright = "Copyright (c) 2016-2022, Jacob Williams"
license = "BSD-3"
description = "Modern Fortran Numerical Differentiation Library"
homepage = "https://github.com/jacobwilliams/NumDiff"
Expand Down
156 changes: 0 additions & 156 deletions numdiff.fobis

This file was deleted.

Loading

0 comments on commit ff66550

Please sign in to comment.