Bryan O'Sullivan avatar Bryan O'Sullivan committed 5befb23

Bump version.

Comments (0)

Files changed (3)

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.

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 #-}
 
 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.