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

Portabilityportable
Stabilityexperimental
Maintainerbos@serpentine.com
Safe HaskellNone

Statistics.Function

Contents

Description

Useful functions.

Synopsis

Scanning

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

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

Sorting

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

Sort a vector.

sortBy :: Vector v e => Comparison e -> v e -> v eSource

Sort a vector using a custom ordering.

partialSortSource

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.

Indexing

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

Zip a vector with its indices.

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

Return the indices of a vector.

Bit twiddling

nextHighestPowerOfTwo :: Int -> IntSource

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.

Comparison

withinSource

Arguments

:: Int

Number of ULPs of accuracy desired.

-> Double 
-> Double 
-> Bool 

Compare two Double values for approximate equality, using Dawson's method.

The required accuracy is specified in ULPs (units of least precision). If the two numbers differ by the given number of ULPs or less, this function returns True.