statistics 0.3.3 → 0.3.4
raw patch · 4 files changed
+13/−5 lines, 4 files
Files
- Statistics/Function.hs +6/−0
- Statistics/RandomVariate.hs +4/−2
- Statistics/Resampling.hs +2/−2
- statistics.cabal +1/−1
Statistics/Function.hs view
@@ -15,6 +15,7 @@ minMax , sort , partialSort+ , indices -- * Array setup , createU , createIO@@ -39,6 +40,11 @@ -> UArr e partialSort k = apply (\a -> I.partialSort a k) {-# INLINE partialSort #-}++-- | Return the indices of an array.+indices :: (UA a) => UArr a -> UArr Int+indices a = enumFromToU 0 (lengthU a - 1)+{-# INLINE indices #-} data MM = MM {-# UNPACK #-} !Double {-# UNPACK #-} !Double
Statistics/RandomVariate.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types, ScopedTypeVariables #-}+{-# LANGUAGE BangPatterns, CPP, DeriveDataTypeable, MagicHash, Rank2Types,+ ScopedTypeVariables #-} -- | -- Module : Statistics.RandomVariate -- Copyright : (c) 2009 Bryan O'Sullivan@@ -44,6 +45,7 @@ import Data.Int (Int8, Int16, Int32, Int64) import Data.Ratio ((%), numerator) import Data.Time.Clock.POSIX (getPOSIXTime)+import Data.Typeable (Typeable) import Data.Word (Word, Word8, Word16, Word32, Word64) import Foreign.Marshal.Alloc (allocaBytes) import Foreign.Marshal.Array (peekArray)@@ -241,7 +243,7 @@ -- | An immutable snapshot of the state of a 'Gen'. newtype Seed = Seed (UArr Word32)- deriving (Eq, Read, Show)+ deriving (Eq, Read, Show, Typeable) -- | Save the state of a 'Gen', for later use by 'restore'. save :: Gen s -> ST s Seed
Statistics/Resampling.hs view
@@ -20,7 +20,7 @@ import Control.Monad.ST (ST) import Data.Array.Vector import Data.Array.Vector.Algorithms.Intro (sort)-import Statistics.Function (createU)+import Statistics.Function (createU, indices) import Statistics.RandomVariate (Gen, uniform) import Statistics.Types (Estimator, Sample) @@ -53,7 +53,7 @@ -- | Compute a statistical estimate repeatedly over a sample, each -- time omitting a successive element. jackknife :: Estimator -> Sample -> UArr Double-jackknife est sample = mapU f . enumFromToU 0 . subtract 1 . lengthU $ sample+jackknife est sample = mapU f . indices $ sample where f i = est (dropAt i sample) {-# INLINE jackknife #-}
statistics.cabal view
@@ -1,5 +1,5 @@ name: statistics-version: 0.3.3+version: 0.3.4 synopsis: A library of statistical types, data, and functions description: This library provides a number of common functions and types useful