Commits

Bryan O'Sullivan committed 5befb23

Bump version.

  • Participants
  • Parent commits 73d889d
  • Tags 0.3.4

Comments (0)

Files changed (3)

File Statistics/Function.hs

       minMax
     , sort
     , partialSort
+    , indices
     -- * Array setup
     , createU
     , createIO
 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
 
 -- | Compute the minimum and maximum of an array in one pass.

File Statistics/Resampling.hs

 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)
 
 -- | 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 #-}
 

File statistics.cabal

 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