|Description|| The convolution of MX with the response function MRsp is calculated and stored in MY. A filter MFlt is also calculated. If more than one matrix is to be convolved with the same MRsp, use MF_convolve only once and use MF_filter for the other matrices.
The response has to be stored in MRsp in wrap-around order in both dimensions: in each row i of MRsp, the response for zero and positive x-values is stored in MRspi,0 to MRspi,len/2 and the response for negative x-values (beginning with the most negative x) in MRspi,len/2+1 to MRspi,len-1.
Similarly, in each column of MRsp, the response for zero and positive y-values is stored in MRsp0,j to MRsplen/2,j and the response for negative y-values (beginning with the most negative y) in MRsplen/2+1,j to MRsplen-1,j.
You may wish to use MF_Rows_rotate and MF_Cols_rotate, or MF_Rows_reflect and MF_Cols_reflect to achieve this wrap-around order and to construct the response matrix.
The result of the convolution appears scaled with the sum of all elements of MRsp. Normally, therefore, MRsp should be normalized to 1.0.
MX, MY, MRsp, and MFlt must all be of the same dimensions. Both len and ht have to be integer powers of 2. MX may be overwritten by MY, MRsp may be overwritten by MFlt, but MX and MFlt as well as MY and MRsp have to be distinct from each other.
A response function which attenuates some spatial frequences so much that any information about them is lost (e.g., high frequencies for a low-cut filter) is marked by very small values in MFlt for the respective frequencies. Here, "very small" means that they are in the order of round-off error. In order to minimize round-off error, MF_convolve replaces such small values in Flt by 0.
All one- and two-dimensional convolutions and deconvolutions use the same default threshold for this implicit filter editing. It can be retrieved by VF_setRspEdit. If you wish to set a different threshold for all calls to VF / MF_convolve and VF / MF_deconvolve, you may use VF_setRspEdit. However, this method is not thread-safe and should not be used to set different thresholds for different calls to VF / MF_convolve or VF / MF_deconvolve. Here, you have to use the variant MF_convolvewEdit, which takes the desired threshold as the argument thresh (and ignores the default threshold). As MFlt consists of complex numbers, and as it is sometimes desirable to treat real and imaginary parts differently, thresh is complex as well.
The input matrix is assumed to be periodic in both dimensions. See the description of VF_convolve on how to avoid end effects, in case it is not periodic.