repa-algorithms 2.0.0.3 → 2.1.0.1
raw patch · 2 files changed
+24/−8 lines, 2 filesdep ~repa
Dependency ranges changed: repa
Files
Data/Array/Repa/Algorithms/FFT.hs view
@@ -16,6 +16,7 @@ where import Data.Array.Repa.Algorithms.Complex import Data.Array.Repa as A+import Prelude as P data Mode = Forward@@ -35,9 +36,11 @@ {-# INLINE isPowerOfTwo #-} -- | Check if an `Int` is a power of two. isPowerOfTwo :: Int -> Bool-isPowerOfTwo x- = let r = (log (fromIntegral x) / log 2) :: Double- in ceiling r == (floor r :: Int)+isPowerOfTwo n+ | 0 <- n = True+ | 2 <- n = True+ | n `mod` 2 == 0 = isPowerOfTwo (n `div` 2)+ | otherwise = False @@ -54,7 +57,12 @@ !scale = fromIntegral (depth * width * height) in if not (isPowerOfTwo depth && isPowerOfTwo height && isPowerOfTwo width)- then error "Data.Array.Repa.Algorithms.FFT: fft3d -- array dimensions must be powers of two."+ then error $ unlines+ [ "Data.Array.Repa.Algorithms.FFT: fft3d"+ , " Array dimensions must be powers of two,"+ , " but the provided array is " + P.++ show height P.++ "x" P.++ show width P.++ "x" P.++ show depth ]+ else arr `deepSeqArray` case mode of Forward -> fftTrans3d sign $ fftTrans3d sign $ fftTrans3d sign arr@@ -95,7 +103,11 @@ scale = fromIntegral (width * height) in if not (isPowerOfTwo height && isPowerOfTwo width)- then error "Data.Array.Repa.Algorithms.FFT: fft2d -- array dimensions must be powers of two."+ then error $ unlines+ [ "Data.Array.Repa.Algorithms.FFT: fft2d"+ , " Array dimensions must be powers of two,"+ , " but the provided array is " P.++ show height P.++ "x" P.++ show width ]+ else arr `deepSeqArray` case mode of Forward -> fftTrans2d sign $ fftTrans2d sign arr@@ -126,7 +138,11 @@ scale = fromIntegral len in if not $ isPowerOfTwo len- then error "Data.Array.Repa.Algorithms.FFT: fft1d -- array dimensions must be powers of two."+ then error $ unlines + [ "Data.Array.Repa.Algorithms.FFT: fft1d"+ , " Array dimensions must be powers of two, "+ , " but the provided array is " P.++ show len ]+ else arr `deepSeqArray` case mode of Forward -> fftTrans1d sign arr
repa-algorithms.cabal view
@@ -1,5 +1,5 @@ Name: repa-algorithms-Version: 2.0.0.3+Version: 2.1.0.1 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -20,7 +20,7 @@ Build-Depends: base == 4.*, vector == 0.7.*,- repa == 2.0.*+ repa == 2.1.* ghc-options: -Wall -fno-warn-missing-signatures