fft 0.1.8.6 → 0.1.8.7
raw patch · 4 files changed
+123/−42 lines, 4 filesdep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: transformers
API changes (from Hackage documentation)
Files
- fft.cabal +14/−11
- flatpak/fftw-3.3.8.json +26/−0
- flatpak/fftwf-3.3.8.json +27/−0
- tests/tests.hs +56/−31
fft.cabal view
@@ -1,32 +1,35 @@ name: fft-version: 0.1.8.6+version: 0.1.8.7 synopsis: Bindings to the FFTW library. description: Bindings to the FFTW library.- .- Provides high performance discrete fourier transforms in- arbitrary dimensions. Include transforms of complex data,- real data, and real to real transforms.- .+ .+ Provides high performance discrete fourier transforms in+ arbitrary dimensions. Include transforms of complex data,+ real data, and real to real transforms.+ . category: Math license: BSD3 license-file: LICENSE author: Jed Brown maintainer: Jed Brown <jed@59A2.org>, Henning Thielemann <fft@henning-thielemann.de>-build-type: Simple-cabal-version: >= 1.14+build-type: Simple+cabal-version: 1.14+extra-source-files:+ flatpak/fftw-3.3.8.json+ flatpak/fftwf-3.3.8.json flag splitBase flag base4 source-repository this- tag: 0.1.8.6+ tag: 0.1.8.7 type: darcs- location: http://hub.darcs.net/thielema/fft/+ location: https://hub.darcs.net/thielema/fft/ source-repository head type: darcs- location: http://hub.darcs.net/thielema/fft/+ location: https://hub.darcs.net/thielema/fft/ library build-depends:
+ flatpak/fftw-3.3.8.json view
@@ -0,0 +1,26 @@+{+ "cleanup": [+ "/bin",+ "/include",+ "/lib/cmake",+ "/lib/libfftw3.la",+ "/lib/pkgconfig",+ "/share"+ ],+ "config-opts": [+ "--enable-shared",+ "--disable-static",+ "--disable-doc",+ "--disable-fortran"+ ],+ "sources": [+ {+ "url": "http://fftw.org/fftw-3.3.8.tar.gz",+ "type": "archive",+ "sha256": "6113262f6e92c5bd474f2875fa1b01054c4ad5040f6b0da7c03c98821d9ae303"+ }+ ],+ "name": "fftw-3.3.8-double",+ "buildsystem": "autotools",+ "builddir": false+}
+ flatpak/fftwf-3.3.8.json view
@@ -0,0 +1,27 @@+{+ "cleanup": [+ "/bin",+ "/include",+ "/lib/cmake",+ "/lib/libfftw3f.la",+ "/lib/pkgconfig",+ "/share"+ ],+ "config-opts": [+ "--enable-float",+ "--enable-shared",+ "--disable-static",+ "--disable-doc",+ "--disable-fortran"+ ],+ "sources": [+ {+ "url": "http://fftw.org/fftw-3.3.8.tar.gz",+ "type": "archive",+ "sha256": "6113262f6e92c5bd474f2875fa1b01054c4ad5040f6b0da7c03c98821d9ae303"+ }+ ],+ "name": "fftw-3.3.8-single",+ "buildsystem": "autotools",+ "builddir": false+}
tests/tests.hs view
@@ -51,34 +51,39 @@ about :: (Fractional a, Num e, Ord a, Ix i, IArray array e, Abs e a) =>- array i e -> array i e -> Bool-about x y = small $ normSup (liftArray2 (-) x y) / (1 + normSup (liftArray2 (+) x y))- where small a = a < 1e-15+ a -> array i e -> array i e -> Bool+about tol x y =+ normSup (liftArray2 (-) x y) / (1 + normSup (liftArray2 (+) x y)) < tol partAbout :: (Fractional a, Num e, Ord a, Ix i, IArray array e, Shapable i, Abs e a) =>- array i e -> array i e -> Bool-partAbout a b = about a (slice ba ba b)+ a -> array i e -> array i e -> Bool+partAbout tol a b = about tol a (slice ba ba b) where ba = bounds a aboutIdem :: (Fractional a, Num e, Ord a, Ix i, IArray array e, Abs e a) =>- (array i e -> array i e) -> array i e -> Bool-aboutIdem f x = f x `about` x+ (array i e -> array i e) -> a -> array i e -> Bool+aboutIdem f tol x = about tol (f x) x -prop_dft :: CArray Int (Complex Double) -> Bool+prop_dft ::+ (FFTWReal e, Abs (Complex e) a, RealFrac a) =>+ a -> CArray Int (Complex e) -> Bool prop_dft = aboutIdem $ idft . dft prop_dftRC, prop_dht_idem :: (Fractional a, Ord a, Ix i, Shapable i, FFTWReal e, Abs e a) =>- CArray i e -> Bool-prop_dftRC a = aboutIdem ((if odd (shape a !! 0) then dftCRO else dftCR) . dftRC) a-prop_dht_idem a = aboutIdem (amap (/ fromIntegral (shape a !! 0)) . dht . dht) a+ a -> CArray i e -> Bool+prop_dftRC tol a =+ aboutIdem ((if odd (shape a !! 0) then dftCRO else dftCR) . dftRC) tol a+prop_dht_idem tol a =+ aboutIdem (amap (/ fromIntegral (shape a !! 0)) . dht . dht) tol a prop_dft2, prop_dft22, prop_dft22' ::- CArray (Int, Int) (Complex Double) -> Bool+ (FFTWReal e, Abs (Complex e) e) =>+ e -> CArray (Int, Int) (Complex e) -> Bool prop_dft2 = aboutIdem $ idft . dft prop_dft22 = aboutIdem $ idftN [0,1] . dftN [0,1]@@ -86,13 +91,16 @@ prop_dftRC_dft, prop_dftRC_dft22 :: (Fractional a, Ord a, Ix i, Shapable i, FFTWReal r, Abs (Complex r) a) =>- CArray i r -> Bool-prop_dftRC_dft a = partAbout (dftRC a) (dft . amap (:+0) $ a)-prop_dftRC_dft22 a = partAbout (dftRCN [0,1] a) (dftN [0,1] . amap (:+0) $ a)+ a -> CArray i r -> Bool+prop_dftRC_dft tol a =+ partAbout tol (dftRC a) (dft . amap (:+0) $ a)+prop_dftRC_dft22 tol a =+ partAbout tol (dftRCN [0,1] a) (dftN [0,1] . amap (:+0) $ a) prop_dft3, prop_dft32, prop_dft32', prop_dft33, prop_dft33', prop_dft33'' ::- CArray (Int, Int, Int) (Complex Double) -> Bool+ (FFTWReal e, Abs (Complex e) e) =>+ e -> CArray (Int, Int, Int) (Complex e) -> Bool prop_dft3 = aboutIdem $ idft . dft prop_dft32 = aboutIdem $ idftN [0,1] . dftN [0,1]@@ -101,17 +109,23 @@ prop_dft33' = aboutIdem $ idftN [0,2,1] . dftN [0,2,1] prop_dft33'' = aboutIdem $ idftN [2,0,1] . dftN [2,0,1] -c_tests :: [(String, CArray Int (Complex Double) -> Bool)]+c_tests ::+ (FFTWReal e, Abs (Complex e) e) =>+ [(String, e -> CArray Int (Complex e) -> Bool)] c_tests = [ ("dft idem 1D" , prop_dft) ] -c_tests2 :: [(String, CArray (Int,Int) (Complex Double) -> Bool)]+c_tests2 ::+ (FFTWReal e, Abs (Complex e) e) =>+ [(String, e -> CArray (Int,Int) (Complex e) -> Bool)] c_tests2 = [ ("dft idem 2D" , prop_dft2) , ("dft idem 2D/2" , prop_dft22) , ("dft idem 2D/2'" , prop_dft22') ] -c_tests3 :: [(String, CArray (Int,Int,Int) (Complex Double) -> Bool)]+c_tests3 ::+ (FFTWReal e, Abs (Complex e) e) =>+ [(String, e -> CArray (Int,Int,Int) (Complex e) -> Bool)] c_tests3 = [ ("dft idem 3D" , prop_dft3) , ("dft idem 3D/2" , prop_dft32) , ("dft idem 3D/2'" , prop_dft32')@@ -120,13 +134,17 @@ , ("dft idem 3D/3''" , prop_dft33'') ] -r_tests :: [(String, CArray Int Double -> Bool)]+r_tests ::+ (FFTWReal e, Abs (Complex e) e, Abs e e) =>+ [(String, e -> CArray Int e -> Bool)] r_tests = [ ("dftRC/CR idem 1D" , prop_dftRC) , ("dftRC dft 1D" , prop_dftRC_dft) , ("dht idem 1D" , prop_dht_idem) ] -r_tests2 :: [(String, CArray (Int,Int) Double -> Bool)]+r_tests2 ::+ (FFTWReal e, Abs (Complex e) e, Abs e e) =>+ [(String, e -> CArray (Int,Int) e -> Bool)] r_tests2 = [ ("dftRC/CR idem 2D" , prop_dftRC) , ("dftRC dft 2D" , prop_dftRC_dft) , ("dftRC dft 2D/2" , prop_dftRC_dft22)@@ -135,22 +153,29 @@ testSingle :: (Show i, ArbitraryIx i, Show e, Storable e, Arbitrary e, QC.Testable t) =>- QC.Args -> (String, CArray i e -> t) -> IO ()-testSingle conf (s, f) =- printf "%-25s: " s >> QC.quickCheckWith conf (\(FFTArray x) -> f x)+ QC.Args -> a -> (String, a -> CArray i e -> t) -> IO ()+testSingle conf tol (s, f) =+ printf "%-25s: " s >> QC.quickCheckWith conf (\(FFTArray x) -> f tol x) +tests ::+ (Show a, Arbitrary a, FFTWReal a, Abs a a, Abs (Complex a) a) =>+ QC.Args -> a -> IO ()+tests conf tol = do+ mapM_ (testSingle conf tol) c_tests+ mapM_ (testSingle conf tol) r_tests+ mapM_ (testSingle conf tol) c_tests2+ mapM_ (testSingle conf tol) r_tests2+ mapM_ (testSingle conf tol) c_tests3+ main :: IO () main = do- x <- getArgs- let n = if null x then 20 else read . head $ x+ args <- getArgs+ let n = case args of [] -> 1000; nStr:_ -> read nStr conf = QC.stdArgs { QC.maxSuccess = n , QC.maxDiscardRatio = 1000 , QC.maxSize = 3 + (n `div` 2) }- mapM_ (testSingle conf) c_tests- mapM_ (testSingle conf) r_tests- mapM_ (testSingle conf) c_tests2- mapM_ (testSingle conf) r_tests2- mapM_ (testSingle conf) c_tests3+ putStrLn "Float" ; tests conf (1e-6::Float)+ putStrLn "Double"; tests conf (1e-15::Double)