If a can be expressed as the convolution of an unknown vector c with b, S3L_deconv deconvolves the vector b out of a. The result, which is returned in c, is such that conv(c,b)=a.
In the general case, c will only represent the quotient of the polynomial division of a by b.
The remainder of that division can be obtained by explicitly convolving with b and subtracting the result from a.
If ma, mb, and mc are the lengths of a, b, and c respectively, ma must be at least equal to mb. The length of mc will be such that mc+mb-1=ma or, equivalently, mc=ma-mb+1.
S3L_deconv is most efficient when all arrays have the same length and when this length is such that it can be computed efficiently by S3L_fft or S3L_rc_fft. See "S3L_fft " and "S3L_rc_fft and S3L_cr_fft " for additional information.
The dimensions of the array c must be such that the 1D or 2D complex-to-complex FFT or real-to-complex FFT can be computed.
The results of the deconvolution are scaled according to the underlying FFT that is used. In particular, for multiple processes, if a and b are real 1D, the result is scaled by n/2, where n is the length of c. For single processes, it is scaled and by n. In all other cases, the result is scaled by the product of the extents of c.
Because a and b are used internally for auxiliary storage, they may be destroyed after the deconvolution calculation is complete. If a and b must be used after the deconvolution, they should first be copied to temporary arrays.
The C and Fortran syntax for S3L_deconv are shown below.
#include <s3l/s3l-c.h> #include <s3l/s3l_errno-c.h> int S3L_deconv(a, b, c, setup_id) S3L_array_t a S3L_array_t b S3L_array_t c int *setup_id |
include `s3l/s3l-f.h' include `s3l/s3l_errno-f.h' subroutine S3L_deconv(a, b, c, setup_id, ier) integer*8 a integer*8 b integer*8 c integer*4 setup_id integer*4 ier |
where <type> is real*4 or real*8 for both C/C++ and F77/F90.
a - S3L array handle describing a parallel array that contains the convolution of an unknown vector c with b. Its length must be at least ma+mb-1 (1D case) or ma+mb-1 x na+nb-1 (2D case).
b - S3L array handle describing the parallel array that contains the vector.
setup_id - Valid convolution setup ID as returned from a previous call to S3L_deconv_setup.
This function uses the following arguments for output:
c - S3L array handle describing a parallel array. Its length must be at least ma+mb-1 (1D case) or ma+mb-1 x na+nb-1 (2D case). Upon successful completion, the results of deconvolving a will be stored in c.
ier (Fortran only) - When called from a Fortran program, this function returns error status in ier.
On success, S3L_deconv returns S3L_SUCCESS.
S3L_deconv performs generic checking of the arrays it accepts as arguments. If an array argument contains an invalid or corrupted value, the function terminates and an error code indicating which value of the array handle was invalid is returned. See Appendix A of this manual for a detailed list of these error codes.
In addition, the following conditions cause the function to terminate and return one of the following codes:
S3L_ERR_MATCH_DTYPE - a, b, and c do not have the same data type.
S3L_ERR_MATCH_RANK - a, b, and c do not have the same rank.
S3L_ERR_ARG_RANK - The rank of an array argument is larger than 2.
S3L_ERR_ARG_DTYPE - The data type of one of the array arguments is invalid. It must be one of:
S3L_float
S3L_double
S3L_complex
S3L_double_complex
S3L_ERR_ARG_EXTENTS - The extents of c are smaller than two times the sum of the corresponding extents of a and b minus 1.
In addition, since S3L_fft or S3L_rc_fft is used internally to compute the deconvolution, if the dimensions of c are not appropriate for using S3L_fft or S3L_rc_fft, an error code indicating the unsuitability is returned. See "S3L_fft " and "S3L_rc_fft and S3L_cr_fft " for more details.
../examples/s3l/deconv/ex_deconv.c ../examples/s3l/deconv-f/ex_deconv.f
S3L_deconv_setup(3) S3L_deconv_free_setup(3)