packages feed

vector-fftw 0.1.3.2 → 0.1.3.3

raw patch · 3 files changed

+28/−15 lines, 3 filesdep ~basedep ~primitivedep ~vectornew-uploader

Dependency ranges changed: base, primitive, vector

Files

Numeric/FFT/Vector/Base.hsc view
@@ -12,6 +12,7 @@             planOutputSize,             execute,             executeM,+            withPlanner,             -- * Unsafe C stuff             CFlags,             CPlan,@@ -27,9 +28,10 @@ import qualified Data.Vector.Storable as VS import qualified Data.Vector.Storable.Mutable as MS import Data.Vector.Generic as V hiding (forM_)-import Data.Vector.Generic.Mutable as M+import Data.Vector.Generic.Mutable as M hiding (unsafeModify) import Data.List as L-import Control.Monad.Primitive (RealWorld,PrimMonad(..),+import Control.Concurrent.MVar+import Control.Monad.Primitive (RealWorld,PrimMonad(..), PrimBase,             unsafePrimToPrim, unsafePrimToIO) import Control.Monad(forM_) import Foreign (Storable(..), Ptr, FunPtr,@@ -125,7 +127,7 @@ -- If @'planInputSize' p \/= length vIn@ or @'planOutputSize' p \/= length vOut@, -- then calling @unsafeExecuteM p vIn vOut@ will throw an exception. executeM :: forall m v a b .-        (PrimMonad m, MVector v a, MVector v b, Storable a, Storable b)+        (PrimBase m, MVector v a, MVector v b, Storable a, Storable b)             => Plan a b -- ^ The plan to run.             -> v (PrimState m) a  -- ^ The input vector.                     -> v (PrimState m) b -- ^ The output vector.@@ -248,3 +250,16 @@ unsafeModify :: (Storable a)                 => MS.MVector RealWorld a -> Int -> (a -> a) -> IO () unsafeModify v k f = MS.unsafeRead v k >>= MS.unsafeWrite v k . f++plannerLock :: MVar ()+plannerLock = unsafePerformIO $ newMVar ()+{-# NOINLINE plannerLock #-}++-- | Calls to the FFTW planner are non-reentrant. Here we take a mutex to+-- ensure thread safety.+withPlanner :: IO a -> IO a+withPlanner action = do+    takeMVar plannerLock+    res <- action+    putMVar plannerLock ()+    return res
Numeric/FFT/Vector/Unnormalized.hsc view
@@ -63,7 +63,7 @@             inputSize = id,             outputSize = id,             creationSizeFromInput = id,-            makePlan = \n a b -> fftw_plan_dft_1d n a b d,+            makePlan = \n a b -> withPlanner . fftw_plan_dft_1d n a b d,             normalization = const id             } @@ -86,7 +86,7 @@             inputSize = id,             outputSize = \n -> n `div` 2 + 1,             creationSizeFromInput = id,-            makePlan = fftw_plan_dft_r2c_1d,+            makePlan = \n a b -> withPlanner . fftw_plan_dft_r2c_1d n a b,             normalization = const id         } @@ -103,7 +103,7 @@             inputSize = \n -> n `div` 2 + 1,             outputSize = id,             creationSizeFromInput = \n -> 2 * (n-1),-            makePlan = fftw_plan_dft_c2r_1d,+            makePlan = \n a b -> withPlanner . fftw_plan_dft_c2r_1d n a b,             normalization = const id         } @@ -112,7 +112,7 @@                     inputSize = id,                     outputSize = id,                     creationSizeFromInput = id,-                    makePlan = \n a b -> fftw_plan_r2r_1d n a b kind,+                    makePlan = \n a b -> withPlanner . fftw_plan_r2r_1d n a b kind,                     normalization = const id                 } 
vector-fftw.cabal view
@@ -1,10 +1,10 @@ Name:                vector-fftw -Version:             0.1.3.2+Version:             0.1.3.3 License:             BSD3 License-file:        LICENSE Author:              Judah Jacobson-Maintainer:          Judah Jacobson <judah.jacobson@gmail.com>+Maintainer:          Ben Gamari <ben@smart-cactus.org> Copyright:           (c) Judah Jacobson, 2010 Category:            Math Build-type:          Simple@@ -22,12 +22,10 @@                      .                       - "Numeric.FFT.Vector.Unitary" additionally scales all transforms to preserve the L2 (sum-of-squares) norm of the                         input.-                     .-                     Note that this package is currently not thread-safe.  source-repository head     type:   git-    location: https://github.com/judah/vector-fftw+    location: https://github.com/bgamari/vector-fftw   Library@@ -40,9 +38,9 @@   Other-modules:         Numeric.FFT.Vector.Base   -  Build-depends: base>=4.3 && < 4.8,-                 vector>=0.9 && < 0.11,-                 primitive>=0.4 && < 0.6,+  Build-depends: base>=4.3 && < 4.9,+                 vector>=0.9 && < 0.12,+                 primitive>=0.6 && < 0.7,                  storable-complex==0.2.*   Extra-libraries: fftw3