Copyright | (c) Claude Heiland-Allen 2012 |
---|---|
License | BSD3 |
Maintainer | claude@mathr.co.uk |
Stability | unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Immutable unboxed packed bit arrays using bitwise operations to manipulate large chunks at a time much more quickly than individually unpacking and repacking bits would allow.
- data BitArray i
- bounds :: Ix i => BitArray i -> (i, i)
- array :: Ix i => (i, i) -> [(i, Bool)] -> BitArray i
- listArray :: Ix i => (i, i) -> [Bool] -> BitArray i
- accumArray :: Ix i => (Bool -> a -> Bool) -> Bool -> (i, i) -> [(i, a)] -> BitArray i
- (!) :: Ix i => BitArray i -> i -> Bool
- indices :: Ix i => BitArray i -> [i]
- elems :: Ix i => BitArray i -> [Bool]
- assocs :: Ix i => BitArray i -> [(i, Bool)]
- (//) :: Ix i => BitArray i -> [(i, Bool)] -> BitArray i
- accum :: Ix i => (Bool -> a -> Bool) -> BitArray i -> [(i, a)] -> BitArray i
- amap :: Ix i => (Bool -> Bool) -> BitArray i -> BitArray i
- ixmap :: (Ix i, Ix j) => (i, i) -> (i -> j) -> BitArray j -> BitArray i
- fill :: Ix i => (i, i) -> Bool -> BitArray i
- false :: Ix i => (i, i) -> BitArray i
- true :: Ix i => (i, i) -> BitArray i
- or :: Ix i => BitArray i -> Bool
- and :: Ix i => BitArray i -> Bool
- isUniform :: Ix i => BitArray i -> Maybe Bool
- fold :: Ix i => (Bool -> Bool -> Bool) -> BitArray i -> Maybe Bool
- map :: Ix i => (Bool -> Bool) -> BitArray i -> BitArray i
- zipWith :: Ix i => (Bool -> Bool -> Bool) -> BitArray i -> BitArray i -> BitArray i
- (!?) :: Ix i => BitArray i -> i -> Maybe Bool
- (!!!) :: Ix i => BitArray i -> i -> Bool
Documentation
IArray-like interface.
Create an array from a list of (index, element) pairs.
Create an array from a list of elements.
:: Ix i | |
=> (Bool -> a -> Bool) | operation |
-> Bool | default |
-> (i, i) | bounds |
-> [(i, a)] | assocs |
-> BitArray i |
Create an array by accumulating a list of (index, operand) pairs from a default seed with an operation.
assocs :: Ix i => BitArray i -> [(i, Bool)] Source
A list of the (index, element) pairs in this array.
A new array with updated values at the supplied indices.
Accumulate with an operation and a list of (index, operand).
:: (Ix i, Ix j) | |
=> (i, i) | new bounds |
-> (i -> j) | index transformation |
-> BitArray j | source array |
-> BitArray i |
Create a new array by mapping indices into a source array..
Constant arrays.
Short-circuiting reductions.
isUniform :: Ix i => BitArray i -> Maybe Bool Source
Short-circuit bitwise reduction: Nothing if any bits differ.
Aggregate operations.
fold :: Ix i => (Bool -> Bool -> Bool) -> BitArray i -> Maybe Bool Source
Bitwise reduction with an associative commutative boolean operator.
Implementation lifts from Bool
to Bits
and folds large chunks
at a time. Each bit is used as a source exactly once.
map :: Ix i => (Bool -> Bool) -> BitArray i -> BitArray i Source
Bitwise map. Implementation lifts from Bool
to Bits
and maps
large chunks at a time.
zipWith :: Ix i => (Bool -> Bool -> Bool) -> BitArray i -> BitArray i -> BitArray i Source
Bitwise zipWith. Implementation lifts from Bool
to Bits
and
combines large chunks at a time.
The bounds of the source arrays must be identical.