hafar: Affine arithmetic library for Haskell

[ bsd3, library, numeric ] [ Propose Tags ]

Hafar is an affine arithmetic library for Haskell. It is an efficient way to work with ranges of values or imprecise values.


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.1.0
Change log ChangeLog.md
Dependencies base (==4.12.*), intervals (==0.8.*), mtl (==2.2.*) [details]
License BSD-3-Clause
Copyright 2019 Joosep Jääger
Author Joosep Jääger
Maintainer Joosep Jääger
Category Numeric
Home page https://github.com/Soupstraw/hafar#readme
Bug tracker https://github.com/Soupstraw/hafar/issues
Source repo head: git clone https://github.com/Soupstraw/hafar
Uploaded by j_jaager at 2020-04-14T12:45:35Z
Distributions NixOS:0.1.1.0
Downloads 327 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-04-14 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hafar-0.1.1.0

[back to package description]

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