Syntax C/C++  #include <VFstd.h>
void VF_filter(fVector Y, fVector X, fVector Flt, ui size ); 
C++ VecObj  #include <OptiVec.h>
void vector<T>::filter( const vector<T>& X, const vector<T>& Flt ); 
Pascal/Delphi  uses VFstd;
procedure VF_filter( Y, X, Flt:fVector; size:UIntSize ); 

Description  A frequency filter Flt is applied to the vector X. Internally, this is done by performing a Fourier transform on X, multiplying the transform with Flt and transforming the product back into the time domain.
Complex versions: X, Y and the filter Flt are complex vectors.
Real versions: X and Y are real. Flt has to be in the packed complex format that is obtained by Fourier transforming a real vector with VF_FFT (see that function for the description of the packed complex format) or by using VF_convolve.
For purely real filter functions known analytically, construct your filter by first evaluating it for a real vector of size/2+1 elements, and subsequently copy this real vector into Flt, as in the following example (f_{Nyquist} = 0.5 / sampling_interval; the desired cutoff frequency is f_{CutOff}): 
Example C/C++:  float Coeffs[3] = {1.0, 1.4142135, 1.0};
fVector Flt = VF_vector0( size );
fVector RealFlt = VF_vector( size/2+1 );
fVector Freq = VF_vector( size/2+1 );
VF_ramp( Freq, size/2+1, 0, (fNyquist / fCutOff) / (size/2) );
/* reduced frequencies from 0 to fNyquist / fCutOff */
VF_poly( RealFlt, Freq, size/2+1, Coeffs, 2 );
VF_inv( RealFlt, RealFlt, size/2+1 );
/* calc. response from coeffs of this 2nd order filter */
VF_RetoC( (cfVector)Flt, RealFlt, size/2 );
/* the imaginary elements remain 0 */
Flt[1] = RealFlt[ size/2 ]; /* response at Nyquist frequency */
VF_filter( Y, X, Flt, size ); /* apply the just constructed filter */ 
The same example for Pascal/Delphi:  const Coeffs: array[0..2] of Single = (1.0, 1.4142135, 1.0);
var Flt, RealFlt, Freq: fVector;
size_2: UIntSize;
begin
...
size_2 := size div 2;
Flt := VF_vector0( size );
RealFlt := VF_vector( size_2+1 );
Freq := VF_vector( size_2+1 );
VF_ramp( Freq, size_2+1, 0, (fNyquist / fCutOff) / (size_2) );
(* reduced frequencies from 0 to fNyquist / fCutOff *)
VF_poly( RealFlt, Freq, size_2+1, @Coeffs, 2 );
VF_inv( RealFlt, RealFlt, size_2+1 );
(* calc. response from coeffs of this 2nd order filter *)
VF_RetoC( cfVector(Flt), RealFlt, size_2 );
(* the imaginary elements remain 0 *)
VF_Pelement( Flt, 1 )^ := VF_element( RealFlt, size_2 );
(* response at Nyquist frequency *)
VF_filter( Y, X, Flt, size ); (* apply the just constructed filter *)
end;
If X is nonperiodic, both ends of the filtered function may be spoiled by wraparound. See VF_convolve about how to avoid endeffects by embedding X in a larger vector or by removing a possible linear trend.

