https://github.com/soupstraw/hafar
Affine arithmetic library for Haskell
https://github.com/soupstraw/hafar
affine-arithmetic haskell interval-arithmetic numerical-methods
Last synced: over 1 year ago
JSON representation
Affine arithmetic library for Haskell
- Host: GitHub
- URL: https://github.com/soupstraw/hafar
- Owner: Soupstraw
- License: bsd-3-clause
- Created: 2019-10-16T11:19:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-14T12:37:30.000Z (about 6 years ago)
- Last Synced: 2023-09-20T09:13:57.255Z (almost 3 years ago)
- Topics: affine-arithmetic, haskell, interval-arithmetic, numerical-methods
- Language: Haskell
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# Hafar
Hafar is an implementation of affine arithmetic in haskell.
## Building
To build the library, simply run
```
# stack build
```
or if using cabal
```
# cabal install --only-dependencies
# cabal build
```
## Example
All operations with affine forms must be done inside the AFM monad.
```
import Numeric.Interval hiding (interval)
x1 = do
a <- newFromInterval $ 4...6
b <- newFromInterval $ 4...6
return . interval $ a - b
evalAFM x1 -- evaluates to approximately -2 ... 2
x2 = do
a <- newFromInterval $ 4...6
return . interval $ a - a
evalAFM x2 -- evaluates to approximately 0 ... 0
```