Linear range-min algorithms.

Latest on Hackage:2.2.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Louis Wasserman

Rapidly (in linear time) preprocesses a vector so that the minimum element of any given subrange can be looked up in constant time.

This implementation is based on an algorithm of Fischer and Heun, which can be found at http://dx.doi.org/10.1007/11780441_5. Despite being written entirely in Haskell (and maintaining referential transparency internally), it is competitive against the C++ implementation written by Fischer and Heun themselves (included in the tarball), especially when compiled with LLVM.

Depending on the target system, this library compiled with -fasm approximately ties with the original authors' C++ implementation compiled with -O3 -funroll-loops. With -fllvm -optlc-O3, this library has been observed to beat the same C++ implementation by 20-30%.

Internally, this library rolls its own stream fusion system, avoiding the vector package's issues with duplicated index variables and providing a few other special features. This package's API does, however, fuse (to the extent possible) with input vectors using the vector package fusion system. In particular, it automagically recognizes input vectors whose element types have a natural order-preserving injection into Int, converts them, and uses the specialized range-min implementation for Int vectors. See Data.RangeMin for more details.

Depends on 4 packages:
Used by 1 package:
comments powered byDisqus