aivika-transformers-2.0: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Vector.Unboxed

Description

Tested with: GHC 7.8.3

It defines a prototype of mutable unboxed vectors.

Synopsis

Documentation

data Vector m a Source

A prototype of mutable unboxed vector.

newVector :: ProtoArrayMonad m a => Session m -> m (Vector m a) Source

Create a new vector within the specified simulation session.

copyVector :: ProtoArrayMonad m a => Vector m a -> m (Vector m a) Source

Copy the vector.

vectorCount :: ProtoArrayMonad m a => Vector m a -> m Int Source

Return the element count.

appendVector :: ProtoArrayMonad m a => Vector m a -> a -> m () Source

Add the specified element to the end of the vector.

readVector :: ProtoArrayMonad m a => Vector m a -> Int -> m a Source

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

writeVector :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m () Source

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

vectorBinarySearch :: (ProtoArrayMonad m a, Ord a) => Vector m a -> a -> m Int Source

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

vectorInsert :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m () Source

Insert the element in the vector at the specified index.

vectorDeleteAt :: ProtoArrayMonad m a => Vector m a -> Int -> m () Source

Delete the element at the specified index.

vectorIndex :: (ProtoArrayMonad m a, Eq a) => Vector m a -> a -> m Int Source

Return the index of the item or -1.

freezeVector :: ProtoArrayMonad m a => Vector m a -> m (Array Int a) Source

Return the elements of the vector in an immutable array.