# arrayfire.signal module

Signal processing functions (fft, convolve, etc).

`arrayfire.signal.``approx1`(signal, pos0, method=<arrayfire.library.INTERP object>, off_grid=0.0)

  Interpolate along a single dimension.

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or batch of 1 dimensional signals.

  pos0 : af.Array

  > Locations of the interpolation points.

  method: optional: af.INTERP. default: af.INTERP.LINEAR.

  > Interpolation method.

  off_grid: optional: scalar. default: 0.0.

  > The value used for positions outside the range.

  Returns:

  output: af.Array

  > Values calculated at interpolation points.

`arrayfire.signal.``approx2`(signal, pos0, pos1, method=<arrayfire.library.INTERP object>, off_grid=0.0)

  Interpolate along a two dimension.

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or batch of 2 dimensional signals.

  pos0 : af.Array

  > Locations of the interpolation points along the first dimension.

  pos1 : af.Array

  > Locations of the interpolation points along the second dimension.

  method: optional: af.INTERP. default: af.INTERP.LINEAR.

  > Interpolation method.

  off_grid: optional: scalar. default: 0.0.

  > The value used for positions outside the range.

  Returns:

  output: af.Array

  > Values calculated at interpolation points.

`arrayfire.signal.``convolve`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>, conv_domain=<arrayfire.library.CONV_DOMAIN object>)

  Non batched Convolution.

  This function performs n-dimensional convolution based on input dimensionality.

  Parameters:

  signal: af.Array

  > - An n-dimensional array.

  kernel: af.Array

  > - A n-dimensional kernel.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.

  > - Specifies the domain in which convolution is performed.
  > - af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.
  > - af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.
  > - af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

  Returns:

  output: af.Array

  > - Output of n-dimensional convolution.

`arrayfire.signal.``convolve1`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>, conv_domain=<arrayfire.library.CONV_DOMAIN object>)

  Convolution: 1D

  Parameters:

  signal: af.Array

  > - A 1 dimensional signal or batch of 1 dimensional signals.

  kernel: af.Array

  > - A 1 dimensional kernel or batch of 1 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.

  > - Specifies the domain in which convolution is performed.
  > - af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.
  > - af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.
  > - af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

  Returns:

  output: af.Array

  > - Output of 1D convolution.

`arrayfire.signal.``convolve2`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>, conv_domain=<arrayfire.library.CONV_DOMAIN object>)

  Convolution: 2D

  Parameters:

  signal: af.Array

  > - A 2 dimensional signal or batch of 2 dimensional signals.

  kernel: af.Array

  > - A 2 dimensional kernel or batch of 2 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.

  > - Specifies the domain in which convolution is performed.
  > - af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.
  > - af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.
  > - af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

  Returns:

  output: af.Array

  > - Output of 2D convolution.

`arrayfire.signal.``convolve2_separable`(col_kernel, row_kernel, signal, conv_mode=<arrayfire.library.CONV_MODE object>)

  Convolution: 2D separable convolution

  Parameters:

  col_kernel: af.Array

  > - A column vector to be applied along each column of signal

  row_kernel: af.Array

  > - A row vector to be applied along each row of signal

  signal: af.Array

  > - A 2 dimensional signal or batch of 2 dimensional signals.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  Returns

  ——–

  output: af.Array

  > - Output of 2D sepearable convolution.

`arrayfire.signal.``convolve3`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>, conv_domain=<arrayfire.library.CONV_DOMAIN object>)

  Convolution: 3D

  Parameters:

  signal: af.Array

  > - A 3 dimensional signal or batch of 3 dimensional signals.

  kernel: af.Array

  > - A 3 dimensional kernel or batch of 3 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.

  > - Specifies the domain in which convolution is performed.
  > - af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.
  > - af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.
  > - af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

  Returns:

  output: af.Array

  > - Output of 3D convolution.

`arrayfire.signal.``dft`(signal, odims=(None, None, None, None), scale=None)

  Non batched Fourier transform.

  This function performs n-dimensional fourier transform depending on the input dimensions.

  Parameters:

  signal: af.Array

  > - A multi dimensional arrayfire array.

  odims: optional: tuple of ints. default: (None, None, None, None).

  > - If None, calculated to be signal.dims()

  scale: optional: scalar. default: None.

  > - Scale factor for the fourier transform.
  > - If none, calculated to be 1.0.

  Returns:

  output: af.Array

  > - A complex array that is the ouput of n-dimensional fourier transform.

`arrayfire.signal.``fft`(signal, dim0=None, scale=None)

  Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the fft.

`arrayfire.signal.``fft2`(signal, dim0=None, dim1=None, scale=None)

  Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the fft.

`arrayfire.signal.``fft2_c2r`(signal, is_odd=False, scale=None)

  Real to Complex Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  is_odd: optional: Boolean. default: False.

  > - Specifies if the first dimension of output should be even or odd.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1 / (signal.dims()[0] * signal.dims()[1]).

  Returns:

  output: af.Array

  > A real af.Array containing the full output of the fft.

`arrayfire.signal.``fft2_inplace`(signal, scale=None)

  In-place Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

`arrayfire.signal.``fft2_r2c`(signal, dim0=None, dim1=None, scale=None)

  Real to Complex Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the non-redundant parts of the full FFT.

`arrayfire.signal.``fft3`(signal, dim0=None, dim1=None, dim2=None, scale=None)

  Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  dim2: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim2 is calculated to be the third dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the fft.

`arrayfire.signal.``fft3_c2r`(signal, is_odd=False, scale=None)

  Real to Complex Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  is_odd: optional: Boolean. default: False.

  > - Specifies if the first dimension of output should be even or odd.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1 / (signal.dims()[0] * signal.dims()[1] * signal.dims()[2]).

  Returns:

  output: af.Array

  > A real af.Array containing the full output of the fft.

`arrayfire.signal.``fft3_inplace`(signal, scale=None)

  In-place Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

`arrayfire.signal.``fft3_r2c`(signal, dim0=None, dim1=None, dim2=None, scale=None)

  Real to Complex Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  dim2: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim2 is calculated to be the third dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the non-redundant parts of the full FFT.

`arrayfire.signal.``fft_c2r`(signal, is_odd=False, scale=None)

  Real to Complex Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  is_odd: optional: Boolean. default: False.

  > - Specifies if the first dimension of output should be even or odd.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1 / (signal.dims()[0]).

  Returns:

  output: af.Array

  > A real af.Array containing the full output of the fft.

`arrayfire.signal.``fft_convolve`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>)

  Non batched FFT Convolution.

  This function performs n-dimensional convolution based on input dimensionality.

  Parameters:

  signal: af.Array

  > - An n-dimensional array.

  kernel: af.Array

  > - A n-dimensional kernel.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  Returns:

  output: af.Array

  > - Output of n-dimensional convolution.

`arrayfire.signal.``fft_convolve1`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>)

  FFT based Convolution: 1D

  Parameters:

  signal: af.Array

  > - A 1 dimensional signal or batch of 1 dimensional signals.

  kernel: af.Array

  > - A 1 dimensional kernel or batch of 1 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  Returns:

  output: af.Array

  > - Output of 1D convolution.

`arrayfire.signal.``fft_convolve2`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>)

  FFT based Convolution: 2D

  Parameters:

  signal: af.Array

  > - A 2 dimensional signal or batch of 2 dimensional signals.

  kernel: af.Array

  > - A 2 dimensional kernel or batch of 2 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  Returns:

  output: af.Array

  > - Output of 2D convolution.

`arrayfire.signal.``fft_convolve3`(signal, kernel, conv_mode=<arrayfire.library.CONV_MODE object>)

  FFT based Convolution: 3D

  Parameters:

  signal: af.Array

  > - A 3 dimensional signal or batch of 3 dimensional signals.

  kernel: af.Array

  > - A 3 dimensional kernel or batch of 3 dimensional kernels.

  conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.

  > - Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

  Returns:

  output: af.Array

  > - Output of 3D convolution.

`arrayfire.signal.``fft_inplace`(signal, scale=None)

  In-place Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

`arrayfire.signal.``fft_r2c`(signal, dim0=None, scale=None)

  Real to Complex Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.

  Returns:

  output: af.Array

  > A complex af.Array containing the non-redundant parts of the full FFT.

`arrayfire.signal.``fir`(B, X)

  Finite impulse response filter.

  Parameters:

  B : af.Array

  > A 1 dimensional array containing the coefficients of the filter.

  X : af.Array

  > A 1 dimensional array containing the signal.

  Returns:

  Y : af.Array

  > The output of the filter.

`arrayfire.signal.``idft`(signal, scale=None, odims=(None, None, None, None))

  Non batched Inverse Fourier transform.

  This function performs n-dimensional inverse fourier transform depending on the input dimensions.

  Parameters:

  signal: af.Array

  > - A multi dimensional arrayfire array.

  odims: optional: tuple of ints. default: (None, None, None, None).

  > - If None, calculated to be signal.dims()

  scale: optional: scalar. default: None.

  > - Scale factor for the fourier transform.
  > - If none, calculated to be 1.0 / signal.elements()

  Returns:

  output: af.Array

  > - A complex array that is the ouput of n-dimensional inverse fourier transform.

`arrayfire.signal.``ifft`(signal, dim0=None, scale=None)

  Inverse Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (dim0)

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the inverse fft.

`arrayfire.signal.``ifft2`(signal, dim0=None, dim1=None, scale=None)

  Inverse Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (dim0 * dim1)

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the inverse fft.

`arrayfire.signal.``ifft2_inplace`(signal, scale=None)

  Inverse In-place Fast Fourier Transform: 2D

  Parameters:

  signal: af.Array

  > A 2 dimensional signal or a batch of 2 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (signal.dims()[0] * signal.dims()[1])

`arrayfire.signal.``ifft3`(signal, dim0=None, dim1=None, dim2=None, scale=None)

  Inverse Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  dim0: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim0 is calculated to be the first dimension of signal.

  dim1: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim1 is calculated to be the second dimension of signal.

  dim2: optional: int. default: None.

  > - Specifies the size of the output.
  > - If None, dim2 is calculated to be the third dimension of signal.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (dim0 * dim1 * dim2).

  Returns:

  output: af.Array

  > A complex af.Array containing the full output of the inverse fft.

`arrayfire.signal.``ifft3_inplace`(signal, scale=None)

  Inverse In-place Fast Fourier Transform: 3D

  Parameters:

  signal: af.Array

  > A 3 dimensional signal or a batch of 3 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (signal.dims()[0] * signal.dims()[1] * signal.dims()[2]).

`arrayfire.signal.``ifft_inplace`(signal, scale=None)

  Inverse In-place Fast Fourier Transform: 1D

  Parameters:

  signal: af.Array

  > A 1 dimensional signal or a batch of 1 dimensional signals.

  scale: optional: scalar. default: None.

  > - Specifies the scaling factor.
  > - If None, scale is set to 1.0 / (signal.dims()[0])

`arrayfire.signal.``iir`(B, A, X)

  Infinite impulse response filter.

  Parameters:

  B : af.Array

  > A 1 dimensional array containing the feed forward coefficients of the filter.

  A : af.Array

  > A 1 dimensional array containing the feed back coefficients of the filter.

  X : af.Array

  > A 1 dimensional array containing the signal.

  Returns:

  Y : af.Array

  > The output of the filter.