C interface for Convolution. More...

afError af_conv_SS (float *d_out, unsigned ni, const float *d_in, unsigned batchi, unsigned nf, const float *d_filt, unsigned batchf, bool expand)
 Single precision, real input, real filter, one dimensional convolution. More...
 
afError af_conv_CS (cfloat *d_out, unsigned ni, const cfloat *d_in, unsigned batchi, unsigned nf, const float *d_filt, unsigned batchf, bool expand)
 Single precision, complex input, real filter, one dimensional convolution. More...
 
afError af_conv_CC (cfloat *d_out, unsigned ni, const cfloat *d_in, unsigned batchi, unsigned nf, const cfloat *d_filt, unsigned batchf, bool expand)
 Float precision, complex input, complex filter, one dimensional convolution. More...
 
afError af_conv_DD (double *d_out, unsigned ni, const double *d_in, unsigned batchi, unsigned nf, const double *d_filt, unsigned batchf, bool expand)
 Single precision, real input, real filter, one dimensional convolution. More...
 
afError af_conv_ZD (cdouble *d_out, unsigned ni, const cdouble *d_in, unsigned batchi, unsigned nf, const double *d_filt, unsigned batchf, bool expand)
 Double precision, complex input, real filter, one dimensional convolution. More...
 
afError af_conv_ZZ (cdouble *d_out, unsigned ni, const cdouble *d_in, unsigned batchi, unsigned nf, const cdouble *d_filt, unsigned batchf, bool expand)
 Double precision, complex input, complex filter, one dimensional convolution. More...
 
afError af_conv2_SS (float *d_out, unsigned mi, unsigned ni, const float *d_in, unsigned batch_in, unsigned mf, unsigned nf, const float *d_filt, unsigned batch_filt, bool expand)
 
afError af_conv2_CS (cfloat *d_out, unsigned mi, unsigned ni, const cfloat *d_in, unsigned batch_in, unsigned mf, unsigned nf, const float *d_filt, unsigned batch_filt, bool expand)
 Single precision, complex input, real filter, two dimensional convolution. More...
 
afError af_conv2_CC (cfloat *d_out, unsigned mi, unsigned ni, const cfloat *d_in, unsigned batch_in, unsigned mf, unsigned nf, const cfloat *d_filt, unsigned batch_filt, bool expand)
 Single precision, complex input, complex filter, two dimensional convolution. More...
 
afError af_conv2_DD (double *d_out, unsigned mi, unsigned ni, const double *d_in, unsigned batch_in, unsigned mf, unsigned nf, const double *d_filt, unsigned batch_filt, bool expand)
 Double precision, real input, real filter, two dimensional convolution. More...
 
afError af_conv2_ZD (cdouble *d_out, unsigned mi, unsigned ni, const cdouble *d_in, unsigned batch_in, unsigned mf, unsigned nf, const double *d_filt, unsigned batch_filt, bool expand)
 Double precision, complex input, real filter, two dimensional convolution. More...
 
afError af_conv2_ZZ (cdouble *d_out, unsigned mi, unsigned ni, const cdouble *d_in, unsigned batch_in, unsigned mf, unsigned nf, const cdouble *d_filt, unsigned batch_filt, bool expand)
 Double precision, complex input, complex filter, two dimensional convolution. More...
 
afError af_convn_SS (float *d_out, unsigned ndimsi, unsigned *dimsi, const float *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const float *d_filt, unsigned batchf, bool expand)
 Single precision, real input, real filter, multi-dimensional convolution. More...
 
afError af_convn_CS (cfloat *d_out, unsigned ndimsi, unsigned *dimsi, const cfloat *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const float *d_filt, unsigned batchf, bool expand)
 Single precision, complex input, real filter, multi-dimensional convolution. More...
 
afError af_convn_CC (cfloat *d_out, unsigned ndimsi, unsigned *dimsi, const cfloat *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const cfloat *d_filt, unsigned batchf, bool expand)
 Single precision, complex input, complex filter, multi-dimensional convolution. More...
 
afError af_convn_DD (double *d_out, unsigned ndimsi, unsigned *dimsi, const double *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const double *d_filt, unsigned batchf, bool expand)
 Double precision, real input, real filter, multi-dimensional convolution. More...
 
afError af_convn_ZD (cdouble *d_out, unsigned ndimsi, unsigned *dimsi, const cdouble *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const double *d_filt, unsigned batchf, bool expand)
 Double precision, complex input, real filter, multi-dimensional convolution. More...
 
afError af_convn_ZZ (cdouble *d_out, unsigned ndimsi, unsigned *dimsi, const cdouble *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const cdouble *d_filt, unsigned batchf, bool expand)
 Double precision, complex input, complex filter, multi-dimensional convolution. More...
 

Device pointer interface: filter is host pointer

Multi-dimensional convolution (filter on host)

Parameters
[out]d_outThe convolved output
[in]ndimsiNumber of dimensions in input signal
[in]dimsiDimensions of input signal
[in]d_inInput signal
[in]batchiNumber of input signal tiles
[in]ndimsfNumber of dimensions in input filter
[in]dimsfDimensions of input filter
[in]h_filtInput filter (on host)
[in]batchfNumber of input signal tiles
[in]expandperform expanded convolution if true.
afError af_convh_SS (float *d_out, unsigned ndimsi, unsigned *dimsi, const float *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const float *h_filt, unsigned batchf, bool expand)
 Single precision, real input, real filter, multi-dimensional convolution. More...
 
afError af_convh_CS (cfloat *d_out, unsigned ndimsi, unsigned *dimsi, const cfloat *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const float *h_filt, unsigned batchf, bool expand)
 Single precision, complex input, real filter, multi-dimensional convolution. More...
 
afError af_convh_DD (double *d_out, unsigned ndimsi, unsigned *dimsi, const double *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const double *h_filt, unsigned batchf, bool expand)
 Double precision, real input, real filter, multi-dimensional convolution. More...
 
afError af_convh_ZD (cdouble *d_out, unsigned ndimsi, unsigned *dimsi, const cdouble *d_in, unsigned batchi, unsigned ndimsf, unsigned *dimsf, const double *h_filt, unsigned batchf, bool expand)
 Double precision, complex input, real filter, multi-dimensional convolution. More...
 

Detailed Description

C interface for 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.

Consider the following example with the calculation for the first few points shown as a comment:

array a = seq(1, 8);
//a = 1.0000
// 2.0000
// 3.0000
// 4.0000
// 5.0000
// 6.0000
// 7.0000
// 8.0000
array b = seq(0, 2);
b = pow2(b);
//b = 1.0000
// 2.0000
// 4.0000
array out = convolve(a,b);
//out = 4.0000 (0*4)+(1*2)+(2*1)
// 11.0000 (1*4)+(2*2)+(3*1)
// 18.0000 (2*4)+(3*2)+(4*1)
// 25.0000 ...
// 32.0000
// 39.0000
// 46.0000
// 44.0000

Note that pixels that are outside an image or data points that are outside the domain of a signal are treated as zero.

Function Documentation

afError af_conv_SS ( float *  d_out,
unsigned  ni,
const float *  d_in,
unsigned  batchi,
unsigned  nf,
const float *  d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, real input, real filter, one dimensional convolution.

Parameters
[out]d_outThe convolved output
[in]niSize of input signal
[in]d_inInput signal
[in]batchiNumber of input signal tiles
[in]nfSize of input filter
[in]d_filtInput filter
[in]batchfNumber of input signal tiles
[in]expandperform expanded convolution if true.
afError af_conv_CS ( cfloat d_out,
unsigned  ni,
const cfloat d_in,
unsigned  batchi,
unsigned  nf,
const float *  d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, complex input, real filter, one dimensional convolution.

afError af_conv_CC ( cfloat d_out,
unsigned  ni,
const cfloat d_in,
unsigned  batchi,
unsigned  nf,
const cfloat d_filt,
unsigned  batchf,
bool  expand 
)

Float precision, complex input, complex filter, one dimensional convolution.

afError af_conv_DD ( double *  d_out,
unsigned  ni,
const double *  d_in,
unsigned  batchi,
unsigned  nf,
const double *  d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, real input, real filter, one dimensional convolution.

afError af_conv_ZD ( cdouble d_out,
unsigned  ni,
const cdouble d_in,
unsigned  batchi,
unsigned  nf,
const double *  d_filt,
unsigned  batchf,
bool  expand 
)

Double precision, complex input, real filter, one dimensional convolution.

afError af_conv_ZZ ( cdouble d_out,
unsigned  ni,
const cdouble d_in,
unsigned  batchi,
unsigned  nf,
const cdouble d_filt,
unsigned  batchf,
bool  expand 
)

Double precision, complex input, complex filter, one dimensional convolution.

afError af_conv2_SS ( float *  d_out,
unsigned  mi,
unsigned  ni,
const float *  d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const float *  d_filt,
unsigned  batch_filt,
bool  expand 
)
Parameters
[out]d_outThe convolved output
[in]miRows in input signal
[in]niColumns in input signal
[in]d_inInput signal
[in]batch_inNumber of input signal tiles
[in]mfRows in the input filter
[in]nfColumns in the input filter
[in]d_filtInput filter
[in]batch_filtNumber of input signal tiles
[in]expandperform expanded convolution if true.Single precision, real input, real filter, two dimensional convolution
afError af_conv2_CS ( cfloat d_out,
unsigned  mi,
unsigned  ni,
const cfloat d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const float *  d_filt,
unsigned  batch_filt,
bool  expand 
)

Single precision, complex input, real filter, two dimensional convolution.

afError af_conv2_CC ( cfloat d_out,
unsigned  mi,
unsigned  ni,
const cfloat d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const cfloat d_filt,
unsigned  batch_filt,
bool  expand 
)

Single precision, complex input, complex filter, two dimensional convolution.

afError af_conv2_DD ( double *  d_out,
unsigned  mi,
unsigned  ni,
const double *  d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const double *  d_filt,
unsigned  batch_filt,
bool  expand 
)

Double precision, real input, real filter, two dimensional convolution.

afError af_conv2_ZD ( cdouble d_out,
unsigned  mi,
unsigned  ni,
const cdouble d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const double *  d_filt,
unsigned  batch_filt,
bool  expand 
)

Double precision, complex input, real filter, two dimensional convolution.

afError af_conv2_ZZ ( cdouble d_out,
unsigned  mi,
unsigned  ni,
const cdouble d_in,
unsigned  batch_in,
unsigned  mf,
unsigned  nf,
const cdouble d_filt,
unsigned  batch_filt,
bool  expand 
)

Double precision, complex input, complex filter, two dimensional convolution.

afError af_convn_SS ( float *  d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const float *  d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const float *  d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, real input, real filter, multi-dimensional convolution.

Parameters
[out]d_outThe convolved output
[in]ndimsiNumber of dimensions in input signal
[in]dimsiDimensions of input signal
[in]d_inInput signal
[in]batchiNumber of input signal tiles
[in]ndimsfNumber of dimensions in input filter
[in]dimsfDimensions of input filter
[in]d_filtInput filter
[in]batchfNumber of input signal tiles
[in]expandperform expanded convolution if true.
afError af_convn_CS ( cfloat d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cfloat d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const float *  d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, complex input, real filter, multi-dimensional convolution.

afError af_convn_CC ( cfloat d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cfloat d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const cfloat d_filt,
unsigned  batchf,
bool  expand 
)

Single precision, complex input, complex filter, multi-dimensional convolution.

afError af_convn_DD ( double *  d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const double *  d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const double *  d_filt,
unsigned  batchf,
bool  expand 
)

Double precision, real input, real filter, multi-dimensional convolution.

afError af_convn_ZD ( cdouble d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cdouble d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const double *  d_filt,
unsigned  batchf,
bool  expand 
)

Double precision, complex input, real filter, multi-dimensional convolution.

afError af_convn_ZZ ( cdouble d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cdouble d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const cdouble d_filt,
unsigned  batchf,
bool  expand 
)

Double precision, complex input, complex filter, multi-dimensional convolution.

afError af_convh_SS ( float *  d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const float *  d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const float *  h_filt,
unsigned  batchf,
bool  expand 
)

Single precision, real input, real filter, multi-dimensional convolution.

afError af_convh_CS ( cfloat d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cfloat d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const float *  h_filt,
unsigned  batchf,
bool  expand 
)

Single precision, complex input, real filter, multi-dimensional convolution.

afError af_convh_DD ( double *  d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const double *  d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const double *  h_filt,
unsigned  batchf,
bool  expand 
)

Double precision, real input, real filter, multi-dimensional convolution.

afError af_convh_ZD ( cdouble d_out,
unsigned  ndimsi,
unsigned *  dimsi,
const cdouble d_in,
unsigned  batchi,
unsigned  ndimsf,
unsigned *  dimsf,
const double *  h_filt,
unsigned  batchf,
bool  expand 
)

Double precision, complex input, real filter, multi-dimensional convolution.