bitwise-0.1.0.1: fast multi-dimensional unboxed bit packed Bool arrays

Portabilityportable
Stabilityunstable
Maintainerclaude@mathr.co.uk
Safe HaskellNone

Data.Array.BitArray

Contents

Description

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.

Synopsis

Documentation

data BitArray i Source

The type of immutable bit arrays.

IArray-like interface.

bounds :: Ix i => BitArray i -> (i, i)Source

The bounds of an array.

arraySource

Arguments

:: Ix i 
=> (i, i)

bounds

-> [(i, Bool)]

assocs

-> BitArray i 

Create an array from a list of (index, element) pairs.

listArraySource

Arguments

:: Ix i 
=> (i, i)

bounds

-> [Bool]

elems

-> BitArray i 

Create an array from a list of elements.

accumArraySource

Arguments

:: 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.

(!) :: Ix i => BitArray i -> i -> BoolSource

Bit array indexing.

indices :: Ix i => BitArray i -> [i]Source

A list of all the valid indices for this array.

elems :: Ix i => BitArray i -> [Bool]Source

A list of the elements in this array.

assocs :: Ix i => BitArray i -> [(i, Bool)]Source

A list of the (index, element) pairs in this array.

(//)Source

Arguments

:: Ix i 
=> BitArray i 
-> [(i, Bool)]

new assocs

-> BitArray i 

A new array with updated values at the supplied indices.

accumSource

Arguments

:: Ix i 
=> (Bool -> a -> Bool)

operation

-> BitArray i

source

-> [(i, a)]

assocs

-> BitArray i 

Accumulate with an operation and a list of (index, operand).

amap :: Ix i => (Bool -> Bool) -> BitArray i -> BitArray iSource

Alias for map.

ixmapSource

Arguments

:: (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.

fillSource

Arguments

:: Ix i 
=> (i, i)

bounds

-> Bool 
-> BitArray i 

A uniform array of bits.

falseSource

Arguments

:: Ix i 
=> (i, i)

bounds

-> BitArray i 

A uniform array of False.

trueSource

Arguments

:: Ix i 
=> (i, i)

bounds

-> BitArray i 

A uniform array of True.

Short-circuiting reductions.

or :: Ix i => BitArray i -> BoolSource

Short-circuit bitwise reduction: True if any bit is True.

and :: Ix i => BitArray i -> BoolSource

Short-circuit bitwise reduction: False if any bit is False.

isUniform :: Ix i => BitArray i -> Maybe BoolSource

Short-circuit bitwise reduction: Nothing if any bits differ.

Aggregate operations.

fold :: Ix i => (Bool -> Bool -> Bool) -> BitArray i -> Maybe BoolSource

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 iSource

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 iSource

Bitwise zipWith. Implementation lifts from Bool to Bits and combines large chunks at a time.

The bounds of the source arrays must be identical.

Bounds-checked indexing.

(!?) :: Ix i => BitArray i -> i -> Maybe BoolSource

Bounds checking combined with array indexing.

Unsafe.

(!!!) :: Ix i => BitArray i -> i -> BoolSource

Bit array indexing without bounds checking. Unsafe.