Safe Haskell | Safe-Inferred |
---|

Vector utilities.

## Synopsis

- count :: Generic.Vector v a => (a -> Bool) -> v a -> Int
- find_end :: Generic.Vector v a => (a -> Bool) -> v a -> Maybe a
- to_reverse_list :: Generic.Vector v a => v a -> [a]
- fold_abort :: Generic.Vector v a => (accum -> a -> Maybe accum) -> accum -> v a -> accum
- find_before :: Generic.Vector v Int => Int -> v Int -> Int
- bracket :: Unboxed.Vector Double -> Double -> Maybe (Int, Double, Double)
- lowest_index :: (Ord key, Generic.Vector v a) => (a -> key) -> key -> v a -> Int
- highest_index :: (Ord key, Generic.Vector v a) => (a -> key) -> key -> v a -> Int
- partition_on :: (Eq key, Generic.Vector v a) => (a -> key) -> v a -> [(key, v a)]

# search

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.

:: Unboxed.Vector Double | |

-> Double | |

-> Maybe (Int, Double, Double) | (i, low, high) where low <= a < high, and i is the index of low.
If |

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`

.