-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MacOS CI - Not working yet but merging :/ (#170)
* Updated CI * Fix? * Fix hehe * FIx? * Fix * Fix * Fix * Fix * Fix? * Fix? * Fix? * Fix? * Run * Fix? * Fix? * Fix :c * Fix? * Fix * Fix? * ? * Fix? * Updated code
- Loading branch information
1 parent
a3930df
commit ee4d964
Showing
11 changed files
with
143 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
name: Shellcheck | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
shellcheck: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
name: Todo Checker | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
todo: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,6 @@ on: | |
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
schedule: | ||
- cron: "31 1,12 * * *" | ||
|
||
push: | ||
branches: | ||
- main | ||
|
@@ -20,24 +17,11 @@ on: | |
- main | ||
|
||
jobs: | ||
shellcheck: | ||
name: Shellcheck | ||
uses: ./.github/workflows/shellcheck.yml | ||
|
||
markdownlint: | ||
name: Markdown Lint | ||
uses: ./.github/workflows/markdownlint.yml | ||
|
||
todo: | ||
if: github.event_name == 'push' | ||
name: TODO | ||
uses: ./.github/workflows/todo.yml | ||
|
||
validate-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout VSL | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
path: vsl | ||
|
||
|
@@ -79,7 +63,7 @@ jobs: | |
|
||
steps: | ||
- name: Checkout VSL | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
path: vsl | ||
|
||
|
@@ -133,7 +117,7 @@ jobs: | |
|
||
steps: | ||
- name: Checkout VSL | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
path: vsl | ||
|
||
|
@@ -178,3 +162,59 @@ jobs: | |
- name: Execute Tests using Pure V Backend with Pure C Blas and Garbage Collection enabled | ||
run: ~/.vmodules/vsl/bin/test ${{ matrix.flags }} --use-cblas --use-gc boehm | ||
if: ${{ matrix.os != 'ubuntu-18.04' }} | ||
|
||
run-tests-on-macos: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- macos-latest | ||
flags: | ||
- "" | ||
- "--prod" | ||
|
||
steps: | ||
- name: Checkout VSL | ||
uses: actions/checkout@v3 | ||
with: | ||
path: vsl | ||
|
||
- name: Setup V | ||
uses: vlang/[email protected] | ||
with: | ||
check-latest: true | ||
|
||
- name: V doctor | ||
run: v doctor | ||
|
||
- name: Install dependencies | ||
run: | | ||
brew install coreutils | ||
brew install gcc | ||
brew install libomp | ||
brew install hdf5 | ||
brew install open-mpi | ||
brew install openblas | ||
brew install lapack | ||
- name: Move VSL source code to V Modules | ||
run: mv ./vsl ~/.vmodules | ||
|
||
- name: Execute Tests using Pure V Backend | ||
# TODO: Remove continue-on-error when CI is fixed for macOS | ||
continue-on-error: true | ||
run: ~/.vmodules/vsl/bin/test | ||
|
||
- name: Execute Tests using Pure V Backend with Pure C Blas | ||
continue-on-error: true | ||
run: ~/.vmodules/vsl/bin/test --use-cblas | ||
|
||
- name: Execute Tests using Pure V Backend and Garbage Collection enabled | ||
continue-on-error: true | ||
run: ~/.vmodules/vsl/bin/test --use-gc boehm | ||
|
||
- name: Execute Tests using Pure V Backend with Pure C Blas and Garbage Collection enabled | ||
continue-on-error: true | ||
run: ~/.vmodules/vsl/bin/test --use-cblas --use-gc boehm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
# Numerical Differentiation | ||
# 🚀 Numerical Differentiation | ||
|
||
This module provides functions for computing numerical derivatives of | ||
functions. | ||
This module provides functions for computing numerical derivatives of functions. 🧮 | ||
|
||
An adaptive algorithm is used to find the best | ||
choice of finite difference and to estimate the error in the derivative. | ||
An adaptive algorithm is used to find the best choice of finite difference and to | ||
estimate the error in the derivative. 🎯 | ||
|
||
The development of this module is inspired by the same present in [GSL](https://github.com/ampl/gsl) | ||
looking to adapt it completely to the practices and tools present in VSL. | ||
The development of this module is inspired by the same present in | ||
[GSL](https://github.com/ampl/gsl) 📚, looking to adapt it completely | ||
to the practices and tools present in VSL. 🛠️ | ||
|
||
## Functions | ||
|
||
### `central` | ||
|
||
```v ignore | ||
fn central (f func.Fn, x, h f64) (f64, f64) | ||
``` | ||
|
||
This function computes the numerical derivative of the function `f` | ||
at the point `x` using an adaptive central difference algorithm with | ||
a step-size of `h`. The derivative is returned in `result` and an | ||
estimate of its absolute error is returned in `abserr`. | ||
|
||
The initial value of `h` is used to estimate an optimal step-size, | ||
based on the scaling of the truncation error and round-off error in the | ||
derivative calculation. The derivative is computed using a 5-point rule | ||
for equally spaced abscissae at `x - h`, `x - h/2`, `x`, | ||
`x + h/2`, `x+h`, with an error estimate taken from the difference | ||
between the 5-point rule and the corresponding 3-point rule `x-h`, | ||
`x`, `x+h`. Note that the value of the function at `x` | ||
does not contribute to the derivative calculation, so only 4-points are | ||
actually used. | ||
This function computes the numerical derivative of the function `f` at the point `x` | ||
using an adaptive central difference algorithm with a step-size of `h`. The derivative | ||
is returned in `result` and an estimate of its absolute error is returned in `abserr`. | ||
|
||
The initial value of `h` is used to estimate an optimal step-size, based on the scaling | ||
of the truncation error and round-off error in the derivative calculation. | ||
The derivative is computed using a 5-point rule for equally spaced abscissae | ||
at `x - h`, `x - h/2`, `x`, `x + h/2`, `x+h`, with an error estimate taken | ||
from the difference between the 5-point rule and the corresponding 3-point | ||
rule `x-h`, `x`, `x+h`. Note that the value of the function at `x` does not | ||
contribute to the derivative calculation, so only 4-points are actually used. 🧐 | ||
|
||
### `forward` | ||
|
||
```v ignore | ||
fn forward (f func.Fn, x, h f64) (f64, f64) | ||
``` | ||
|
||
This function computes the numerical derivative of the function `f` | ||
at the point `x` using an adaptive forward difference algorithm with | ||
a step-size of `h`. The function is evaluated only at points greater | ||
than `x`, and never at `x` itself. The derivative is returned in | ||
`result` and an estimate of its absolute error is returned in | ||
`abserr`. This function should be used if `f(x)` has a | ||
discontinuity at `x`, or is undefined for values less than `x`. | ||
|
||
The initial value of `h` is used to estimate an optimal step-size, | ||
based on the scaling of the truncation error and round-off error in the | ||
derivative calculation. The derivative at `x` is computed using an | ||
"open" 4-point rule for equally spaced abscissae at `x+h/4`, | ||
`x + h/2`, `x + 3h/4`, `x+h`, with an error estimate taken | ||
from the difference between the 4-point rule and the corresponding | ||
2-point rule `x+h/2`, `x+h`. | ||
This function computes the numerical derivative of the function `f` at the point `x` | ||
using an adaptive forward difference algorithm with a step-size of `h`. The function | ||
is evaluated only at points greater than `x`, and never at `x` itself. The derivative | ||
is returned in `result` and an estimate of its absolute error is returned in `abserr`. | ||
This function should be used if `f(x)` has a discontinuity at `x`, or | ||
is undefined for values less than `x`. 📈 | ||
|
||
The initial value of `h` is used to estimate an optimal step-size, based on the scaling | ||
of the truncation error and round-off error in the derivative calculation. The derivative | ||
at `x` is computed using an "open" 4-point rule for equally spaced abscissae at `x+h/4`, | ||
`x + h/2`, `x + 3h/4`, `x+h`, with an error estimate taken from the difference between | ||
the 4-point rule and the corresponding 2-point rule `x+h/2`, `x+h`. 🚀 | ||
|
||
### `backward` | ||
|
||
```v ignore | ||
fn backward (f func.Fn, x, h f64) (f64, f64) | ||
``` | ||
|
||
This function computes the numerical derivative of the function `f` | ||
at the point `x` using an adaptive backward difference algorithm | ||
with a step-size of `h`. The function is evaluated only at points | ||
less than `x`, and never at `x` itself. The derivative is | ||
returned in `result` and an estimate of its absolute error is | ||
returned in `abserr`. This function should be used if `f(x)` | ||
has a discontinuity at `x`, or is undefined for values greater than | ||
`x`. | ||
This function computes the numerical derivative of the function `f` at the point `x` | ||
using an adaptive backward difference algorithm with a step-size of `h`. The function | ||
is evaluated only at points less than `x`, and never at `x` itself. The derivative is | ||
returned in `result` and an estimate of its absolute error is returned in `abserr`. | ||
This function should be used if `f(x)` has a discontinuity at `x`, or is undefined | ||
for values greater than `x`. 📉 | ||
|
||
This function is equivalent to calling `deriv.forward` with a | ||
negative step-size. | ||
This function is equivalent to calling `deriv.forward` with a negative step-size. | ||
|
||
## References and Further Reading | ||
|
||
This work is a spiritual descendent of the Differentiation module in [GSL](https://github.com/ampl/gsl). | ||
This work is a spiritual descendent of the Differentiation module in [GSL](https://github.com/ampl/gsl). 📖 | ||
|
||
Feel free to explore and utilize these numerical differentiation functions in | ||
your projects! 🤖📊🔬 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# Numerical Differentiation | ||
# 🧮 Numerical Differentiation | ||
|
||
This module provides functions for computing numerical derivatives of | ||
functions. | ||
This module equips you with powerful functions for calculating numerical | ||
derivatives of functions. Dive into the world of numerical differentiation with ease! 🚀 | ||
|
||
An adaptive algorithm is used to find the best | ||
choice of finite difference and to estimate the error in the derivative. | ||
Utilizing an adaptive algorithm, we help you determine the optimal finite difference and | ||
provide error estimates for your derivatives. Say goodbye to guesswork! 📊💡 | ||
|
||
Explore the possibilities and make your mathematical computations smoother with | ||
Numerical Differentiation. 🌟 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters