statistics-0.9.0.0: A library of statistical types, data, and functions

Portability | portable
Stability | experimental
Maintainer | bos@serpentine.com

Statistics.Function

Contents

- Vector setup

Description

Useful functions.

Synopsis

- minMax :: Vector v Double => v Double -> (Double, Double)
- sort :: (Ord e, Vector v e) => v e -> v e
- partialSort :: (Vector v e, Ord e) => Int -> v e -> v e
- indexed :: (Vector v e, Vector v Int, Vector v (Int, e)) => v e -> v (Int, e)
- indices :: (Vector v a, Vector v Int) => v a -> v Int
- nextHighestPowerOfTwo :: Int -> Int
- create :: (PrimMonad m, Vector v e) => Int -> (Int -> m e) -> m (v e)

# Documentation

minMax :: Vector v Double => v Double -> (Double, Double)

Compute the minimum and maximum of a vector in one pass.

sort :: (Ord e, Vector v e) => v e -> v e

Sort a vector.

partialSort

Arguments

:: (Vector v e, Ord e) |
=> Int | The number k of least elements.
-> v e |
-> v e |

Partially sort a vector, such that the least k elements will be at the front.

indexed :: (Vector v e, Vector v Int, Vector v (Int, e)) => v e -> v (Int, e)

Zip a vector with its indices.

indices :: (Vector v a, Vector v Int) => v a -> v Int

Return the indices of a vector.

nextHighestPowerOfTwo :: Int -> Int

Efficiently compute the next highest power of two for a non-negative integer. If the given value is already a power of two, it is returned unchanged. If negative, zero is returned.

# Vector setup

create :: (PrimMonad m, Vector v e) => Int -> (Int -> m e) -> m (v e)

Create a vector, using the given action to populate each element.