arrayfire-0.4.0.0: Haskell bindings to the ArrayFire general-purpose GPU library

Copyright David Johnson (c) 2019-2020 BSD 3 David Johnson Experimental GHC None Haskell2010

ArrayFire.Signal

Description

Synopsis

# Documentation

Arguments

 :: AFType a => Array a the input array -> Array a array contains the interpolation locations -> InterpType is the interpolation type, it can take one of the values defined by InterpType -> Float is the value that will set in the output array when certain index is out of bounds -> Array a is the array with interpolated values

approx1 interpolates data along the first dimensions

ArrayFire Docs

Interpolation is performed assuming input data is equally spaced with indices in the range [0, n). The positions are sampled with respect to data at these locations.

>>> input = vector 3 [10,20,30]
>>> positions = vector 5 [0.0, 0.5, 1.0, 1.5, 2.0]
>>> approx1 @Double input positions Cubic 0.0
ArrayFire Array
[5 1 1 1]
10.0000    13.7500    20.0000    26.2500    30.0000


Arguments

 :: AFType a => Array a is the input array -> Array a array contains the interpolation locations for first dimension -> Array a array contains the interpolation locations for second dimension -> InterpType is the interpolation type, it can take one of the values defined by InterpType -> Float is the value that will set in the output array when certain index is out of bounds -> Array a is the array with interpolated values

approx2 performs interpolation on data along the first and second dimensions.

ArrayFire Docs

Interpolation is performed assuming input data is equally spaced with indices in the range [0, n) along each dimension. The positions are sampled with respect to data at these locations.

>>> input = matrix @Double (3,3) [ [ 1.0,1.0,1.0 ], [ 2.0, 2.0, 2.0 ], [ 3.0,3.0,3.0 ] ]
>>> positions1 = matrix @Double (2,2) [ [ 0.5,1.5 ],[ 0.5,1.5 ] ]
>>> positions2 = matrix @Double (2,2) [ [ 0.5,0.5 ],[ 1.5,1.5 ] ]
>>> approx2 @Double input positions1 positions2 Cubic 0.0
ArrayFire Array
[2 2 1 1]
1.3750     1.3750
2.6250     2.6250


Arguments

 :: (AFType a, Fractional a) => Array a input Array -> Double the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals - used to either truncate or pad the input signals. -> Array a is the transformed array

Fast Fourier Transform

ArrayFire Docs

The Fast Fourier Transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) of a signal or array. This is most commonly used to convert data in the time (or space) domain to the frequency domain, Then, the inverse FFT (iFFT) is used to return the data to the original domain.

>>> fft (vector @Double 10 [1..]) 2.0 10
ArrayFire Array
[2 2 1 1]
1.3750     1.3750
2.6250     2.6250


Arguments

 :: (AFType a, Fractional a) => Array (Complex a) is the input array on entry and the output of 1D forward fourier transform at exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Fast Fourier Transform (in-place)

ArrayFire Docs

C Interface for fast fourier transform on one dimensional signals.

• Note* The input in must be a complex array

Arguments

 :: AFType a => Array a the input array -> Double the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Array a the transformed array

Fast Fourier Transform (2-dimensional)

ArrayFire Docs

C Interface for fast fourier transform on two dimensional signals.

Arguments

 :: (Fractional a, AFType a) => Array (Complex a) input array on entry and the output of 2D forward fourier transform on exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Fast Fourier Transform (2-dimensional, in-place)

ArrayFire Docs

C Interface for fast fourier transform on two dimensional signals.

• Note* The input in must be a complex array

Arguments

 :: AFType a => Array a the input array -> Double the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Int is the length of output signals along third dimension - used to either truncate/pad the input -> Array a the transformed array

Fast Fourier Transform (3-dimensional)

ArrayFire Docs

C Interface for fast fourier transform on three dimensional signals.

Arguments

 :: (Fractional a, AFType a) => Array (Complex a) input array on entry and the output of 3D forward fourier transform on exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Fast Fourier Transform (3-dimensional, in-place)

ArrayFire Docs

C Interface for fast fourier transform on three dimensional signals.

• Note* The input in must be a complex array

Arguments

 :: AFType a => Array a the input array -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals - used to either truncate or pad the input signals -> Array a the transformed array

Inverse Fast Fourier Transform

ArrayFire Docs

C Interface for inverse fast fourier transform on one dimensional signals.

Arguments

 :: (AFType a, Fractional a) => Array (Complex a) is the input array on entry and the output of 1D forward fourier transform at exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Inverse Fast Fourier Transform (in-place)

ArrayFire Docs

C Interface for fast fourier transform on one dimensional signals.

Arguments

 :: AFType a => Array a the input array -> Double the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Array a the transformed array

Inverse Fast Fourier Transform (2-dimensional signals)

ArrayFire Docs

C Interface for inverse fast fourier transform on two dimensional signals.

Arguments

 :: (AFType a, Fractional a) => Array (Complex a) is the input array on entry and the output of 1D forward fourier transform at exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Inverse Fast Fourier Transform (2-dimensional, in-place)

ArrayFire Docs

C Interface for fast fourier transform on two dimensional signals.

Arguments

 :: AFType a => Array a the input array -> Double the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Int is the length of output signals along third dimension - used to either truncate/pad the input -> Array a the transformed array

Inverse Fast Fourier Transform (3-dimensional)

ArrayFire Docs

C Interface for inverse fast fourier transform on three dimensional signals.

Arguments

 :: (AFType a, Fractional a) => Array (Complex a) is the input array on entry and the output of 1D forward fourier transform at exit -> Double is the normalization factor with which the input is scaled after the transformation is applied -> IO ()

Inverse Fast Fourier Transform (3-dimensional, in-place)

ArrayFire Docs

C Interface for fast fourier transform on two dimensional signals.

Arguments

 :: (Fractional a, AFType a) => Array a is a real array -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Array a is a complex array containing the non redundant parts of in.

Real to Complex Fast Fourier Transform

ArrayFire Docs

C Interface for real to complex fast fourier transform for one dimensional signals.

The first dimension of the output will be of size (pad0 / 2) + 1. The second dimension of the output will be pad1. The third dimension of the output will be pad 2.

Arguments

 :: (Fractional a, AFType a) => Array a is a real array -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Array a is a complex array containing the non redundant parts of in.

Real to Complex Fast Fourier Transform

ArrayFire Docs

C Interface for real to complex fast fourier transform for two dimensional signals.

The first dimension of the output will be of size (pad0 / 2) + 1. The second dimension of the output will be pad1. The third dimension of the output will be pad 2.

Arguments

 :: (Fractional a, AFType a) => Array a is a real array -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Int is the length of output signals along first dimension - used to either truncate/pad the input -> Int is the length of output signals along second dimension - used to either truncate/pad the input -> Int is the length of output signals along third dimension - used to either truncate/pad the input -> Array a is a complex array containing the non redundant parts of in.

Real to Complex Fast Fourier Transform

ArrayFire Docs

C Interface for real to complex fast fourier transform for three dimensional signals.

The first dimension of the output will be of size (pad0 / 2) + 1. The second dimension of the output will be pad1. The third dimension of the output will be pad 2.

Arguments

 :: AFType a => Array a is a complex array containing only the non redundant parts of the signals. -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Bool is a flag signifying if the output should be even or odd size -> Array a is a real array containing the output of the transform.

Complex to Real Fast Fourier Transform

ArrayFire Docs

C Interface for complex to real fast fourier transform for one dimensional signals.

The first dimension of the output will be 2 * dim0 - 1 if is_odd is true else 2 * dim0 - 2 where dim0 is the first dimension of the input. The remaining dimensions are unchanged.

Arguments

 :: AFType a => Array a is a complex array containing only the non redundant parts of the signals. -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Bool is a flag signifying if the output should be even or odd size -> Array a is a real array containing the output of the transform.

Complex to Real Fast Fourier Transform (2-dimensional)

ArrayFire Docs

C Interface for complex to real fast fourier transform for two dimensional signals.

The first dimension of the output will be 2 * dim0 - 1 if is_odd is true else 2 * dim0 - 2 where dim0 is the first dimension of the input. The remaining dimensions are unchanged.

Arguments

 :: AFType a => Array a is a complex array containing only the non redundant parts of the signals. -> Double is the normalization factor with which the input is scaled after the transformation is applied -> Bool is a flag signifying if the output should be even or odd size -> Array a is a real array containing the output of the transform.

Complex to Real Fast Fourier Transform (3-dimensional)

ArrayFire Docs

C Interface for complex to real fast fourier transform for three dimensional signals.

The first dimension of the output will be 2 * dim0 - 1 if is_odd is true else 2 * dim0 - 2 where dim0 is the first dimension of the input. The remaining dimensions are unchanged.

Arguments

 :: AFType a => Array a the input signal -> Array a the signal that shall be flipped for the convolution operation -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> ConvDomain specifies if the convolution should be performed in frequency os spatial domain -> Array a convolved array

Convolution Integral for one dimensional data

ArrayFire Docs

C Interface for convolution on one dimensional signals.

• Note* The default parameter of domain, AF_CONV_AUTO, heuristically switches between frequency and spatial domain.

Arguments

 :: AFType a => Array a the input signal -> Array a the signal that shall be flipped for the convolution operation -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> ConvDomain specifies if the convolution should be performed in frequency os spatial domain -> Array a convolved array

Convolution Integral for two dimensional data

ArrayFire Docs

C Interface for convolution on two dimensional signals.

• Note* The default parameter of domain, AF_CONV_AUTO, heuristically switches between frequency and spatial domain.

Arguments

 :: AFType a => Array a the input signal -> Array a the signal that shall be flipped for the convolution operation -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> ConvDomain specifies if the convolution should be performed in frequency os spatial domain -> Array a convolved array

Convolution Integral for three dimensional data

ArrayFire Docs

C Interface for convolution on three dimensional signals.

• Note* The default parameter of domain, AF_CONV_AUTO, heuristically switches between frequency and spatial domain.

Arguments

 :: AFType a => Array a filter that has to be applied along the coloumns -> Array a filter that has to be applied along the rows -> Array a the input array -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> Array a convolved array

C Interface for separable convolution on two dimensional signals.

ArrayFire Docs

C Interface for separable convolution on two dimensional signals.

• Note* The default parameter of domain, AF_CONV_AUTO, heuristically switches between frequency and spatial domain.

Arguments

 :: AFType a => Array a is the input signal -> Array a -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> Array a is convolved array

2D Convolution using Fast Fourier Transform

ArrayFire Docs

A convolution is a common operation between a source array, a, and a filter (or kernel) array b. The answer to the convolution is the same as computing the coefficients in polynomial multiplication, if a and b are the coefficients.

C Interface for FFT-based convolution on two dimensional signals.

Arguments

 :: AFType a => Array a is the input signal -> Array a -> ConvMode indicates if the convolution should be expanded or not(where output size equals input) -> Array a is convolved array

3D Convolution using Fast Fourier Transform

ArrayFire Docs

A convolution is a common operation between a source array, a, and a filter (or kernel) array b. The answer to the convolution is the same as computing the coefficients in polynomial multiplication, if a and b are the coefficients.

C Interface for FFT-based convolution on three dimensional signals.

Arguments

 :: AFType a => Array a is the input signal to the filter -> Array a is the array containing the coefficients of the filter -> Array a is the output signal from the filter

Finite Impulse Filter.

ArrayFire Docs

Finite impulse filters take an input x and a co-efficient array b to generate an output y such that:

C Interface for finite impulse response filter.

Arguments

 :: AFType a => Array a the array containing the feedforward coefficient -> Array a is the array containing the feedback coefficients -> Array a is the input signal to the filter -> Array a the output signal from the filter

Infinite Impulse Filter.

ArrayFire Docs

Infinite impulse filters take an input x and a feedforward array b, feedback array a to generate an output y such that:

C Interface for infinite impulse response filter.

• Note* The feedforward coefficients are currently limited to a length of 512

Arguments

 :: AFType a => Array a Array is the input image -> Int -> Int -> BorderType -> Array a Array is the processed image

Median Filter

ArrayFire Docs

A median filter is similar to the arbitrary filter except that instead of a weighted sum, the median value of the pixels covered by the kernel is returned.

C Interface for median filter.

Arguments

 :: AFType a => Array a Array is the input signal -> Int Is the kernel width -> BorderType value will decide what happens to border when running filter in their neighborhood. It takes one of the values [AF_PAD_ZERO | AF_PAD_SYM] -> Array a Array is the processed signal

1D Median Filter

ArrayFire Docs

A median filter is similar to the arbitrary filter except that instead of a weighted sum, the median value of the pixels covered by the kernel is returned.

C Interface for 1D median filter.

Arguments

 :: AFType a => Array a Array is the input image -> Int the kernel height -> Int the kernel width -> BorderType value will decide what happens to border when running filter in their neighborhood. It takes one of the values [AF_PAD_ZERO | AF_PAD_SYM] -> Array a Array is the processed image

2D Median Filter

ArrayFire Docs

A median filter is similar to the arbitrary filter except that instead of a weighted sum, the median value of the pixels covered by the kernel is returned.

C Interface for 2D median filter.

Arguments

 :: Int is the number of plans that shall be cached -> IO ()

C Interface for setting plan cache size.

ArrayFire Docs

This function doesn't do anything if called when CPU backend is active. The plans associated with the most recently used array sizes are cached.

>>> setFFTPlanCacheSize 2
()