aivika-1.2: A multi-paradigm simulation library

Stabilityexperimental
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Safe HaskellSafe-Inferred

Simulation.Aivika.Vector.Unboxed

Description

Tested with: GHC 7.6.3

An imperative unboxed vector.

Synopsis

Documentation

data Vector a Source

Represents an unboxed resizable vector.

newVector :: Unboxed a => IO (Vector a)Source

Create a new vector.

copyVector :: Unboxed a => Vector a -> IO (Vector a)Source

Copy the vector.

vectorCount :: Unboxed a => Vector a -> IO IntSource

Return the element count.

appendVector :: Unboxed a => Vector a -> a -> IO ()Source

Add the specified element to the end of the vector.

readVector :: Unboxed a => Vector a -> Int -> IO aSource

Read a value from the vector, where indices are started from 0.

writeVector :: Unboxed a => Vector a -> Int -> a -> IO ()Source

Set an array item at the specified index which is started from 0.

vectorBinarySearch :: (Unboxed a, Ord a) => Vector a -> a -> IO IntSource

Return the index of the specified element using binary search; otherwise, a negated insertion index minus one: 0 -> -0 - 1, ..., i -> -i - 1, ....

vectorInsert :: Unboxed a => Vector a -> Int -> a -> IO ()Source

Insert the element in the vector at the specified index.

vectorDeleteAt :: Unboxed a => Vector a -> Int -> IO ()Source

Delete the element at the specified index.

vectorIndex :: (Unboxed a, Eq a) => Vector a -> a -> IO IntSource

Return the index of the item or -1.

freezeVector :: Unboxed a => Vector a -> IO (Array Int a)Source

Return the elements of the vector in an immutable array.