mios-1.5.4: A Minisat-based CDCL SAT solver in Haskell

Safe HaskellTrustworthy
LanguageHaskell2010

SAT.Mios.Vec

Contents

Description

(This is a part of MIOS.) Abstraction Layer for Mutable Vectors

Synopsis

Vector class and type

class VecFamily v a | v -> a where Source #

The interface on vectors.

Minimal complete definition

getNth, setNth

Methods

getNth :: v -> Int -> IO a Source #

returns the n-th value.

setNth :: v -> Int -> a -> IO () Source #

sets the n-th value.

reset :: v -> IO () Source #

erases all elements in it.

swapBetween :: v -> Int -> Int -> IO () Source #

returns the n-th value (index starts from zero in any case). | swaps two elements.

modifyNth :: v -> (a -> a) -> Int -> IO () Source #

calls the update function.

newVec :: Int -> a -> IO v Source #

returns a new vector.

setAll :: v -> a -> IO () Source #

sets all elements.

growBy :: v -> Int -> IO v Source #

extends the size of stack by n; note: values in new elements aren't initialized maybe.

asList :: v -> IO [a] Source #

converts to a list.

Instances

VecFamily ClauseVector Clause Source #

ClauseVector is a vector of Clause.

VecFamily Clause Lit Source #

Clause is a VecFamily of Lit.

Methods

getNth :: Clause -> Int -> IO Lit Source #

setNth :: Clause -> Int -> Lit -> IO () Source #

reset :: Clause -> IO () Source #

swapBetween :: Clause -> Int -> Int -> IO () Source #

modifyNth :: Clause -> (Lit -> Lit) -> Int -> IO () Source #

newVec :: Int -> Lit -> IO Clause Source #

setAll :: Clause -> Lit -> IO () Source #

growBy :: Clause -> Int -> IO Clause Source #

asList :: Clause -> IO [Lit] Source #

VecFamily WatcherList Clause Source #

WatcherList is an Lit-indexed collection of Clause.

VecFamily ClauseExtManager Clause Source #

ClauseExtManager is a collection of Clause

VecFamily (Vec [Int]) Int Source # 

Methods

getNth :: Vec [Int] -> Int -> IO Int Source #

setNth :: Vec [Int] -> Int -> Int -> IO () Source #

reset :: Vec [Int] -> IO () Source #

swapBetween :: Vec [Int] -> Int -> Int -> IO () Source #

modifyNth :: Vec [Int] -> (Int -> Int) -> Int -> IO () Source #

newVec :: Int -> Int -> IO (Vec [Int]) Source #

setAll :: Vec [Int] -> Int -> IO () Source #

growBy :: Vec [Int] -> Int -> IO (Vec [Int]) Source #

asList :: Vec [Int] -> IO [Int] Source #

data family Vec a Source #

Another abstraction layer on Vector which reserves zero element for internal use. Note: If you want to use the 0-th element, use UVector Int.

Instances

VecFamily (Vec [Int]) Int Source # 

Methods

getNth :: Vec [Int] -> Int -> IO Int Source #

setNth :: Vec [Int] -> Int -> Int -> IO () Source #

reset :: Vec [Int] -> IO () Source #

swapBetween :: Vec [Int] -> Int -> Int -> IO () Source #

modifyNth :: Vec [Int] -> (Int -> Int) -> Int -> IO () Source #

newVec :: Int -> Int -> IO (Vec [Int]) Source #

setAll :: Vec [Int] -> Int -> IO () Source #

growBy :: Vec [Int] -> Int -> IO (Vec [Int]) Source #

asList :: Vec [Int] -> IO [Int] Source #

data Vec Double Source # 
data Vec Int Source # 
data Vec [Int] Source # 
data Vec [Int] = Vec (UVector Int)

SingleStorage

class SingleStorage s t | s -> t where Source #

Interface for single (one-length vector) mutable data

Minimal complete definition

get', set'

Methods

new' :: t -> IO s Source #

allocates and returns an new data.

get' :: s -> IO t Source #

gets the value.

set' :: s -> t -> IO () Source #

sets the value.

modify' :: s -> (t -> t) -> IO () Source #

calls an update function on it.

type Bool' = IOVector Bool Source #

Mutable Bool

type Double' = ByteArrayDouble Source #

Mutable Double

type Int' = ByteArrayInt Source #

Mutable Int Note: Int' is identical to Stack

Stack

class SingleStorage s Int => StackFamily s t | s -> t where Source #

Interface on stacks

Methods

newStack :: Int -> IO s Source #

returns a new stack.

pushTo :: s -> t -> IO () Source #

pushs an value to the tail of the stack.

popFrom :: s -> IO () Source #

pops the last element.

lastOf :: s -> IO t Source #

peeks the last element.

shrinkBy :: s -> Int -> IO () Source #

shrinks the stack.

type Stack = Vec Int Source #

Stack of Int, an alias of Vec Int

newStackFromList :: [Int] -> IO Stack Source #

returns a new Stack from [Int].

realLengthOfStack :: Stack -> Int Source #

returns the number of allocated slots

sortStack :: Stack -> IO () Source #

sort the content of a stack, in small-to-large order.