PrimitiveArray-0.8.0.1: Efficient multidimensional arrays

Safe HaskellNone
LanguageHaskell2010

Data.PrimitiveArray.Index.Set

Contents

Description

Set with and without interfaces. We provide instances for sets, and sets with one or two interfaces. The First and Last annotation is purely cosmetical (apart from introducing type safety).

Synopsis

newtypes, data types, classes.

newtype Boundary i t Source #

Certain sets have an interface, a particular element with special meaning. In this module, certain `meanings' are already provided. These include a First element and a Last element. We phantom-type these to reduce programming overhead.

Constructors

Boundary 

Fields

Instances

Vector Vector (Boundary i0 t0) Source # 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Boundary i0 t0) -> m (Vector (Boundary i0 t0)) #

basicUnsafeThaw :: PrimMonad m => Vector (Boundary i0 t0) -> m (Mutable Vector (PrimState m) (Boundary i0 t0)) #

basicLength :: Vector (Boundary i0 t0) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (Boundary i0 t0) -> Vector (Boundary i0 t0) #

basicUnsafeIndexM :: Monad m => Vector (Boundary i0 t0) -> Int -> m (Boundary i0 t0) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Boundary i0 t0) -> Vector (Boundary i0 t0) -> m () #

elemseq :: Vector (Boundary i0 t0) -> Boundary i0 t0 -> b -> b #

MVector MVector (Boundary i0 t0) Source # 

Methods

basicLength :: MVector s (Boundary i0 t0) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (Boundary i0 t0) -> MVector s (Boundary i0 t0) #

basicOverlaps :: MVector s (Boundary i0 t0) -> MVector s (Boundary i0 t0) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Boundary i0 t0)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> Boundary i0 t0 -> m (MVector (PrimState m) (Boundary i0 t0)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> Int -> m (Boundary i0 t0) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> Int -> Boundary i0 t0 -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> Boundary i0 t0 -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> MVector (PrimState m) (Boundary i0 t0) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> MVector (PrimState m) (Boundary i0 t0) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Boundary i0 t0) -> Int -> m (MVector (PrimState m) (Boundary i0 t0)) #

Eq (Boundary i t) Source # 

Methods

(==) :: Boundary i t -> Boundary i t -> Bool #

(/=) :: Boundary i t -> Boundary i t -> Bool #

Num (Boundary i t) Source # 

Methods

(+) :: Boundary i t -> Boundary i t -> Boundary i t #

(-) :: Boundary i t -> Boundary i t -> Boundary i t #

(*) :: Boundary i t -> Boundary i t -> Boundary i t #

negate :: Boundary i t -> Boundary i t #

abs :: Boundary i t -> Boundary i t #

signum :: Boundary i t -> Boundary i t #

fromInteger :: Integer -> Boundary i t #

Ord (Boundary i t) Source # 

Methods

compare :: Boundary i t -> Boundary i t -> Ordering #

(<) :: Boundary i t -> Boundary i t -> Bool #

(<=) :: Boundary i t -> Boundary i t -> Bool #

(>) :: Boundary i t -> Boundary i t -> Bool #

(>=) :: Boundary i t -> Boundary i t -> Bool #

max :: Boundary i t -> Boundary i t -> Boundary i t #

min :: Boundary i t -> Boundary i t -> Boundary i t #

Show (Boundary i t) Source # 

Methods

showsPrec :: Int -> Boundary i t -> ShowS #

show :: Boundary i t -> String #

showList :: [Boundary i t] -> ShowS #

Generic (Boundary i t) Source # 

Associated Types

type Rep (Boundary i t) :: * -> * #

Methods

from :: Boundary i t -> Rep (Boundary i t) x #

to :: Rep (Boundary i t) x -> Boundary i t #

Hashable (Boundary i t) Source # 

Methods

hashWithSalt :: Int -> Boundary i t -> Int #

hash :: Boundary i t -> Int #

ToJSON (Boundary i t) Source # 
FromJSON (Boundary i t) Source # 
Binary (Boundary i t) Source # 

Methods

put :: Boundary i t -> Put #

get :: Get (Boundary i t) #

putList :: [Boundary i t] -> Put #

Serialize (Boundary i t) Source # 

Methods

put :: Putter (Boundary i t) #

get :: Get (Boundary i t) #

NFData (Boundary i t) Source # 

Methods

rnf :: Boundary i t -> () #

Unbox (Boundary i0 t0) Source # 
IndexStream z => IndexStream ((:.) z (Boundary k I)) Source # 

Methods

streamUp :: Monad m => (z :. Boundary k I) -> (z :. Boundary k I) -> Stream m (z :. Boundary k I) Source #

streamDown :: Monad m => (z :. Boundary k I) -> (z :. Boundary k I) -> Stream m (z :. Boundary k I) Source #

IndexStream ((:.) Z (Boundary k I)) => IndexStream (Boundary k I) Source # 

Methods

streamUp :: Monad m => Boundary k I -> Boundary k I -> Stream m (Boundary k I) Source #

streamDown :: Monad m => Boundary k I -> Boundary k I -> Stream m (Boundary k I) Source #

Index (Boundary i t) Source # 
data MVector s (Boundary i0 t0) Source # 
data MVector s (Boundary i0 t0) = MV_Boundary (MVector s Int)
type Rep (Boundary i t) Source # 
type Rep (Boundary i t) = D1 (MetaData "Boundary" "Data.PrimitiveArray.Index.Set" "PrimitiveArray-0.8.0.1-H8L9mO6Qdgd6EjLRyswnkq" True) (C1 (MetaCons "Boundary" PrefixI True) (S1 (MetaSel (Just Symbol "getBoundary") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))
data Vector (Boundary i0 t0) Source # 

data First Source #

Declare the interface to be the start of a path.

data Last Source #

Declare the interface to be the end of a path.

data Any Source #

Declare the interface to match anything.

TODO needed? want to use later in ADPfusion

newtype BitSet t Source #

Newtype for a bitset. We'd use Words but that requires more shape instances.

TODO can we use Words now?

Constructors

BitSet 

Fields

Instances

Vector Vector (BitSet t0) Source # 
MVector MVector (BitSet t0) Source # 

Methods

basicLength :: MVector s (BitSet t0) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (BitSet t0) -> MVector s (BitSet t0) #

basicOverlaps :: MVector s (BitSet t0) -> MVector s (BitSet t0) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (BitSet t0)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> BitSet t0 -> m (MVector (PrimState m) (BitSet t0)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> Int -> m (BitSet t0) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> Int -> BitSet t0 -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> BitSet t0 -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> MVector (PrimState m) (BitSet t0) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> MVector (PrimState m) (BitSet t0) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (BitSet t0) -> Int -> m (MVector (PrimState m) (BitSet t0)) #

Eq (BitSet t) Source # 

Methods

(==) :: BitSet t -> BitSet t -> Bool #

(/=) :: BitSet t -> BitSet t -> Bool #

Num (BitSet t) Source # 

Methods

(+) :: BitSet t -> BitSet t -> BitSet t #

(-) :: BitSet t -> BitSet t -> BitSet t #

(*) :: BitSet t -> BitSet t -> BitSet t #

negate :: BitSet t -> BitSet t #

abs :: BitSet t -> BitSet t #

signum :: BitSet t -> BitSet t #

fromInteger :: Integer -> BitSet t #

Ord (BitSet t) Source # 

Methods

compare :: BitSet t -> BitSet t -> Ordering #

(<) :: BitSet t -> BitSet t -> Bool #

(<=) :: BitSet t -> BitSet t -> Bool #

(>) :: BitSet t -> BitSet t -> Bool #

(>=) :: BitSet t -> BitSet t -> Bool #

max :: BitSet t -> BitSet t -> BitSet t #

min :: BitSet t -> BitSet t -> BitSet t #

Read (BitSet t) Source # 
Show (BitSet t) Source # 

Methods

showsPrec :: Int -> BitSet t -> ShowS #

show :: BitSet t -> String #

showList :: [BitSet t] -> ShowS #

Generic (BitSet t) Source # 

Associated Types

type Rep (BitSet t) :: * -> * #

Methods

from :: BitSet t -> Rep (BitSet t) x #

to :: Rep (BitSet t) x -> BitSet t #

Arbitrary (BitSet t) Source # 

Methods

arbitrary :: Gen (BitSet t) #

shrink :: BitSet t -> [BitSet t] #

Hashable (BitSet t) Source # 

Methods

hashWithSalt :: Int -> BitSet t -> Int #

hash :: BitSet t -> Int #

ToJSON (BitSet t) Source # 
ToJSONKey (BitSet t) Source # 
FromJSON (BitSet t) Source # 
FromJSONKey (BitSet t) Source # 
Bits (BitSet t) Source # 

Methods

(.&.) :: BitSet t -> BitSet t -> BitSet t #

(.|.) :: BitSet t -> BitSet t -> BitSet t #

xor :: BitSet t -> BitSet t -> BitSet t #

complement :: BitSet t -> BitSet t #

shift :: BitSet t -> Int -> BitSet t #

rotate :: BitSet t -> Int -> BitSet t #

zeroBits :: BitSet t #

bit :: Int -> BitSet t #

setBit :: BitSet t -> Int -> BitSet t #

clearBit :: BitSet t -> Int -> BitSet t #

complementBit :: BitSet t -> Int -> BitSet t #

testBit :: BitSet t -> Int -> Bool #

bitSizeMaybe :: BitSet t -> Maybe Int #

bitSize :: BitSet t -> Int #

isSigned :: BitSet t -> Bool #

shiftL :: BitSet t -> Int -> BitSet t #

unsafeShiftL :: BitSet t -> Int -> BitSet t #

shiftR :: BitSet t -> Int -> BitSet t #

unsafeShiftR :: BitSet t -> Int -> BitSet t #

rotateL :: BitSet t -> Int -> BitSet t #

rotateR :: BitSet t -> Int -> BitSet t #

popCount :: BitSet t -> Int #

FiniteBits (BitSet t) Source # 
Binary (BitSet t) Source # 

Methods

put :: BitSet t -> Put #

get :: Get (BitSet t) #

putList :: [BitSet t] -> Put #

Ranked (BitSet t) Source # 

Methods

lsb :: BitSet t -> Int #

rank :: BitSet t -> Int #

nlz :: BitSet t -> Int #

Serialize (BitSet t) Source # 

Methods

put :: Putter (BitSet t) #

get :: Get (BitSet t) #

NFData (BitSet t) Source # 

Methods

rnf :: BitSet t -> () #

Unbox (BitSet t0) Source # 
IndexStream ((:.) Z (BitSet t)) => IndexStream (BitSet t) Source # 

Methods

streamUp :: Monad m => BitSet t -> BitSet t -> Stream m (BitSet t) Source #

streamDown :: Monad m => BitSet t -> BitSet t -> Stream m (BitSet t) Source #

Index (BitSet t) Source # 
ApplyMask (BitSet t) Source # 

Methods

applyMask :: Mask (BitSet t) -> BitSet t -> BitSet t Source #

SetPredSucc (Fixed (BitSet t)) Source # 

Methods

setSucc :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

setPred :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

SetPredSucc (BitSet t) Source # 

Methods

setSucc :: BitSet t -> BitSet t -> BitSet t -> Maybe (BitSet t) Source #

setPred :: BitSet t -> BitSet t -> BitSet t -> Maybe (BitSet t) Source #

IndexStream z => IndexStream ((:.) z (BitSet C)) Source # 

Methods

streamUp :: Monad m => (z :. BitSet C) -> (z :. BitSet C) -> Stream m (z :. BitSet C) Source #

streamDown :: Monad m => (z :. BitSet C) -> (z :. BitSet C) -> Stream m (z :. BitSet C) Source #

IndexStream z => IndexStream ((:.) z (BitSet O)) Source # 

Methods

streamUp :: Monad m => (z :. BitSet O) -> (z :. BitSet O) -> Stream m (z :. BitSet O) Source #

streamDown :: Monad m => (z :. BitSet O) -> (z :. BitSet O) -> Stream m (z :. BitSet O) Source #

IndexStream z => IndexStream ((:.) z (BitSet I)) Source # 

Methods

streamUp :: Monad m => (z :. BitSet I) -> (z :. BitSet I) -> Stream m (z :. BitSet I) Source #

streamDown :: Monad m => (z :. BitSet I) -> (z :. BitSet I) -> Stream m (z :. BitSet I) Source #

data MVector s (BitSet t0) Source # 
data MVector s (BitSet t0) = MV_BitSet (MVector s Int)
type Rep (BitSet t) Source # 
type Rep (BitSet t) = D1 (MetaData "BitSet" "Data.PrimitiveArray.Index.Set" "PrimitiveArray-0.8.0.1-H8L9mO6Qdgd6EjLRyswnkq" True) (C1 (MetaCons "BitSet" PrefixI True) (S1 (MetaSel (Just Symbol "getBitSet") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))
data Vector (BitSet t0) Source # 
type Mask (BitSet t) Source # 
type Mask (BitSet t) = BitSet t

data BS1 i t Source #

A bitset with one interface.

Constructors

BS1 !(BitSet t) !(Boundary i t) 

Instances

SetPredSucc (Fixed (BS1 i t)) Source # 

Methods

setSucc :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

setPred :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

Show (BS1 i t) Source # 

Methods

showsPrec :: Int -> BS1 i t -> ShowS #

show :: BS1 i t -> String #

showList :: [BS1 i t] -> ShowS #

Arbitrary (BS1 i t) Source # 

Methods

arbitrary :: Gen (BS1 i t) #

shrink :: BS1 i t -> [BS1 i t] #

IndexStream z => IndexStream ((:.) z (BS1 i C)) Source # 

Methods

streamUp :: Monad m => (z :. BS1 i C) -> (z :. BS1 i C) -> Stream m (z :. BS1 i C) Source #

streamDown :: Monad m => (z :. BS1 i C) -> (z :. BS1 i C) -> Stream m (z :. BS1 i C) Source #

IndexStream z => IndexStream ((:.) z (BS1 i O)) Source # 

Methods

streamUp :: Monad m => (z :. BS1 i O) -> (z :. BS1 i O) -> Stream m (z :. BS1 i O) Source #

streamDown :: Monad m => (z :. BS1 i O) -> (z :. BS1 i O) -> Stream m (z :. BS1 i O) Source #

IndexStream z => IndexStream ((:.) z (BS1 i I)) Source # 

Methods

streamUp :: Monad m => (z :. BS1 i I) -> (z :. BS1 i I) -> Stream m (z :. BS1 i I) Source #

streamDown :: Monad m => (z :. BS1 i I) -> (z :. BS1 i I) -> Stream m (z :. BS1 i I) Source #

IndexStream ((:.) Z (BS1 i t)) => IndexStream (BS1 i t) Source # 

Methods

streamUp :: Monad m => BS1 i t -> BS1 i t -> Stream m (BS1 i t) Source #

streamDown :: Monad m => BS1 i t -> BS1 i t -> Stream m (BS1 i t) Source #

Index (BS1 i t) Source #

linearIndex explicitly maps BS1 0 whatever to 0.

Methods

linearIndex :: BS1 i t -> BS1 i t -> BS1 i t -> Int Source #

smallestLinearIndex :: BS1 i t -> Int Source #

largestLinearIndex :: BS1 i t -> Int Source #

size :: BS1 i t -> BS1 i t -> Int Source #

inBounds :: BS1 i t -> BS1 i t -> BS1 i t -> Bool Source #

ApplyMask (BS1 i t) Source # 

Methods

applyMask :: Mask (BS1 i t) -> BS1 i t -> BS1 i t Source #

SetPredSucc (BS1 i t) Source # 

Methods

setSucc :: BS1 i t -> BS1 i t -> BS1 i t -> Maybe (BS1 i t) Source #

setPred :: BS1 i t -> BS1 i t -> BS1 i t -> Maybe (BS1 i t) Source #

type Mask (BS1 i t) Source # 
type Mask (BS1 i t) = BitSet t

data BS2 i j t Source #

A bitset with two interfaces.

Constructors

BS2 !(BitSet t) !(Boundary i t) !(Boundary j t) 

Instances

SetPredSucc (Fixed (BS2 i j t)) Source # 

Methods

setSucc :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

setPred :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

IndexStream z => IndexStream ((:.) z (BS2 i j C)) Source # 

Methods

streamUp :: Monad m => (z :. BS2 i j C) -> (z :. BS2 i j C) -> Stream m (z :. BS2 i j C) Source #

streamDown :: Monad m => (z :. BS2 i j C) -> (z :. BS2 i j C) -> Stream m (z :. BS2 i j C) Source #

IndexStream z => IndexStream ((:.) z (BS2 i j O)) Source # 

Methods

streamUp :: Monad m => (z :. BS2 i j O) -> (z :. BS2 i j O) -> Stream m (z :. BS2 i j O) Source #

streamDown :: Monad m => (z :. BS2 i j O) -> (z :. BS2 i j O) -> Stream m (z :. BS2 i j O) Source #

IndexStream z => IndexStream ((:.) z (BS2 i j I)) Source # 

Methods

streamUp :: Monad m => (z :. BS2 i j I) -> (z :. BS2 i j I) -> Stream m (z :. BS2 i j I) Source #

streamDown :: Monad m => (z :. BS2 i j I) -> (z :. BS2 i j I) -> Stream m (z :. BS2 i j I) Source #

Show (BS2 i j t) Source # 

Methods

showsPrec :: Int -> BS2 i j t -> ShowS #

show :: BS2 i j t -> String #

showList :: [BS2 i j t] -> ShowS #

Arbitrary (BS2 i j t) Source # 

Methods

arbitrary :: Gen (BS2 i j t) #

shrink :: BS2 i j t -> [BS2 i j t] #

IndexStream ((:.) Z (BS2 i j t)) => IndexStream (BS2 i j t) Source # 

Methods

streamUp :: Monad m => BS2 i j t -> BS2 i j t -> Stream m (BS2 i j t) Source #

streamDown :: Monad m => BS2 i j t -> BS2 i j t -> Stream m (BS2 i j t) Source #

Index (BS2 i j t) Source # 

Methods

linearIndex :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Int Source #

smallestLinearIndex :: BS2 i j t -> Int Source #

largestLinearIndex :: BS2 i j t -> Int Source #

size :: BS2 i j t -> BS2 i j t -> Int Source #

inBounds :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Bool Source #

ApplyMask (BS2 i j t) Source # 

Methods

applyMask :: Mask (BS2 i j t) -> BS2 i j t -> BS2 i j t Source #

SetPredSucc (BS2 i j t) Source # 

Methods

setSucc :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Maybe (BS2 i j t) Source #

setPred :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Maybe (BS2 i j t) Source #

type Mask (BS2 i j t) Source # 
type Mask (BS2 i j t) = BitSet t

class SetPredSucc s where Source #

Successor and Predecessor for sets. Designed as a class to accomodate sets with interfaces and without interfaces with one function.

The functions are not written recursively, as we currently only have three cases, and we do not want to "reset" while generating successors and predecessors.

Note that sets have a partial order. Within the group of element with the same popCount, we use popPermutation which has the same stepping order for both, setSucc and setPred.

Minimal complete definition

setSucc, setPred

Methods

setSucc :: s -> s -> s -> Maybe s Source #

Set successor. The first argument is the lower set limit, the second the upper set limit, the third the current set.

setPred :: s -> s -> s -> Maybe s Source #

Set predecessor. The first argument is the lower set limit, the second the upper set limit, the third the current set.

Instances

SetPredSucc (Fixed (BS2 i j t)) Source # 

Methods

setSucc :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

setPred :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

SetPredSucc (Fixed (BS1 i t)) Source # 

Methods

setSucc :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

setPred :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

SetPredSucc (Fixed (BitSet t)) Source # 

Methods

setSucc :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

setPred :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

SetPredSucc (BitSet t) Source # 

Methods

setSucc :: BitSet t -> BitSet t -> BitSet t -> Maybe (BitSet t) Source #

setPred :: BitSet t -> BitSet t -> BitSet t -> Maybe (BitSet t) Source #

SetPredSucc (BS1 i t) Source # 

Methods

setSucc :: BS1 i t -> BS1 i t -> BS1 i t -> Maybe (BS1 i t) Source #

setPred :: BS1 i t -> BS1 i t -> BS1 i t -> Maybe (BS1 i t) Source #

SetPredSucc (BS2 i j t) Source # 

Methods

setSucc :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Maybe (BS2 i j t) Source #

setPred :: BS2 i j t -> BS2 i j t -> BS2 i j t -> Maybe (BS2 i j t) Source #

type family Mask s :: * Source #

Masks are used quite often for different types of bitsets. We liberate them as a type family.

Instances

type Mask (BitSet t) Source # 
type Mask (BitSet t) = BitSet t
type Mask (BS1 i t) Source # 
type Mask (BS1 i t) = BitSet t
type Mask (BS2 i j t) Source # 
type Mask (BS2 i j t) = BitSet t

data Fixed t Source #

Fixed allows us to fix some or all bits of a bitset, thereby providing succ/pred operations which are only partially free.

The mask is lazy, this allows us to have undefined for l and h.

f = getFixedMask .&. getFixed are the fixed bits. n = getFixed .&. complement getFixedMask are the free bits. to = complement getFixed is the to move mask n' = popShiftR to n yields the population after the move p = popPermutation undefined n' yields the new population permutation p' = popShiftL to p yields the population moved back final = p' .|. f

Constructors

Fixed 

Fields

Instances

(Unbox t0, Unbox (Mask t0)) => Vector Vector (Fixed t0) Source # 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Fixed t0) -> m (Vector (Fixed t0)) #

basicUnsafeThaw :: PrimMonad m => Vector (Fixed t0) -> m (Mutable Vector (PrimState m) (Fixed t0)) #

basicLength :: Vector (Fixed t0) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (Fixed t0) -> Vector (Fixed t0) #

basicUnsafeIndexM :: Monad m => Vector (Fixed t0) -> Int -> m (Fixed t0) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Fixed t0) -> Vector (Fixed t0) -> m () #

elemseq :: Vector (Fixed t0) -> Fixed t0 -> b -> b #

(Unbox t0, Unbox (Mask t0)) => MVector MVector (Fixed t0) Source # 

Methods

basicLength :: MVector s (Fixed t0) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (Fixed t0) -> MVector s (Fixed t0) #

basicOverlaps :: MVector s (Fixed t0) -> MVector s (Fixed t0) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Fixed t0)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> Fixed t0 -> m (MVector (PrimState m) (Fixed t0)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> Int -> m (Fixed t0) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> Int -> Fixed t0 -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> Fixed t0 -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> MVector (PrimState m) (Fixed t0) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> MVector (PrimState m) (Fixed t0) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Fixed t0) -> Int -> m (MVector (PrimState m) (Fixed t0)) #

(Eq t, Eq (Mask t)) => Eq (Fixed t) Source # 

Methods

(==) :: Fixed t -> Fixed t -> Bool #

(/=) :: Fixed t -> Fixed t -> Bool #

(Ord t, Ord (Mask t)) => Ord (Fixed t) Source # 

Methods

compare :: Fixed t -> Fixed t -> Ordering #

(<) :: Fixed t -> Fixed t -> Bool #

(<=) :: Fixed t -> Fixed t -> Bool #

(>) :: Fixed t -> Fixed t -> Bool #

(>=) :: Fixed t -> Fixed t -> Bool #

max :: Fixed t -> Fixed t -> Fixed t #

min :: Fixed t -> Fixed t -> Fixed t #

(Read t, Read (Mask t)) => Read (Fixed t) Source # 
(Show t, Show (Mask t)) => Show (Fixed t) Source # 

Methods

showsPrec :: Int -> Fixed t -> ShowS #

show :: Fixed t -> String #

showList :: [Fixed t] -> ShowS #

(Generic t, Generic (Mask t)) => Generic (Fixed t) Source # 

Associated Types

type Rep (Fixed t) :: * -> * #

Methods

from :: Fixed t -> Rep (Fixed t) x #

to :: Rep (Fixed t) x -> Fixed t #

(Arbitrary t, Arbitrary (Mask t)) => Arbitrary (Fixed t) Source # 

Methods

arbitrary :: Gen (Fixed t) #

shrink :: Fixed t -> [Fixed t] #

(Generic t, Generic (Mask t), Hashable t, Hashable (Mask t)) => Hashable (Fixed t) Source # 

Methods

hashWithSalt :: Int -> Fixed t -> Int #

hash :: Fixed t -> Int #

(Generic t, Generic (Mask t), Binary t, Binary (Mask t)) => Binary (Fixed t) Source # 

Methods

put :: Fixed t -> Put #

get :: Get (Fixed t) #

putList :: [Fixed t] -> Put #

(Generic t, Generic (Mask t), Serialize t, Serialize (Mask t)) => Serialize (Fixed t) Source # 

Methods

put :: Putter (Fixed t) #

get :: Get (Fixed t) #

NFData (Fixed t) Source # 

Methods

rnf :: Fixed t -> () #

(Unbox t0, Unbox (Mask t0)) => Unbox (Fixed t0) Source # 
SetPredSucc (Fixed (BS2 i j t)) Source # 

Methods

setSucc :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

setPred :: Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Fixed (BS2 i j t) -> Maybe (Fixed (BS2 i j t)) Source #

SetPredSucc (Fixed (BS1 i t)) Source # 

Methods

setSucc :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

setPred :: Fixed (BS1 i t) -> Fixed (BS1 i t) -> Fixed (BS1 i t) -> Maybe (Fixed (BS1 i t)) Source #

SetPredSucc (Fixed (BitSet t)) Source # 

Methods

setSucc :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

setPred :: Fixed (BitSet t) -> Fixed (BitSet t) -> Fixed (BitSet t) -> Maybe (Fixed (BitSet t)) Source #

data MVector s (Fixed t0) Source # 
data MVector s (Fixed t0) = MV_Fixed (MVector s (Mask t, t))
type Rep (Fixed t) Source # 
type Rep (Fixed t) = D1 (MetaData "Fixed" "Data.PrimitiveArray.Index.Set" "PrimitiveArray-0.8.0.1-H8L9mO6Qdgd6EjLRyswnkq" False) (C1 (MetaCons "Fixed" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "getFixedMask") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Mask t))) (S1 (MetaSel (Just Symbol "getFixed") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 t))))
data Vector (Fixed t0) Source # 
data Vector (Fixed t0) = V_Fixed (Vector (Mask t, t))

class ApplyMask s where Source #

Assuming a bitset on bits [0 .. highbit], we can apply a mask that stretches out those bits over [0 .. higherBit] with highbit <= higherBit. Any active interfaces are correctly set as well.

Minimal complete definition

applyMask

Methods

applyMask :: Mask s -> s -> s Source #

Instances

ApplyMask (BitSet t) Source # 

Methods

applyMask :: Mask (BitSet t) -> BitSet t -> BitSet t Source #

ApplyMask (BS1 i t) Source # 

Methods

applyMask :: Mask (BS1 i t) -> BS1 i t -> BS1 i t Source #

ApplyMask (BS2 i j t) Source # 

Methods

applyMask :: Mask (BS2 i j t) -> BS2 i j t -> BS2 i j t Source #

Instances

streamUpBndMk :: Monad m => Boundary k i -> Boundary k i -> t -> m (t, Boundary k i) Source #

streamUpBndStep :: Monad m => Boundary k i -> Boundary k i -> (t, Boundary k i) -> m (Step (t, Boundary k i) (t :. Boundary k i)) Source #

streamDownBndMk :: Monad m => Boundary k i -> Boundary k i -> t -> m (t, Boundary k i) Source #

streamDownBndStep :: Monad m => Boundary k i -> Boundary k i -> (t, Boundary k i) -> m (Step (t, Boundary k i) (t :. Boundary k i)) Source #

streamUpBsMk :: (Monad m, Ord a) => a -> a -> t -> m (t, Maybe a) Source #

streamUpBsStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

streamDownBsMk :: (Monad m, Ord a) => a -> a -> t -> m (t, Maybe a) Source #

streamDownBsStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

BS1

streamUpBsIMk :: Monad m => BS1 a i -> BS1 b i -> z -> m (z, Maybe (BS1 c i)) Source #

streamUpBsIStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

streamDownBsIMk :: Monad m => BS1 a i -> BS1 b i -> z -> m (z, Maybe (BS1 c i)) Source #

streamDownBsIStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

BS2

streamUpBsIiMk :: Monad m => BS2 a b i -> BS2 c d i -> z -> m (z, Maybe (BS2 e f i)) Source #

streamUpBsIiStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

streamDownBsIiMk :: Monad m => BS2 a b i -> BS2 c d i -> z -> m (z, Maybe (BS2 e f i)) Source #

streamDownBsIiStep :: (Monad m, SetPredSucc s) => s -> s -> (t, Maybe s) -> m (Step (t, Maybe s) (t :. s)) Source #

Set predecessor and successor