convn_fast

PURPOSE ^

Fast convolution, replacement for both conv2 and convn.

SYNOPSIS ^

function C = convn_fast( A, B, shape )

DESCRIPTION ^

 Fast convolution, replacement for both conv2 and convn. 

 See conv2 or convn for more information on convolution in general.

 This works as a replacement for both conv2 and convn.  Basically, performs convolution
 in either the frequency or spatial domain, depending on which it thinks will be faster
 (see below). In general, if A is much bigger then B then spatial convolution will be
 faster, but if B is of similar size to A and both are fairly big (such as in the case of
 correlation), convolution as multiplication in the frequency domain will tend to be
 faster.  

 The shape flag can take on 1 additional value which is 'smooth'.  This flag is intended
 for use with smoothing kernels.  The returned matrix C is the same size as A with
 boundary effects handled in a special manner.  That is instead of A being zero padded
 before being convolved with B; near the boundaries a cropped version of the matrix B is
 used, and the results is scaled by the fraction of the weight found in  the cropped
 version of B.  In this case each dimension of B must be odd, and all elements of B must
 be positive.  There are other restrictions on when this flag can be used, and in
 general it is only useful for smoothing kernels.  For 2D filtering it does not have much
 overhead, for 3D it has more and for higher dimensions much much more.

 For optimal performance some timing constants must be set to choose between doing
 convolution in the spatial and frequency domains, for more info see time_conv below.

 INPUTS
   A       - d dimensional input matrix 
   B       - d dimensional matrix to convolve with A 
   shape   - [optional] 'valid', ['full'], 'same', or 'smooth'

 OUTPUS:
   C       - result of convolution

 DATESTAMP
   29-Sep-2005  2:00pm

 See also CONV2, CONVN

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003