Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Util.Vector

Contents

Description

Vector utilities.

Synopsis

search

count :: Generic.Vector v a => (a -> Bool) -> v a -> Int Source #

find_end :: Generic.Vector v a => (a -> Bool) -> v a -> Maybe a Source #

Like Generic.find, but from the end.

to_reverse_list :: Generic.Vector v a => v a -> [a] Source #

fold_abort :: Generic.Vector v a => (accum -> a -> Maybe accum) -> accum -> v a -> accum Source #

find_before :: Generic.Vector v Int => Int -> v Int -> Int Source #

Find the index of the last value whose running sum is still below the given number.

bracket Source #

Arguments

:: Unboxed.Vector Double 
-> Double 
-> Maybe (Int, Double, Double)

(i, low, high) where low <= a < high, and i is the index of low. If a is out of range, then low==high.

Find the first numbers bracketing a.

lowest_index :: (Ord key, Generic.Vector v a) => (a -> key) -> key -> v a -> Int Source #

Binary search for the lowest index of the given value, or where it would be if it were present.

TODO this is likely the same as Data.Vector.Algorithms.Search.binarySearchLBy

highest_index :: (Ord key, Generic.Vector v a) => (a -> key) -> key -> v a -> Int Source #

Binary search for the highest index of the given X. So the next value is guaranteed to have a higher x, if it exists. Return -1 if x is before the first element.

partition_on :: (Eq key, Generic.Vector v a) => (a -> key) -> v a -> [(key, v a)] Source #

Partition on a key. This is the vector version of keyed_group_stable.