sym-0.13.0: Permutations, patterns, and statistics

CopyrightAnders Claesson 2013-2016
MaintainerAnders Claesson <anders.claesson@gmail.com>
Safe HaskellNone
LanguageHaskell98

Sym.Internal.CLongArray

Contents

Description

Convenience functions for dealing with arrays of CLongs.

Synopsis

Data type

Conversions

fromList :: [Int] -> CLongArray Source #

Construct an array from a list of elements.

toList :: CLongArray -> [Int] Source #

The list of elements.

slices :: [Int] -> CLongArray -> [CLongArray] Source #

Slice a CLongArray into contiguous segments of the given sizes. Each segment size must be positive and they must sum to the size of the array.

Accessors

size :: Size a => a -> Int Source #

at :: CLongArray -> Int -> Int infixl 9 Source #

w `at` i is the value of w at i, where i is in [0..size w-1].

unsafeAt :: CLongArray -> Int -> Int infixl 9 Source #

Like at but without range checking.

elemIndices :: CLong -> CLongArray -> Vector Int Source #

The indices of all elements equal to the query element, in ascending order.

Map

imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArray Source #

Apply a function to every element of an array and its index.

izipWith :: (Int -> CLong -> CLong -> CLong) -> CLongArray -> CLongArray -> CLongArray Source #

Apply a function to corresponding pairs of elements and their (shared) index.

Low level functions

unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArray Source #

Create a new array of the given size that is initialized through an IO action.

unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO a Source #

Pass a pointer to the array to an IO action; the array may not be modified through the pointer.