1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
/*!
\page signal_func_conv_desc Convolution
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.
Another way to think about it is that the filter kernel is centered on each pixel in a,
and the output for that pixel or data point is the sum of the products.
Depending on the dimensions of the input signal and the filter signal, any one of the following
batch mode convolutions take place.
- **No Batch** - Single filter applied to single input.
- **Filter is Batched** - Many filters applied on same input
- **Signal is Batched** - Single filter applied to a set of inputs.
- **Identical Batches** - A set of filters applied onto to a set of inputs in one-to-one correspondence.
- **Non overlapping Batches** - All batched filters are applied to all batched signals. The batch dimension of Signal and Filter **should not** be the same.
\page signal_func_conv2_batch_desc convolve2
For example, if the signal is two dimensional with m & n as sizes along the 0th & 1st dimensions
respectively, then the possible batch operations are as follows.
| Input Signal Dimensions | Filter Dimensions | Output Dimensions | Batch Mode | Explanation |
|:-----------------------:|:-----------------:|:-----------------:|:----------:|:------------|
| [m n 1 1] | [m n 1 1] | [m n 1 1] | No Batch | Output will be a single convolve array |
| [m n 1 1] | [m n p 1] | [m n p 1] | Filter is Batched | p filters applied to same input |
| [m n p 1] | [m n 1 1] | [m n p 1] | Signal is Batched | 1 filter applied to p inputs |
| [m n p 1] | [m n p 1] | [m n p 1] | Identical Batches | p filters applied to p inputs in one-to-one correspondence |
| [m n p 1] | [m n 1 q] | [m n p q] | Non-overlapping batches | q filters applied to p inputs in to produce p x q results |
| [m n 1 p] | [m n q 1] | [m n q p] | Non-overlapping batches | q filters applied to p inputs in to produce q x p results |
\page signal_func_fft_desc fft
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.
There are numerous algorithms to compute the FFT of an array, and the specifics of the
algorithm depend on the target hardware. Most algorithms, however, use a Cooley-Tukey
scheme in a divide-and-conquer approach.
\note There are some convenience functions provided for fft where normalization
factor is not required as input paramter. In such cases, the normalization
factor is calculated internally based on the input data provided.
*/
//=====================================================================
/**
\addtogroup arrayfire_func
@{
\defgroup signal_func_convolve convolve
\ingroup convolve_mat
\brief Convolution Integral for any dimensional data
\copydoc signal_func_conv_desc
\copydoc signal_func_conv2_batch_desc
\defgroup signal_func_convolve1 convolve1
\ingroup convolve_mat
\brief Convolution Integral for one dimensional data
\copydoc signal_func_conv_desc
For example, if the input size is m along 0th dimension, then the possible batch operations are as follows.
| Input Signal Dimensions | Filter Dimensions | Output Dimensions | Batch Mode | Explanation |
|:-----------------------:|:-----------------:|:-----------------:|:----------:|:------------|
| [m n 1 1] | [m n 1 1] | [m n 1 1] | No Batch | Output will be a single convolve array |
| [m n 1 1] | [m n p 1] | [m n p 1] | Filter is Batched | p filters applied to same input |
| [m n p 1] | [m n 1 1] | [m n p 1] | Signal is Batched | 1 filter applied to p inputs |
| [m n p 1] | [m n p 1] | [m n p 1] | Identical Batches | p filters applied to p inputs in one-to-one correspondence |
| [m n p 1] | [m n 1 q] | [m n p q] | Non-overlapping batches | q filters applied to p inputs in to produce p x q results |
| [m n 1 p] | [m n q 1] | [m n q p] | Non-overlapping batches | q filters applied to p inputs in to produce q x p results |
\defgroup signal_func_convolve2 convolve2
\ingroup convolve_mat
\brief Convolution Integral for two dimensional data
\copydoc signal_func_conv_desc
\copydoc signal_func_conv2_batch_desc
\defgroup signal_func_convolve3 convolve3
\ingroup convolve_mat
\brief Convolution Integral for three dimensional data
\copydoc signal_func_conv_desc
For example, if the signal is three dimensional with m, n & p sizes along the 0th, 1st & 2nd dimensions
respectively, then the possible batch operations are as follows.
| Input Signal Dimensions | Filter Dimensions | Output Dimensions | Batch Mode | Explanation |
|:-----------------------:|:-----------------:|:-----------------:|:----------:|:------------|
| [m n 1 1] | [m n 1 1] | [m n 1 1] | No Batch | Output will be a single convolve array |
| [m n 1 1] | [m n p 1] | [m n p 1] | Filter is Batched | p filters applied to same input |
| [m n p 1] | [m n 1 1] | [m n p 1] | Signal is Batched | 1 filter applied to p inputs |
| [m n p 1] | [m n p 1] | [m n p 1] | Identical Batches | p filters applied to p inputs in one-to-one correspondence |
| [m n p 1] | [m n 1 q] | [m n p q] | Non-overlapping batches | q filters applied to p inputs in to produce p x q results |
| [m n 1 p] | [m n q 1] | [m n q p] | Non-overlapping batches | q filters applied to p inputs in to produce q x p results |
===============================================================================
\defgroup signal_func_fft_convolve fftConvolve
\ingroup convolve_mat
\brief Convolution using Fast Fourier Transform
\copydoc signal_func_conv_desc
===============================================================================
\defgroup signal_func_fft_convolve2 fftConvolve2
\ingroup convolve_mat
\brief 2D Convolution using Fast Fourier Transform
\copydoc signal_func_conv_desc
===============================================================================
\defgroup signal_func_fft_convolve3 fftConvolve3
\ingroup convolve_mat
\brief 3D Convolution using Fast Fourier Transform
\copydoc signal_func_conv_desc
===============================================================================
\defgroup signal_func_fft fft
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_fft2 fft2
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_fft3 fft3
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_ifft ifft
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_ifft2 ifft2
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_ifft3 ifft3
\ingroup fft_mat
\brief Fast Fourier Transform
\copydoc signal_func_fft_desc
\defgroup signal_func_fft_r2c fftR2C
\ingroup fft_mat
\brief Real to Complex Fast Fourier Transform
\defgroup signal_func_fft_c2r fftC2R
\ingroup fft_mat
\brief Complex to Real Fast Fourier Transform
\defgroup signal_func_approx1 approx1
\ingroup approx_mat
approx1 interpolates data along the first dimensions.
It has three options for the type of interpolation to perform:
- Nearest neighbor - \ref AF_INTERP_NEAREST
- Linear interpolation - \ref AF_INTERP_LINEAR
- Bilinear interpolation - \ref AF_INTERP_BILINEAR
- Cubic interpolation - \ref AF_INTERP_CUBIC
\defgroup signal_func_approx2 approx2
\ingroup approx_mat
approx2 performs interpolation on data along the first and second dimensions.
It has three options for the type of interpolation to perform:
- Nearest neighbor - \ref AF_INTERP_NEAREST
- Linear interpolation - \ref AF_INTERP_LINEAR
- Bilinear interpolation - \ref AF_INTERP_BILINEAR
- Cubic interpolation - \ref AF_INTERP_CUBIC
\defgroup signal_func_fir fir
\ingroup sigfilt_mat
\brief This function implements a Finite Impulse Filter
Finite impulse filters take an input **x** and a co-efficient array **b** to generate an output **y** such that:
\f$y[n] = \sum_{i = 0}^N b_i . x[n]\f$
\defgroup signal_func_iir iir
\ingroup sigfilt_mat
\brief This function implements a Infinite Impulse Filter
Iinite impulse filters take an input **x** and a feedforward array **b**, feedback array **a** to generate an output **y** such that:
\f$\sum_{j = 0}^Q a_j . y[n] = \sum_{i = 0}^P b_i . x[n]\f$
@}
*/
|