VF_setRspEditVD_setRspEditVE_setRspEdit
FunctionModify the treatment of round-off errors in VF_convolve and VF_deconvolve
Syntax C/C++#include <VFstd.h>
void VF_setRspEdit( fComplex Trunc );
C++ VecObj#include <OptiVec.h>
void vector<T>::setRspEdit( const complex<T>& Trunc );
Pascal/Delphiuses VFstd;
procedure VF_setRspEdit( Trunc:fComplex );
CUDA function C/C++#include <cudaVFstd.h>
void cudaVF_setRspEdit( fComplex Trunc );
CUDA function Pascal/Delphiuses VFstd;
procedure cudaVF_setRspEdit( Trunc:fComplex );
DescriptionIn the functions VF_convolve and VF_deconvolve, a frequency filter is calculated by Fourier-transforming a given response function. The filter is then applied to a vector. Due to accumulated round-off, filter elements that should be zero may be not so, but contain small non-zero numbers.

The maximum round-off error in the construction of Flt accumulates roughly to (size * big * prec), where big is the largest element of Flt and prec the relative floating-point precision. Any element smaller than that should be regarded as zero. In order to determine the exact threshold for the real and imaginary parts separately, the function uses the real and imaginary parts of Trunc, substituting them for prec in the above expression. Normally, you would choose
Trunc.Re = Trunc.Im, although a stricter (i.e. larger) value for Trunc.Im is also reasonable. Both Trunc.Re and Trunc.Im must be < 1.0; otherwise an error message "Invalid Parameter(s)" is generated and the program terminated.

By default, Trunc.Re = 16*EPSILON and Trunc.Im = 32*EPSILON, where EPSILON is the relative floating-point accuracy of the respective data type. (For C/C++, EPSILON is FLT_EPSILON,  DBL_EPSILON, or LDBL_EPSILON, as defined in <float.h>).

In order to switch the editing of the filter completely off, choose Trunc.Re = Trunc.Im = 0.

During convolutions, the editing of the filter leads to slightly smoother results. During deconvolutions, the editing has also another meaning: for all "lost" frequencies (i.e., those for which the Fourier transform of the response function contains only numbers near zero), the filter is set to 0 instead of the inverse of these small numbers. Thereby, possible OVERFLOW and SING errors are avoided.

To read the currently set threshold, call VF_getRspEdit.

Error handlingIf either Trunc.Re or Trunc.Im (or both) are ≥ 1.0, an error message "Invalid Parameter(s)" is generated and the program terminated.
Return valuenone
See alsoVF_convolve,   VF_deconvolve,   VF_getRspEdit

VectorLib Table of Contents  OptiVec home