-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Algorithms using the Repa array library.
--
-- Reusable algorithms using the Repa array library.
@package repa-algorithms
@version 2.0.0.2
module Data.Array.Repa.Algorithms.Iterate
-- | Iterate array transformation function a fixed number of times,
-- applying force2 between each iteration.
iterateBlockwise :: (Elt a, Num a) => Int -> (Array DIM2 a -> Array DIM2 a) -> Array DIM2 a -> Array DIM2 a
-- | As above, but with the parameters flipped.
iterateBlockwise' :: (Elt a, Num a) => Int -> Array DIM2 a -> (Array DIM2 a -> Array DIM2 a) -> Array DIM2 a
-- | Old support for stencil based convolutions.
--
-- NOTE: This is slated to be merged with the new Stencil support in the
-- next version of Repa. We'll still expose the convolve function
-- though.
module Data.Array.Repa.Algorithms.Convolve
-- | Image-kernel convolution, which takes a function specifying what value
-- to return when the kernel doesn't apply.
convolve :: (Elt a, Num a) => (DIM2 -> a) -> Array DIM2 a -> Array DIM2 a -> Array DIM2 a
-- | A function that gets out of range elements from an image.
type GetOut a = (DIM2 -> a) -> DIM2 -> DIM2 -> a
-- | Use the provided value for every out-of-range element.
outAs :: a -> GetOut a
-- | If the requested element is out of range use the closest one from the
-- real image.
outClamp :: GetOut a
-- | Image-kernel convolution, which takes a function specifying what value
-- to use for out-of-range elements.
convolveOut :: (Elt a, Num a) => GetOut a -> Array DIM2 a -> Array DIM2 a -> Array DIM2 a
-- | Algorithms operating on matrices.
--
-- These functions should give performance comparable with nested loop C
-- implementations, but not block-based, cache friendly, SIMD using,
-- vendor optimised implementions. If you care deeply about runtime
-- performance then you may be better off using a binding to LAPACK, such
-- as hvector.
module Data.Array.Repa.Algorithms.Matrix
-- | Matrix-matrix multiply.
multiplyMM :: Array DIM2 Double -> Array DIM2 Double -> Array DIM2 Double
module Data.Array.Repa.Algorithms.Randomish
-- | Use the ''minimal standard'' Lehmer generator to quickly generate some
-- random numbers with reasonable statistical properties. By
-- ''reasonable'' we mean good enough for games and test data, but not
-- cryptography or anything where the quality of the randomness really
-- matters.
--
-- By nature of the algorithm, the maximum value in the output is clipped
-- to (valMin + 2^31 - 1)
--
-- From ''Random Number Generators: Good ones are hard to find'' Stephen
-- K. Park and Keith W. Miller. Communications of the ACM, Oct 1988,
-- Volume 31, Number 10.
randomishIntArray :: Shape sh => sh -> Int -> Int -> Int -> Array sh Int
randomishIntVector :: Int -> Int -> Int -> Int -> Vector Int
-- | Generate some randomish doubles with terrible statistical properties.
-- This just takes randomish ints then scales them, so there's not much
-- randomness in low-order bits.
randomishDoubleArray :: Shape sh => sh -> Double -> Double -> Int -> Array sh Double
-- | Generate some randomish doubles with terrible statistical properties.
-- This just takes randmish ints then scales them, so there's not much
-- randomness in low-order bits.
randomishDoubleVector :: Int -> Double -> Double -> Int -> Vector Double
-- | Strict complex doubles.
module Data.Array.Repa.Algorithms.Complex
-- | Complex doubles.
type Complex = (Double, Double)
-- | Take the magnitude of a complex number.
mag :: Complex -> Double
-- | Take the argument (phase) of a complex number, in the range [-pi ..
-- pi].
arg :: Complex -> Double
instance Fractional Complex
instance Num Complex
-- | Calculation of roots of unity for the forward and inverse DFT/FFT.
module Data.Array.Repa.Algorithms.DFT.Roots
-- | Calculate roots of unity for the forward transform.
calcRootsOfUnity :: Shape sh => (sh :. Int) -> Array (sh :. Int) Complex
-- | Calculate roots of unity for the inverse transform.
calcInverseRootsOfUnity :: Shape sh => (sh :. Int) -> Array (sh :. Int) Complex
-- | Compute the Discrete Fourier Transform (DFT) along the low order
-- dimension of an array.
--
-- This uses the naive algorithm and takes O(n^2) time. However, you can
-- transform an array with an arbitray extent, unlike with FFT which
-- requires each dimension to be a power of two.
--
-- The dft and idft functions also compute the roots of
-- unity needed. If you need to transform several arrays with the same
-- extent then it is faster to compute the roots once using
-- calcRootsOfUnity or calcInverseRootsOfUnity, then call
-- dftWithRoots directly.
--
-- You can also compute single values of the transform using
-- dftWithRootsSingle.
module Data.Array.Repa.Algorithms.DFT
-- | Compute the DFT along the low order dimension of an array.
dft :: Shape sh => Array (sh :. Int) Complex -> Array (sh :. Int) Complex
-- | Compute the inverse DFT along the low order dimension of an array.
idft :: Shape sh => Array (sh :. Int) Complex -> Array (sh :. Int) Complex
-- | Generic function for computation of forward or inverse DFT. This
-- function is also useful if you transform many arrays with the same
-- extent, and don't want to recompute the roots for each one. The extent
-- of the given roots must match that of the input array, else
-- error.
dftWithRoots :: Shape sh => Array (sh :. Int) Complex -> Array (sh :. Int) Complex -> Array (sh :. Int) Complex
-- | Compute a single value of the DFT. The extent of the given roots must
-- match that of the input array, else error.
dftWithRootsSingle :: Shape sh => Array (sh :. Int) Complex -> Array (sh :. Int) Complex -> (sh :. Int) -> Complex
-- | Applying these transforms to the input of a DFT causes the output to
-- be centered so that the zero frequency is in the middle.
module Data.Array.Repa.Algorithms.DFT.Center
-- | Apply the centering transform to a vector.
center1d :: Array DIM1 Complex -> Array DIM1 Complex
-- | Apply the centering transform to a matrix.
center2d :: Array DIM2 Complex -> Array DIM2 Complex
-- | Apply the centering transform to a 3d array.
center3d :: Array DIM3 Complex -> Array DIM3 Complex
-- | Fast computation of Discrete Fourier Transforms using the
-- Cooley-Tuckey algorithm. Time complexity is O(n log n) in the size of
-- the input.
--
-- This uses a naive divide-and-conquer algorithm, the absolute
-- performance is about 50x slower than FFTW in estimate mode.
module Data.Array.Repa.Algorithms.FFT
data Mode
Forward :: Mode
Reverse :: Mode
Inverse :: Mode
-- | Check if an Int is a power of two.
isPowerOfTwo :: Int -> Bool
-- | Compute the DFT of a 3d array. Array dimensions must be powers of two
-- else error.
fft3d :: Mode -> Array DIM3 Complex -> Array DIM3 Complex
-- | Compute the DFT of a matrix. Array dimensions must be powers of two
-- else error.
fft2d :: Mode -> Array DIM2 Complex -> Array DIM2 Complex
-- | Compute the DFT of a vector. Array dimensions must be powers of two
-- else error.
fft1d :: Mode -> Array DIM1 Complex -> Array DIM1 Complex
instance Show Mode
instance Eq Mode