fast-combinatorics: Fast combinatorics.

[ bsd3, library, numerics ] [ Propose Tags ]

Fast combinatorics code with a high level of safety guaranteed by writing it in ATS.


[Skip to Readme]
Versions [RSS] [faq] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.0.9
Dependencies base (>=4.7 && <5), composition-prelude (>=0.1.1.4) [details]
License BSD-3-Clause
Copyright Copyright: (c) 2017 Vanessa McHale
Author Vanessa McHale
Maintainer vamchale@gmail.com
Category Numerics
Home page https://github.com//fast-combinatorics#readme
Source repo head: git clone https://github.com//fast-combinatorics
Uploaded by vmchale at 2017-12-31T07:25:28Z
Distributions NixOS:0.1.0.9
Downloads 4744 total (9 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-12-31 [all 1 reports]

Modules

[Index]

Manual Flags

NameDescriptionDefault
development

Enable `-Werror`

Disabled
Automatic Flags
NameDescriptionDefault

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for fast-combinatorics-0.1.0.6

[back to package description]

fast-combinatorics

Build Status

This is a library for fast combinatorics using ATS. As such, make sure a C compiler is installed. It may not work on windows, so if you run into bugs building this please open an issue.

Currently it is a work-in-progress, being somewhat constrained by the fact that I have yet to figure out how to share arbitrary-precision types between ATS and Haskell.

Benchmarks

Computation Version (ATS/Haskell) Time
12! ATS 9.301 ns
12! Haskell 27.84 ns
13 `choose` 4 ATS 12.28 ns
13 `choose` 4 Haskell 28.38 ns
isPrime 2017 ATS 118.9 ns
isPrime 2017 Haskell 497.3 ns
3 ^ 7 ATS 9.050 ns
3 ^ 7 Haskell 37.02 ns

Building

The Haskell library comes with the C bundled, however you may wish to build from source if you are hacking on the library. To that end, you can install stack, patscc, and pats-filter and build with

 $ ./shake.hs

You will also likely want to install GHC as well as cabal.

Documentation

Using the ATS library

One of the nice things about a Haskell wrapper is that some of Haskell's tooling/libraries may be used. You may want to try the REPL:

 $ cabal new-repl

Using the Haskell library

You may wish to read the ATS source code for an indication of what sorts of things ATS allows us to prove things about our programs, particularly proofs of termination.

There are also a few caveats: note that all results and arguments must be of the Int type. This unfortunate constraint will hopefully be fixed in the future, but right now it limits the usefulness of the library.