mios-1.4.0: A Minisat-based SAT solver in Haskell

Safe HaskellTrustworthy
LanguageHaskell2010

SAT.Mios.Vec

Contents

Description

Abstraction Layer for Mutable Vectors

Synopsis

Vector class

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

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.

asUVector :: a ~ Int => v -> UVector Int Source #

converts to an Int vector.

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.

VecFamily WatcherList Clause Source #

WatcherList is an Lit-indexed collection of Clause.

VecFamily ClauseExtManager Clause Source #

ClauseExtManager is a collection of Clause

VecFamily (Vec Double) Double Source # 
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 #

asUVector :: Vec Int -> UVector Int 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 #

VecFamily (UVector Double) Double Source # 
VecFamily (UVector Int) Int Source # 

Vectors

type UVector a = IOVector a Source #

A thin abstract layer for Mutable unboxed Vector

newtype Vec a Source #

Another abstraction layer on UVector.

Note: the 0-th element of Vec Int is reserved for internal tasks. If you want to use it, use UVector Int.

Constructors

Vec (UVector a) 

SingleStorage

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

Interface for single 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' = IOVector Double Source #

Mutable Double

type Int' = IOVector Int Source #

Mutable Int Note: Int' is the same with 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.

Instances

type Stack = Vec Int Source #

Alias of Vec Int. The 0-th element holds the number of elements.

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

returns a new Stack from [Int].