OptiVec

Version 3


for C/C++ and for Pascal/Delphi

OptiCode
Dr. Martin Sander Software Development
Steinachstr. 9A
D-69198 Schriesheim
Germany
http://www.optivec.com
e-mail: support@optivec.com or
sales@optivec.com

Part I. B: Function Reference
for VectorLib


A general description of OptiVec is given in HANDBOOK.HTM.
For MatrixLib functions, see MATRIX.HTM, for CMATH functions, see CMATH.HTM.
Chapter 1.2 of HANDBOOK.HTM contains the licence terms for the Shareware version, Chapter 1.3 for the Registered version.


8. Alphabetical Reference of Vector Functions

The functions are alphabetically ordered, with the prefixes being neglected for the ordering. The heading of each entry lists all the versions available for a specific function:

VF_exampleVD_exampleVE_example
VCF_exampleVCD_exampleVCE_example
FunctionConsider, e.g., the "abs" family of functions. It exists in vectorized versions for
  • the three real-number data types float, double, and extended (long double) with the prefixes VF_,   VD_, and VE_,
  • for the three cartesian complex-number data types (prefixes VCF_,   VCD_, and VCE_),
  • for the three polar complex-number data types (prefixes VPF_,   VPD_, and VPE_),
  • and for the signed integer data types int, byte, short int, long int, and quad (prefixes VI_,   VBI_,   VSI_,   VLI_, and VQI_);
unsigned numbers are, by their very definition, always positive, and it makes no sense to define the operation "abs" for them; consequently, the VU_,   VUB_,   VUS_,   VUL_, and VUI_ versions are missing.
Syntax C/C++In most cases, only the VF_ version is described. All other versions are exactly analogous; one has only to replace the data types float and fVector by the appropriate ones and replace the VF... include file by the one belonging to the desired data type.
C++ VecObjHere, the syntax of the object-oriented interface is described
Pascal/DelphiSimilarly to the description of the C/C++ syntax, again only the VF_ version is described. Replace the data types float and fVector by the appropriate ones and include the unit belonging to the desired data type into the "uses" clause.
DescriptionOften, for the sake of simplicity, the brackets around vector element indices are left away. If not stated otherwise, all vector elements from the zero'th up to the last one (with the index size-1) are subjected to the respective operation described. Thus, a formula like
      Yi = | Xi |
is to be understood as an abbreviation for
      Y[i] = | X[i] |, i=0,...,size-1
or, written as a loop:
      for( i=0; i<size; i++ ) Y[i] = fabs( X[i] );
Error handlingAll types of errors are listed which are detected and handled. The default result is given in each case.
C/C++ only:
In case of any detected floating-point errors, _matherr or _matherrl are called (see chapter 5.3). Although we do not recommend that, the user may modify _matherr and _matherrl such as to specify other results than those suggested.
Return valueThe return value of the respective function is mentioned here.
See alsoReferences to functions without a prefix "V..." refer to the documentation of your C/C++ or Pascal/Delphi compiler. References to chapters 1. to 7. refer to the file HANDBOOK.HTM.

 

VF_absVD_absVE_abs
VCF_absVCD_absVCE_abs
VPF_absVPD_absVPE_abs
VI_absVBI_absVSI_absVLI_absVQI_abs
FunctionAbsolute value
Syntax C/C++#include <VFmath.h>
int VF_abs( fVector Y, fVector X, ui size );

    (similarly VD_,   VE_,   VBI_,   VSI_,   VI_,   VLI_,   VQI_)
int VCF_abs( fVector Y, cfVector X, ui size );
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
int vector<T>::abs( const vector<T>& X );
int vector<T>::abs( const vector<complex<T>>& X );
Pascal/Delphiuses VFmath;
function VF_abs( Y, X:fVector; size:UInt ): IntBool;

    (similarly VD_,   VE_,   VSI_,   VI_,   VLI_,   VQI_)
function VCF_abs( Y:fVector; X:cfVector; size:UInt ): IntBool;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
DescriptionReal and integer versions: Yi = | Xi |
VBI_,   VSI_,   VI_, and VLI_ versions only: due to the implicit modulo-2n arithmetics, the absolute value of the most negative numbers possible ( -32768 for short/SmallInt, -2147483648 for long/LongInt) is stored as the same negative (!) number (-32768 or -2147483648, resp.).
Complex versions: Yi = sqrt( Xi.Re2 + Xi.Im2 )
For the complex versions, note that the result is real-valued. For the cartesian complex functions (VC?_abs), the same result may also be obtained slightly
faster, but without error handling, using VF_CtoAbs.
Error handlingReal and integer versions: no errors should occur;
Complex versions: OVERFLOW errors lead to the default result +HUGE_VAL.
Return valueFloating-point versions: FALSE (0), if error-free, otherwise TRUE (!= 0).
The integer versions have no return value.
See alsoVF_neg,   VCF_conj

 

VF_absmaxVD_absmaxVE_absmax
VCF_absmaxVCD_absmaxVCE_absmax
VPF_absmaxVPD_absmaxVPE_absmax
FunctionLargest absolute value within one vector
Syntax C/C++#include <VFstd.h>
float VF_absmax( fVector X, ui size );

    (similarly VD_,   VE_)
float VCF_absmax( cfVector X, ui size);
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
T vector<T>::absmax();
T vector<complex<T>>::absmax();
Pascal/Delphiuses VFstd;
function VF_absmax( X:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
function VCF_absmax( X:cfVector; size:UInt ): Single;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
DescriptionThe absolute values of all elements of a vector are compared and the largest returned.
For complex numbers, the magnitudes of the elements are compared and the largest magnitude is returned. If you need the complex number itself rather than only its magnitude, use VCF_cabsmax. In order to find the greatest real and imaginary parts of cartesian complex vectors separately, call VCF_absmaxReIm.
Error handlingnone
Return valuemaximum absolute value encountered.
See alsoVF_max,   VF_absmin,   VF_maxexp,   VF_runmax,   VF_absmaxind,   VCF_absmaxReIm,   VCF_cabsmax,   VCF_sabsmax

 

VF_absmaxindVD_absmaxindVE_absmaxind
VCF_absmaxindVCD_absmaxindVCE_absmaxind
VPF_absmaxindVPD_absmaxindVPE_absmaxind
FunctionLargest absolute value and its index
Syntax C/C++#include <VFstd.h>
float VF_absmaxind( ui *Ind, fVector X, ui size );

    (similarly VD_,   VE_)
float VCF_absmaxind( ui *Ind, cfVector X, ui size );
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
T vector<T>::absmaxind( ui *Ind );
T vector<complex<T>>::absmaxind( ui *Ind );
Pascal/Delphiuses VFstd;
function VF_absmaxind( var Ind:UInt; X:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
function VCF_absmaxind( var Ind:UInt; X:cfVector; size:UInt ): Single;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
DescriptionThe absolute values of all elements of a vector are compared and the largest returned. For complex numbers, the magnitudes of the elements are compared and the largest returned. The index of this maximum is stored at the address given by Ind. In case of more than one element with the same maximum value, the lowest index is chosen.
Error handlingnone
Return valuemaximum absolute value encountered.
See alsoVF_maxind,   VF_absmax,   VF_runmax,   VF_maxind,   VCF_absmaxReIm

 

VCF_absmaxReImVCD_absmaxReImVCE_absmaxReIm
FunctionSeparate determination of the largest absolute values of the real and imaginary parts occurring in a cartesian complex vector.
Syntax C/C++#include <VCFstd.h>
fComplex VCF_absmaxReIm( cfVector X, ui size );

    (similarly VCD_,   VCE_)
C++ VecObj#include <OptiVec.h>
complex<T> vector<complex<T>>::absmaxReIm();
Pascal/Delphiuses VCFstd;
procedure VCF_absmaxReIm( var Max:fComplex; X:cfVector; size:UInt );

    (similarly VCD_,   VCE_)
DescriptionThe absolute values of the real parts of all vector elements are compared with each other and the largest one is returned as the real part of the result. Similarly, the absolute values of all the imaginary parts are compared with each other and the largest one is returned as the imaginary part of the result. Generally, the result is made up from different elements of the vector.
Error handlingnone
Return valueC/C++: Largest absolute real and imaginary parts, combined into one complex number.
Pascal/Delphi: none.
See alsoVCF_maxReIm,   VCF_absminReIm

 

VF_absminVD_absminVE_absmin
VCF_absminVCD_absminVCE_absmin
VPF_absminVPD_absminVPE_absmin
FunctionSmallest absolute value within one vector
Syntax C/C++#include <VFstd.h>
float VF_absmin( fVector X, ui size );

    (similarly VD_,   VE_)
float VCF_absmin( cfVector X, ui size );
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
T vector<T>::absmin();
T vector<complex<T>>::absmin();
Pascal/Delphiuses VFstd;
function VF_absmin( X:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
function VCF_absmin( X:cfVector; size:UInt ): Single;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
DescriptionThe absolute values of all elements of a vector are compared and the smallest returned.
For complex numbers, the magnitudes of the elements are compared and the smallest magnitude is returned. If you need the complex number itself rather than only its magnitude, call VCF_cabsmin. In order to find the smallest real and imaginary parts of cartesian complex vectors separately, please use VCF_absminReIm.
Error handlingnone
Return valueminimum absolute value encountered.
See alsoVF_min,   VF_absmax,   VF_minexp,   VF_runmin,   VF_minind,   VCF_absminReIm,   VCF_cabsmin,   VCF_sabsmin

 

VF_absminindVD_absminindVE_absminind
VCF_absminindVCD_absminindVCE_absminind
VPF_absminindVPD_absminindVPE_absminind
FunctionSmallest absolute value and the index of its first occurrence.
Syntax C/C++#include <VFstd.h>
float VF_absminind( ui *Ind, fVector X, ui size );

    (similarly VD_,   VE_)
float VCF_absminind( ui *Ind, cfVector X, ui size );
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
T vector<T>::absminind( ui *Ind );
T vector<complex<T>>::absminind( ui *Ind );
Pascal/Delphiuses VFstd;
function VF_absminind( var Ind:UInt; X:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
function VCF_absminind( var Ind:UInt; X:cfVector; size:UInt ): Single;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
DescriptionThe absolute values of all elements of a vector are compared and the smallest returned. For complex numbers, the magnitudes of the elements are compared and the smallest returned. The index of this minimum is stored at the address given by Ind. In case of more than one element with the same minimum value, the lowest index is chosen.
Error handlingnone
Return valueminimum absolute value encountered.
See alsoVF_minind,   VF_absmin,   VF_runmin,   VF_maxind,   VCF_absminReIm

 

VCF_absminReImVCD_absminReImVCE_absminReIm
FunctionSeparate determination of the smallest absolute values of the real and imaginary parts occurring in a cartesian complex vector.
Syntax C/C++#include <VCFstd.h>
fComplex VCF_absminReIm( cfVector X, ui size );

    (similarly VCD_,   VCE_)
C++ VecObj#include <OptiVec.h>
complex<T> vector<complex<T>>::absminReIm();
Pascal/Delphiuses VCFstd;
procedure VCF_absminReIm( var Min:fComplex; X:cfVector; size:UInt );

    (similarly VCD_,   VCE_)
DescriptionThe absolute values of the real parts of all vector elements are compared with each other and the smallest one is returned as the real part of the result. Similarly, the absolute values of all the imaginary parts are compared with each other and the smallest one is returned as the imaginary part of the result. Generally, the result is made up from different elements of the vector.
Error handlingnone
Return valueC/C++: Smallest absolute real and imaginary parts, combined into one complex number.
Pascal/Delphi: none
See alsoVCF_minReIm,   VCF_absmaxReIm

 

VF_accVVD_accVVE_accV
VCF_accVVCD_accVVCE_accV
VI_accVVBI_accVVSI_accVVLI_accVVQI_accV
VU_accVVUB_accVVUS_accVVUL_accVVUI_accV
mixed-type versions:
VD_accVFVE_accVFVE_accVD
VCD_accVCFVCE_accVCFVCE_accVCD
VSI_accVBI
VI_accVBIVI_accVSI
VLI_accVBIVLI_accVSIVLI_accVI
VUS_accVUB
VU_accVUBVU_accVUS
VUL_accVUBVUL_accVUSVUL_accVU
VUI_accVUBVUI_accVUSVUI_accVUVUI_accVUL
VQI_accVBIVQI_accVSIVQI_accVIVQI_accVLI
VQI_accVUBVQI_accVUSVQI_accVUVQI_accVULVQI_accVUI
VF_...VD_...VE_...
        ...accVI        ...accVBI        ...accVSI        ...accVLI        ...accVQI
        ...accVU        ...accVUB        ...accVUS        ...accVUL        ...accVUI
FunctionAccumulation (corresponds to the += operator)
Syntax C/C++#include <VFmath.h>
void VF_accV( fVector Y, fVector X, ui size );
void VD_accVF( dVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::accV( const vector<T>& X );
void vector<double>::accVF( const vector<float>& X );
Pascal/Delphiuses VFmath;
procedure VF_accV( Y, X:fVector; size:UInt );
procedure VD_accVF( Y:dVector; X:fVector; size:UInt );
DescriptionYi += Xi
This family of functions consists of two groups. The first group is made up of the normal, same-type versions, like VF_accV.
The much larger second group allows to add a lower-accuracy type vector to a higher-accuracy type vector, like VD_accVF. For the integer types, only the highest one, quad, is used to accumulate both signed and unsigned types. The 16-bit and 32-bit integer types can accumulate only the lower types of the same sort, signed or unsigned. All integer types can be accumulated in any of the three floating-point types.
Error handlingnone
Return valuenone
See alsoVF_acc2V,   VF_addV

 

VF_acc2VVD_acc2VVE_acc2V
mixed-type versions:
VD_acc2VFVE_acc2VFVE_acc2VD
FunctionAccumulation (corresponds to the += operator) of two vectors at once
Syntax C/C++#include <VFmath.h>
void VF_acc2V( fVector Y, fVector X1, fVector X2, ui size );
void VD_accVF( dVector Y, fVector X1, fVector X2, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::acc2V( const vector<T>& X1, const vector<T>& X2 );
void vector<double>::acc2VF( const vector<float>& X1, const vector<float>& X2 );
Pascal/Delphiuses VFmath;
procedure VF_acc2V( Y, X1, X2:fVector; size:UInt );
procedure VD_acc2VF( Y:dVector; X1, X2:fVector; size:UInt );
DescriptionYi += X1i + X2i
Error handlingnone
Return valuenone
See alsoVF_accV,   VF_add2V

 

VF_acosVD_acosVE_acos
VCF_acosVCD_acosVCE_acos
VFx_acosVDx_acosVEx_acos
VCFx_acosVCDx_acosVCEx_acos
Functionarcus cosinus function
Syntax C/C++#include <VFmath.h>
int VF_acos( fVector Y, fVector X, ui size );
int VFx_acos( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::acos( const vector<T>& X );
int vector<T>::x_acos( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_acos( Y, X:fVector; size:UInt ): IntBool;
function VFx_acos( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = arccos ( Xi )
expanded versions: Yi = C * arccos (A*Xi + B )
Error handlingReal versions: DOMAIN errors occur for arguments outside the range -1 <= Xi <= +1; the default result is NAN ("not-a-number").
The complex versions should be error-proof as long as the parameter C in the expanded versions is not already near the OVERFLOW limit; this very rare error is neither detected nor handled.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cos,   VF_asin,   VF_atan,   acos

 

VF_addCVD_addCVE_addC
VCF_addCVCD_addCVCE_addC
VCF_addReCVCD_addReCVCE_addReC
VI_addCVBI_addCVSI_addCVLI_addCVQI_addC
VU_addCVUB_addCVUS_addCVUL_addCVUI_addC
FunctionAdd a constant to a vector
Syntax C/C++#include <VFmath.h>
void VF_addC( fVector Y, fVector X, ui size, float C);

    (similarly VD_,   VI_, etc.)
void VCF_addC( cfVector Y, cfVector X, ui size, fComplex C );
void VCF_addReC( cfVector Y, cfVector X, ui size, float CRe );

    (similarly VCD_,   VCE_)
C++ VecObj#include <OptiVec.h>
void vector<T>::addC( const vector<T>& X, const T& C); );
void vector<complex<T>>::addC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::addReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_addC( Y, X:fVector; size:UInt; C:Single );

    (similarly VD_,   VI_, etc.)
procedure VCF_addC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCF_addReC( Y, X:cfVector; size:UInt; CRe:Single );

    (similarly VCD_,   VCE_)
DescriptionYi = Xi + C
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe added to the complex vector.
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_addV,   VF_subC,   VF_mulC,   VF_divC,   VF_visC,   VF_redC

 

VF_addVVD_addVVE_addV
VCF_addVVCD_addVVCE_addV
VCF_addReVVCD_addReVVCE_addReV
VFs_addVVDs_addVVEs_addV
VFx_addVVDx_addVVEx_addV
VCFx_addVVCDx_addVVCEx_addV
VCFx_addReVVCDx_addReVVCEx_addReV
VI_addVVBI_addVVSI_addVVLI_addVVQI_addV
VU_addVVUB_addVVUS_addVVUL_addVVUI_addV
FunctionAdd two vectors
Syntax C/C++#include <VFmath.h>
void VF_addV( fVector Z, fVector X, fVector Y,ui size );
void VFs_addV( fVector Z, fVector X, fVector Y, ui size, float C );
void VFx_addV( fVector Z, fVector X, fVector Y, ui size, float A, float B );

    (similarly VD_,   VDx_,   VE_,   VEx_,   VI_, etc.)
void VCF_addV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_addReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCFx_addV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_addReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );

    (similarly VCD_,   VCDx_,   VCE_,   VCEx_)
C++ VecObj#include <OptiVec.h>
void vector<T>::addV( const vector<T>& X, const vector<T>& Y );
void vector<T>::s_addV( const vector<T>& X, const vector<T>& Y, const T& C );
void vector<T>::x_addV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::addV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::addReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::x_addV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_addReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_addV( Z, X, Y:fVector; size:UInt );
procedure VFx_addV( Z, X, Y:fVector; size:UInt; A, B:Single );

    (similarly VD_,   VDx_,   VE_,   VEx_,   VI_, etc.)
procedure VCF_addV( Z, X, Y:cfVector; size:UInt );
procedure VCF_addReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCFx_addV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_addReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );

    (similarly VCD_, VCDx_, VCE_,   VCEx_)
Descriptionnormal versions: Zi = Xi + Yi
scaled versions: Zi = C * (Xi + Yi)
expanded versions: Zi = (A * Xi + B) + Yi
The complex floating-point versions exist in two variants. In the first variant (e.g.VCF_addV,   VCFx_addV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g., VCF_addReV - "add a real vector").
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_addC,   VF_add2V,   VF_subV,   VF_mulV,   VF_divV,   VF_accV,   VF_addVI

 

VF_addVIVD_addVIVE_addVI
VF_addVBIVD_addVBIVE_addVBI
VF_addVSIVD_addVSIVE_addVSI
VF_addVLIVD_addVLIVE_addVLI
VF_addVQIVD_addVQIVE_addVQI
VF_addVUVD_addVUVE_addVU
VF_addVUBVD_addVUBVE_addVUB
VF_addVUSVD_addVUSVE_addVUS
VF_addVULVD_addVULVE_addVUL
VF_addVUIVD_addVUIVE_addVUI
FunctionAdd an integer vector to a floating-point vector
Syntax C/C++#include <VFmath.h>
void VF_addVI( fVector Z, fVector X, iVector Y,ui size );
void VF_addVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::addVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::addVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_addVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_addVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Xi + Yi
Error handlingnone
Return valuenone
See alsoVF_addV,   VF_accV

 

VF_add2VVD_add2VVE_add2V
FunctionAdd three vectors
Syntax C/C++#include <VFmath.h>
void VF_add2V( fVector Z, fVector X, fVector Y1, fVector Y2, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::add2V( const vector<T>& X, const vector<T>& Y1, const vector<T>& Y2 );
Pascal/Delphiuses VFmath;
procedure VF_add2V( Z, X, Y1, Y2:fVector; size:UInt );
DescriptionZi = Xi + Y1i + Y2i
Error handlingnone
Return valuenone
See alsoVF_addV,   VF_sub2V

 

VI_andVSI_andVLI_andVQI_and
VU_andVUS_andVUL_andVUI_and
FunctionBit-wise AND operation.
Syntax C/C++#include <VImath.h>
void VI_and( iVector Y, iVector X, ui size, int C );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::and( const vector<T>& X, const T& C );
Pascal/Delphiuses VImath;
procedure VI_and( Y, X:iVector; size:UInt; C:Integer );

    (similarly all other functions of this family)
DescriptionYi = (Xi) & C
The bit-wise AND operation is performed on each element Xi with the bit-mask given by C. A bit is 1 in Yi, if it was 1 both in Xi and in C, and 0 otherwise. Perhaps the most useful application of this family of functions is the fast "modulo" operation on unsigned or positive numbers with the modulus being an integer power of 2. For example, a modulo division by 64 is performed by
VU_and( Y, X, size, 64-1 );
Error handlingnone
Return valuenone
See alsoVI_not,   VI_or,   VI_xor

 

VCF_argVCD_argVCE_arg
VPF_argVPD_argVPE_arg
FunctionArgument (angle in polar coordinates).
Syntax C/C++#include <VCFstd.h>
void VCF_arg( fVector Arg, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::arg( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VCF_arg( Arg:fVector; X:cfVector; size:UInt );
DescriptionIdentical to VF_CtoArg,   VD_CtoArg,   VE_CtoArg, resp. See these functions for details.

 

VF_ArgtoPVD_ArgtoPVE_ArgtoP
FunctionOverwrite the Arg part of a polar complex vector with a real vector
Syntax C/C++#include <VPFstd.h>
void VF_ArgtoP( pfVector Y, fVector Arg, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::ArgtoP( const vector<T>& Arg );
Pascal/Delphiuses VPFstd;
procedure VF_ArgtoP( X:pfVector; Arg:fVector; size:UInt );
DescriptionThe Arg part of the polar complex vector Y is overwritten with the elements of the real-valued vector Arg. The Mag part of Y is not affected.
Error handlingnone
Return valuenone
See alsoVF_PtoMagArg,   VF_MagArgtoP

 

VF_asinVD_asinVE_asin
VCF_asinVCD_asinVCE_asin
VFx_asinVDx_asinVEx_asin
VCFx_asinVCDx_asinVCEx_asin
Functionarcus sinus function
Syntax C/C++#include <VFmath.h>
int VF_asin( fVector Y, fVector X, ui size );
int VFx_asin( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::asin( const vector<T>& X );
int vector<T>::x_asin( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_asin( Y, X:fVector; size:UInt ): IntBool;
function VFx_asin( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = arcsin ( Xi )
expanded versions: Yi = C * arcsin (A*Xi + B )
Error handlingReal versions: DOMAIN errors occur for arguments outside the range -1 <= Xi <= +1; the default result is NAN ("not-a-number").
The complex versions should be error-proof as long as the parameter C in the expanded versions is not already near the OVERFLOW limit; this very rare error is either detected nor handled.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sin,   VF_acos,   VF_atan,   asin

 

VF_atanVD_atanVE_atan
VCF_atanVCD_atanVCE_atan
VFx_atanVDx_atanVEx_atan
VCFx_atanVCDx_atanVCEx_atan
Functionarcus tangens function
Syntax C/C++#include <VFmath.h>
int VF_atan( fVector Y, fVector X, ui size );
int VFx_atan( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::atan( const vector<T>& X );
int vector<T>::x_atan( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_atan( Y, X:fVector; size:UInt ): IntBool;
function VFx_atan( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = arctan ( Xi )
expanded versions: Yi = C * arctan (A*Xi + B )
Error handlingThe real versions should be error-proof as long as the parameter C in the expanded versions is not already near the OVERFLOW limit; this very rare error is neither detected nor handled.
In the complex versions, the result for an argument of {0, -1} is set to {0, -p} without notice (and without the program crash resulting in Borland C++ from calling the complex atan with this argument).
Return valuealways FALSE (0).
See alsoVF_tan,   VF_asin,   VF_acos,   VF_atan2,   atan,   atan2

 

VF_atan2VD_atan2VE_atan2
VFx_atan2VDx_atan2VEx_atan2
Functionarcus tangens function of quotients
Syntax C/C++#include <VFmath.h>
int VF_atan2( fVector Z, fVector X, fVector Y, ui size );
int VFx_atan2( fVector Z, fVector X, fVector Y, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::atan2( const vector<T>& X, const vector<T>& Y );
int vector<T>::x_atan2( const vector<T>& X, const vector<T>& Y, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_atan2( Z, X, Y:fVector; size:UInt ): IntBool;
function VFx_atan2( Z, X, Y:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Zi = arctan( Yi / Xi )
expanded versions: Zi = C * arctan( Yi / (A*Xi+B) )
From Cartesian X -Y-coordinates, the angle of the corresponding polar coordinates is calculated.
Note: in comparison to the ANSI C function atan2, the ordering of the parameters X and Y is reversed.
Error handlingIf Xi and Yi are both zero, a DOMAIN error results with the default result NAN ("not-a-number").
In C/C++, this error is handled by _matherr and _matherrl with Xi and Yi as e->x and e->y.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_tan,   VF_asin,   VF_acos,   VF_atan,  atan,  atan2

 

VF_autocorrVD_autocorrVE_autocorr
Functionautocorrelation function
Syntax C/C++#include <VFstd.h>
void VF_autocorr( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<float>::autocorr( const vector<float>& Y );
Pascal/Delphiuses VFstd;
procedure VF_autocorr( Y, X:fVector; size:UInt );
DescriptionThe autocorrelation function (ACF) of X is calculated and stored in Y in wrap-around order: Y0 to Ysize/2-1 contain the ACF for zero and positive lags. Beginning with the most negative lag in Ysize/2+1, the elements up to Ysize-1 contain the ACF for negative lags. Since this function assumes X to be periodic, the ACF for the most positive lag is identical to the ACF for the most negative lag. This element is stored as Ysize/2.
To get the ACF into normal order, you may call
VF_rotate( Y, Y, size, size/2 );
After that, the zero point is at the position size/2.

In case X is non-periodic, you should avoid end effects by the methods described in connection with VF_convolve.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_autocorr is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuenone
See alsoVF_FFT,   VF_convolve,   VF_xcorr,   VF_spectrum

 

VCF_autoPlotVCD_autoPlotVCE_autoPlot
FunctionAutomatic plot of a complex vector into a Cartesian complex plane.
Syntax C/C++#include <Vgraph.h>
void VCF_autoPlot( cfVector X, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::autoPlot( unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VCF_autoPlot( X:cfVector; size, form:UInt; color:COLORREF );
DescriptionA Cartesian complex plane is drawn with the axes automatically scaled and the vector X plotted into it. For a description of the parameters form and color, see VF_xyAutoPlot. The plotting routines have to be initialized by V_initGraph or V_initPlot prior to calling VCF_autoPlot.
Error handlingnone
Return valuenone
See alsoVCF_2AutoPlot,   VCF_dataPlot,   VF_xyAutoPlot,  chapter 4.12

 

VCF_2AutoPlotVCD_2AutoPlotVCE_2AutoPlot
FunctionAutomatic plot of two complex vectors into a Cartesian complex plane.
Syntax C/C++#include <Vgraph.h>
void VCF_2AutoPlot( cfVector X1, ui size1, unsigned form1, COLORREF color1, cfVector X2, ui size2, unsigned form2, COLORREF color2 );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::_2AutoPlot( unsigned form1, COLORREF color1, const vector<complex<T>>& X2, unsigned form2, COLORREF color2 );
Pascal/Delphiuses Vgraph;
procedure VCF_2AutoPlot( X1:cfVector; size1, form1:UInt; color1:COLORREF; X2:cfVector; size2, form2:UInt; color2:COLORREF );
DescriptionA Cartesian complex plane is drawn with the axes automatically scaled and the vectors X1 and X2 plotted into it. For a description of the parameters form1, form2, color1, and color2, see VF_xyAutoPlot. The plotting routines have to be initialized by V_initGraph or V_initPlot prior to calling VCF_2AutoPlot.
Note the leading underbar in the VecObj function. (It is necessary, as C/C++ does not allow function names to begin with a number.)
Error handlingnone
Return valuenone
See alsoVCF_autoPlot,   VCF_dataPlot,   VF_xyAutoPlot,  chapter 4.11

 

VF_avdevCVD_avdevCVE_avdevC
Functionaverage deviation from a preset value
Syntax C/C++#include <VFstd.h>
float VF_avdevC( fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
T vector<T>::avdevC( const T& C );
Pascal/Delphiuses VFstd;
function VF_avdevC( X:fVector; size:UInt; C:Single ): Single;
DescriptionavdevC = 1/size * sum( |Xi - C| )
The average of the absolute deviation of each element of X from C is calculated and returned.
Error handlingnone
Return valueaverage deviation.
See alsoVF_ssq,   VF_ssqdevC,   VF_avdevV,   VF_sumdevC,   VF_chiabs

 

VF_avdevVVD_avdevVVE_avdevV
Functionaverage deviation of the elements of one vector from the corresponding elements of another vector.
Syntax C/C++#include <VFstd.h>
float VF_avdevV( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::avdevV( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_avdevV( X, Y:fVector; size:UInt ): Single;
DescriptionavdevV = 1/size * sum( |Xi - Yi| )
The average of the absolute deviation of each element of X from the corresponding element of Y is calculated.
Error handlingnone
Return valueaverage deviation.
See alsoVF_ssq,   VF_ssqdevV,   VF_avdevC,   VF_sumdevV,   VF_chiabs

 

VCF_cabsmaxVCD_cabsmaxVCE_cabsmax
FunctionElement of largest absolute value within one vector
Syntax C/C++#include <VCFstd.h>
fComplex VCF_cabsmax( cfVector X, ui size);
C++ VecObj#include <OptiVec.h>
T vector<complex<T>>::cabsmax();
Pascal/Delphiuses VCFstd;
procedure VCF_cabsmax( var Max:fComplex; X:cfVector; size:UInt );
DescriptionThe absolute values of all elements of a cartesian-complex vector are compared and the element with the largest absolute value is returned. A variant of this function, finding the largest element in terms of the sum |Re| + |Im|, is offered by VCF_sabsmax. The latter function is much faster than VCF_cabsmax.
Error handlingnone
Return valuelargest element in terms of absolute value
See alsoVCF_absmax,   VCF_absmaxReIm,   VCF_sabsmax

 

VCF_cabsminVCD_cabsminVCE_cabsmin
FunctionElement of smallest absolute value within one vector
Syntax C/C++#include <VCFstd.h>
fComplex VCF_cabsmin( cfVector X, ui size);
C++ VecObj#include <OptiVec.h>
T vector<complex<T>>::cabsmin();
Pascal/Delphiuses VCFstd;
procedure VCF_cabsmin( var Min:fComplex; X:cfVector; size:UInt );
DescriptionThe absolute values of all elements of a cartesian-complex vector are compared and the element with the smallest absolute value is returned. A variant of this function, finding the smallest element in terms of the sum |Re| + |Im|, is offered by VCF_sabsmin. The latter function is much faster than VCF_cabsmin.
Error handlingnone
Return valuesmallest element in terms of absolute value
See alsoVCF_absmin,   VCF_absminReIm,   VCF_sabsmin

 

V_CDtoCFV_CDtoCE
V_CEtoCFV_CEtoCD
V_CFtoCDV_CFtoCE
FunctionData type conversions. See V_FtoD.

 

VF_ceilVD_ceilVE_ceil
VF_ceiltoIVD_ceiltoIVE_ceiltoI
VF_ceiltoBIVD_ceiltoBIVE_ceiltoBI
VF_ceiltoSIVD_ceiltoSIVE_ceiltoSI
VF_ceiltoLIVD_ceiltoLIVE_ceiltoLI
VF_ceiltoQIVD_ceiltoQIVE_ceiltoQI
VF_ceiltoUVD_ceiltoUVE_ceiltoU
VF_ceiltoUBVD_ceiltoUBVE_ceiltoUB
VF_ceiltoUSVD_ceiltoUSVE_ceiltoUS
VF_ceiltoULVD_ceiltoULVE_ceiltoUL
VF_ceiltoUIVD_ceiltoUIVE_ceiltoUI
FunctionRounding to the next whole number that is greater or equal.
Syntax C/C++#include <VFmath.h>
int VF_ceil( fVector Y, fVector X, ui size );
int VF_ceiltoI( iVector Y, fVector X, ui size );
int VF_ceiltoLI( liVector Y, fVector X, ui size );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
int vector<T>::ceil( const vector<T>& X );
int vector<int>::ceiltoI( const vector<T>& X );
int vector<long>::ceiltoLI( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_ceil( Y, X:fVector; size:UInt ):IntBool;
function VF_ceiltoI( Y:iVector; X:fVector; size:UInt ): IntBool;
function VF_ceiltoLI( Y:liVector; X:fVector; size:UInt ): IntBool;

    (similarly all other functions of this family)
DescriptionEach element of X is rounded to the nearest whole number that is greater than or equal to the input number and the result stored in Y. The functions VF_ceiltoI,   VF_ceiltoLI,   VF_ceiltoU etc. convert the result into the various integer data types (in the cases mentioned, to int, long int, and unsigned, resp.).
Error handlingOVERFLOW errors are handled by setting the result to the extreme value possible. Negative numbers in the versions VF_ceiltoU,   VF_ceiltoUS,   VF_ceiltoUL, and VF_ceiltoUI lead to DOMAIN errors; they are handled by setting the result to 0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_round,   VF_floor,   VF_chop,   VF_trunc,   ceil,   floor (C/C++ only)

 

VF_chiabsVD_chiabsVE_chiabs
FunctionAbsolute-value analogue of the chi-square merit function.
Syntax C/C++#include <VFstd.h>
float VF_chiabs( fVector X, fVector Y, fVector Wt, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::chiabs( const vector<T>& Y, const vector<T>& Wt );
Pascal/Delphiuses VFstd;
function VF_chiabs( X, Y, Wt:fVector; size:UInt ): Single;
Descriptionchiabs = sum( Wti * |Xi - Yi| ).
The chiabs function is a "robust" replacement for the c2 (chi-square) merit function. It is used to judge the quality of a fit in the presence of outlier points. The chiabs function is disturbed by outlier points to a lesser degree than the chi-square function.
Error handlingnone
Return valuechiabs merit function.
See alsoVF_chi2

 

VF_chi2VD_chi2VE_chi2
FunctionChi-square merit function.
Syntax C/C++#include <VFstd.h>
float VF_chi2( fVector X, fVector Y, fVector InvVar, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::chi2( const vector<T>& Y, const vector<T>& InvVar );
Pascal/Delphiuses VFstd;
function VF_chi2( X, Y, InvVar:fVector; size:UInt ): Single;
Descriptionc2 = sum( 1/si2 * (Xi - Yi)2 ).
The c2 (chi-square) merit function is most often used to judge the quality of a fit. One vector (either X or Y) represents experimental values that are obtained with individual standard deviations sigmai, the other contains the values predicted on the basis of a theory or a model. If the experimental data are "normally" distributed, and if s (sigma) is the correct measure for the quality of these data, then c2 is a measure for the quality of the fit. Rather than the standard deviations themselves, the routine needs the inverse of their squares (i.e., the inverse of the variances) to be passed as the vector InvVar.
Error handlingnone
Return valuechi2 merit function.
See alsoVF_meanwW,   VF_varianceVwW,   VF_varianceV,   VF_varianceCwW,   VF_chiabs,   VF_square,   VF_inv,   VF_linregress

 

VF_chopVD_chopVE_chop
VF_choptoIVD_choptoIVE_choptoI
VF_choptoBIVD_choptoBIVE_choptoBI
VF_choptoSIVD_choptoSIVE_choptoSI
VF_choptoLIVD_choptoLIVE_choptoLI
VF_choptoQIVD_choptoQIVE_choptoQI
VF_choptoUVD_choptoUVE_choptoU
VF_choptoUBVD_choptoUBVE_choptoUB
VF_choptoUSVD_choptoUSVE_choptoUS
VF_choptoULVD_choptoULVE_choptoUL
VF_choptoUIVD_choptoUIVE_choptoUI
Function"Chopping" towards zero.
Syntax C/C++#include <VFmath.h>
int VF_chop( fVector Y, fVector X, ui size );
int VF_choptoI( iVector Y, fVector X, ui size );
int VF_choptoLI( liVector Y, fVector X, ui size );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
int vector<T>::chop( const vector<T>& X );
int vector<int>::choptoI( const vector<T>& X );
int vector<long>::choptoLI( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_chop( Y, X:fVector; size:UInt ):IntBool;
function VF_choptoI( Y:iVector; X:fVector; size:UInt ): IntBool;
function VF_choptoLI( Y:liVector; X:fVector; size:UInt ): IntBool;

    (similarly all other functions of this family)
DescriptionEach element of X is rounded to an integer number by "chopping off" the fractional part. For example, -3.9 yields -3, and +3.9 yields +3. The result is stored in Y. The functions VF_choptoI,   VF_choptoLI, etc. convert the result into the various integer data types.
Error handlingOVERFLOW errors are handled by setting the result to the extreme value possible. Negative numbers in the versions VF_choptoU,   VF_choptoUS,   VF_choptoUL, and VF_choptoUI lead to DOMAIN errors; they are handled by setting the result to 0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_round,   VF_floor,   VF_ceil,   ceil,   floor (C/C++ only)

 

V_closeErrorEventFile
FunctionRestore default printing of error messages into stderr.
Syntax C/C++#include <VecLib.h>
void V_closeErrorEventFile( void );
Pascal/Delphiuses VecLib;
procedure V_closeErrorEventFile;
DescriptionAfter error messages have been redirected into an event file by V_setErrorEventFile, the default is restored by V_closeErrorEventFile and any further messages will be printed into stderr which normally is the screen (see chapter 5.5). Both of these functions will not be included in versions of VectorLib for compilers that do already offer the possibility of printing error messages simultaneously to the screen and to an event file.
Error handlingnone
Return valuenone
See alsoV_noteError,   V_setErrorEventFile,   _matherr (C/C++ only)

 

VF_cmp0VD_cmp0VE_cmp0
FunctionCompares each element of a vector with 0 (signum function).
Syntax C/C++#include <VFmath.h>
void VF_cmp0( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::cmp0( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_cmp0( Y,X:fVector; size:UInt );
DescriptionEach element of X is compared with 0 and the result of the comparison stored in Y:
Yi = +1.0, if Xi > 0
Yi =   0.0, if Xi = 0
Yi =  -1.0, if Xi < 0.
This function may also be called under its synonym VF_sgn.
Error handlingnone
Return valuenone
See alsoVF_cmp_...,   VF_cmpC,   VF_cmpV

 

VF_cmpCVD_cmpCVE_cmpC
FunctionCompares each element of a vector with a constant.
Syntax C/C++#include <VFmath.h>
void VF_cmpC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::cmpC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFstd;
procedure VF_cmpC( Y,X:fVector; size:UInt; C:Single );
DescriptionEach element of X is compared with C and the result of the comparison stored in Y:
Yi = +1.0, if Xi > C
Yi =   0.0, if Xi = C
Yi =  -1.0, if Xi < C
To compare with C=0, use more efficiently the function VF_cmp0.
Error handlingnone
Return valuenone
See alsoVF_cmp_...,  VF_cmp0,   VF_cmpV,   VF_iselementC

 

VF_cmpVVD_cmpVVE_cmpV
FunctionCompares each element of a vector with the corresponding element of another vector.
Syntax C/C++#include <VFmath.h>
void VF_cmpV( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::cmpV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_cmpV( Z, X, Y:fVector; size:UInt );
DescriptionEach element of X is compared with the corresponding element of Y and the result of the comparison stored in Z:
Zi = +1.0, if Xi > Yi
Zi =   0.0, if Xi = Yi
Zi =  -1.0, if Xi < Yi.
Error handlingnone
Return valuenone
See alsoVF_cmp_...,  VF_cmp0,   VF_cmpC

 

VF_cmp_...VD_cmp_...VE_cmp_...
        ...eq0        ...ne0        ...gt0        ...ge0        ...le0        ...lt0
        ...eqC        ...neC        ...gtC        ...geC        ...leC        ...ltC
        ...eqV        ...neV        ...gtV        ...geV        ...leV        ...ltV
        ...eq0ind        ...ne0ind        ...gt0ind        ...ge0ind        ...le0ind        ...lt0ind
        ...eqCind        ...neCind        ...gtCind        ...geCind        ...leCind        ...ltCind
        ...eqVind        ...neVind        ...gtVind        ...geVind        ...leVind        ...ltVind
        ...inclrange0C        ...exclrange0C
        ...inclrangeCC        ...exclrangeCC
        ...inclrange0Cind        ...exclrange0Cind
        ...inclrangeCCind        ...exclrangeCCind
VCF_cmp_...VCD_cmp_...VCE_cmp_...
VPF_cmp_...VPD_cmp_...VPE_cmp_...
        ...eq0        ...ne0        ...eqC        ...neC        ...eqV        ...neV
        ...eq0ind        ...ne0ind        ...eqCind        ...neCind        ...eqVind        ...neVind
FunctionComparisons
Syntax C/C++#include <VFmath.h>
ui VF_cmp_eq0( fVector Y, fVector X, ui size );
ui VF_cmp_ne0( fVector Y, fVector X, ui size );
ui VF_cmp_gt0( fVector Y, fVector X, ui size );
ui VF_cmp_ge0( fVector Y, fVector X, ui size );
ui VF_cmp_lt0( fVector Y, fVector X , ui size );
ui VF_cmp_le0( fVector Y, fVector X, ui size );

ui VF_cmp_eqC( fVector Y, fVector X, ui size, float C );
    (similarly: ..._neC, ..._gtC, ..._geC, ..._ltC, ..._leC)
ui VF_cmp_eqV( fVector Z, fVector X, fVector Y, ui size);
    (similarly: ..._neV, ..._gtV, ..._geV, ..._ltV, ..._leV)
ui VF_cmp_eq0ind( uiVector Ind, fVector X, ui size );
    (similarly: ..._ne0ind, ..._gt0ind, ..._ge0ind, ..._lt0ind, ..._le0ind)
ui VF_cmp_eqCind( uiVector Ind, fVector X, ui size, float C );
    (similarly: ..._neCind, ..._gtCind, ..._geCind, ..._ltCind, ..._leCind)
ui VF_cmp_eqVind( uiVector Ind, fVector X, fVector Y, ui size );
    (similarly: ..._neVind, ..._gtVind, ..._geVind, ..._ltVind, ..._leVind)
    (similarly VD_ and VE_ versions)

ui VF_cmp_inclrange0C( fVector Y, fVector X, ui size, float C );
ui VF_cmp_exclrange0C( fVector Y, fVector X, ui size, float C );
ui VF_cmp_inclrangeCC( fVector Y, fVector X, ui size, float CLo, float CHi );
ui VF_cmp_exclrangeCC( fVector Y, fVector X, ui size, float CLo, float CHi );

    (similarly VD_ and VE_ versions)

ui VF_cmp_inclrange0Cind( uiVector Ind, fVector X, ui size, float C );
ui VF_cmp_exclrange0Cind( uiVector Ind, fVector X, ui size, float C );
ui VF_cmp_inclrangeCCind( uiVector Ind, fVector X, ui size, float CLo, float CHi );
ui VF_cmp_exclrangeCCind( uiVector Ind, fVector X, ui size, float CLo, float CHi );

    (similarly VD_ and VE_ versions)

ui VCF_cmp_eq0( cfVector Y, cfVector X, ui size );
ui VCF_cmp_ne0( cfVector Y, cfVector X, ui size );
ui VCF_cmp_eqC( cfVector Y, cfVector X, ui size, fComplex C );
ui VCF_cmp_neC( cfVector Y, cfVector X, ui size, fComplex C );
ui VCF_cmp_eqV( cfVector Z, cfVector X, cfVector Y, ui size );
ui VCF_cmp_neV( cfVector Z, cfVector X, cfVector Y, ui size );
ui VCF_cmp_eq0ind( uiVector Ind, cfVector X, ui size );
ui VCF_cmp_ne0ind( uiVector Ind, cfVector X, ui size );
ui VCF_cmp_eqCind( uiVector Ind, cfVector X, ui size, fComplex C );
ui VCF_cmp_neCind( uiVector Ind, cfVector X, ui size, fComplex C );
ui VCF_cmp_eqVind( uiVector Ind, cfVector X, cfVector Y, ui size );
ui VCF_cmp_neVind( uiVector Ind, cfVector X, cfVector Y, ui size );

    (similarly VCD_ and VCE_ versions)

C++ VecObj#include <OptiVec.h>
ui vector<T>::cmp_eq0( const vector<T>& X );
ui vector<T>::cmp_ne0( const vector<T>& X );
ui vector<T>::cmp_gt0( const vector<T>& X );
ui vector<T>::cmp_ge0( const vector<T>& X );
ui vector<T>::cmp_lt0( const vector<T>& X );
ui vector<T>::cmp_le0( const vector<T>& X );
ui vector<T>::cmp_eqC( const vector<T>& X, const T& C );
ui vector<T>::cmp_eqV( const vector<T>& X, const vector<T>& Y );
ui vector<ui>::cmp_eq0ind( const vector<ui>& Ind, const vector<T>& X );
ui vector<ui>::cmp_eqCind( const vector<ui>& Ind, const vector<T>& X );
ui vector<ui>::cmp_eqVind( const vector<ui>& Ind, const vector<T>& X );
ui vector<T>::cmp_inclrange0C( const vector<T>& X, const T& C );
ui vector<T>::cmp_exclrange0C( const vector<T>& X, const T& C );
ui vector<T>::cmp_inclrangeCC( const vector<T>& X, const T& CLo, const T& CHi );
ui vector<T>::cmp_exclrangeCC( const vector<T>& X, const T& CLo, const T& CHi );
ui vector<ui>::cmp_inclrange0Cind( const vector<ui>& Ind, const vector<T>& X, const T& C );
ui vector<ui>::cmp_exclrange0Cind( const vector<ui>& Ind, const vector<T>& X, const T& C );
ui vector<ui>::cmp_inclrangeCCind( const vector<ui>& Ind, const vector<T>& X, const T& CLo, const T& CHi );
ui vector<ui>::cmp_exclrangeCCind( const vector<ui>& Ind, const vector<T>& X, const T& CLo, const T& CHi );
ui vector<complex<T>>::cmp_eq0( const vector<complex<T>>& X );
ui vector<complex<T>>::cmp_ne0( const vector<complex<T>>& X );
ui vector<complex<T>>::cmp_eqC( const vector<complex<T>>& X, complex<T> C );
ui vector<complex<T>>::cmp_neC( const vector<complex<T>>& X, complex<T> C );
ui vector<complex<T>>::cmp_eqV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
ui vector<complex<T>>::cmp_neV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
ui vector<ui>::cmp_eq0ind( const vector<ui>& Ind, const vector<complex<T>>& X );
ui vector<ui>::cmp_ne0ind( const vector<ui>& Ind, const vector<complex<T>>& X );
ui vector<ui>::cmp_eqCind( const vector<ui>& Ind, const vector<complex<T>>& X );
ui vector<ui>::cmp_neCind( const vector<ui>& Ind, const vector<complex<T>>& X );
ui vector<ui>::cmp_eqVind( const vector<ui>& Ind, const vector<complex<T>>& X );
ui vector<ui>::cmp_neVind( const vector<ui>& Ind, const vector<complex<T>>& X );
Pascal/Delphiuses VFstd;
function VF_cmp_eq0( Y,X:fVector; size:UInt ):UInt;
function VF_cmp_ne0( Y,X:fVector; size:UInt ):UInt;
function VF_cmp_gt0( Y,X:fVector; size:UInt ):UInt;
function VF_cmp_ge0( Y,X:fVector; size:UInt ):UInt;
function VF_cmp_lt0( Y,X:fVector; size:UInt ):UInt;
function VF_cmp_le0( Y,X:fVector; size:UInt ):UInt;

function VF_cmp_eqC( Y,X:fVector; size:UInt; C:Single ):UInt;
    (similarly: ..._neC, ..._gtC, ..._geC, ..._ltC, ..._leC)
function VF_cmp_eqV( Z, X, Y:fVector; size:UInt ):UInt;
    (similarly: ..._neV, ..._gtV, ..._geV, ..._ltV, ..._leV)
function VF_cmp_eq0ind( Ind:uVector; X:fVector; size:UInt ):UInt;
    (similarly: ..._ne0ind, ..._gt0ind, ..._ge0ind, ..._lt0ind, ..._le0ind)
function VF_cmp_eqCind( Ind:uVector; X:fVector; size:UInt; C:Single ):UInt;
    (similarly: ..._neCind, ..._gtCind, ..._geCind, ..._ltCind, ..._leCind)
function VF_cmp_eqVind( Ind:uVector; X, Y:fVector; size:UInt ):UInt;
    (similarly: ..._neVind, ..._gtVind, ..._geVind, ..._ltVind, ..._leVind)
    (similarly VD_ and VE_ versions)

function VF_cmp_inclrange0C( Y, X:fVector; size:UInt; C:Single ): UInt;
function VF_cmp_exclrange0C( Y, X:fVector; size:UInt; C:Single ): UInt;
function VF_cmp_inclrangeCC( Y, X:fVector; size:UInt; CLo, CHi:Single ): UInt;
function VF_cmp_exclrangeCC( Y, X:fVector; size:UInt; CLo, CHi:Single ): UInt;

    (similarly VD_ and VE_ versions)

function VF_cmp_inclrange0Cind( Ind:uVector; X:fVector; size:UInt; C:Single ): UInt;
function VF_cmp_exclrange0Cind( Ind:uVector; X:fVector; size:UInt; C:Single ): UInt;
function VF_cmp_inclrangeCCind( Ind:uVector; X:fVector; size:UInt; CLo, CHi:Single ): UInt;
function VF_cmp_exclrangeCCind( Ind:uVector; X:fVector; size:UInt; CLo, CHi:Single ): UInt;

    (similarly VD_ and VE_ versions)

function VCF_cmp_eq0( Y, X:cfVector; size:UInt ):UInt;
function VCF_cmp_ne0( Y, X:cfVector; size:UInt ):UInt;
function VCF_cmp_eqC( Y, X:cfVector; size:UInt; C:fComplex ):UInt;
function VCF_cmp_neC( Y, X:cfVector; size:UInt; C:fComplex ):UInt;
function VCF_cmp_eqV( Z, X, Y:cfVector; size:UInt ):UInt;
function VCF_cmp_neV( Z, X, Y:cfVector; size:UInt ):UInt;

function VCF_cmp_eq0ind( Ind:uVector; X:cfVector; size:UInt ):UInt;
function VCF_cmp_ne0ind( Ind:uVector; X:cfVector; size:UInt ):UInt;
function VCF_cmp_eqCind( Ind:uVector; X:cfVector; size:UInt; C:fComplex ):UInt;
function VCF_cmp_neCind( Ind:uVector; X:cfVector; size:UInt; C:fComplex ):UInt;
function VCF_cmp_eqVind( Ind:uVector; X, Y:cfVector; size:UInt ):UInt;
function VCF_cmp_neVind( Ind:uVector; X, Y:cfVector; size:UInt ):UInt;

    (similarly VCD_ and VCE_ versions)

Descriptiona) Simple comparisons:
Each element of X is compared with either 0, or a constant C, or the corresponding element of another vector, Y. The conditions to be tested are denoted by two letters as in ASSEMBLER or FORTRAN:
 
"eq" ("equal")True, if Xi = 0 (C, Yi, resp.)
"ne" ("not equal")True, if Xi != 0 (C, Yi, resp.)
"gt" ("gteater than")True, if Xi > 0 (C, Yi, resp.)
"ge" ("greater or equal")   True, if Xi >= 0 (C, Yi, resp.)
"lt" ("less than")True, if Xi < 0 (C, Yi, resp.)
"le" ("less or equal")True, if Xi <= 0 (C, Yi, resp.)

For complex numbers, only the test for equality ("eq") or inequality ("ne") makes sense and is available.

b) Range-checking functions
Each element of X is checked if it falls into a range which is specified either by 0 and a (positive or negative) constant C, or by two constants, CLo and CHi. One has the choice between two versions, treating the range either as inclusive or as exclusive of the end points:
VF_cmp_inclrange0C checks for 0 <= x <= C (positive C) or 0 >= x >= C (negative C), whereas VF_cmp_exclrangeCC checks for CLo < x < CHi.

a) and b):
There are two different ways how the result of the comparison is treated. The result for each element of X is either stored as 1.0 for TRUE and 0.0 for FALSE in a vector of a floating-point data type (with the imaginary part in the complex versions always set to 0), or the indices of the elements for which the result is TRUE are stored in an index vector; the latter is the case in the functions with the suffix "ind" as the last part of their names, like in VF_cmp_neCind. In any case, the number of TRUE results encountered is returned by the function. The index-finding variant is especially useful to extract the elements for which the condition is TRUE into a sub-vector by VF_indpick; be sure to check that the return value nTrue is non-zero if you wish to do that (remember that the parameter size for any of the functions of this VectorLib library must be non-zero!).

Error handlingnone
Return valuenumber of elements for which the condition was found to be TRUE.
See alsoVF_cmp0,   VF_cmpC,   VF_cmpV,   VF_indpick,   VF_iselementC

 

VF_combVD_combVE_comb
FunctionInitializes a vector with a comb function.
Syntax C/C++#include <VFstd.h>
void VF_comb( fVector X, ui size, ui spac, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::comb( ui spac, const T& C );
Pascal/Delphiuses VFstd;
procedure VF_comb( X:fVector; size:UInt; spac:Word; C:Single );
DescriptionXi = C, i = 0, 1*spac, 2*spac,...
Xi = 0, otherwise
Error handlingIf the spacing spac of the comb exceeds size, an error message "Invalid parameter(s)" is displayed and the program aborted.
Return valuenone
See alsoVF_equ1,   VF_equ0,   VF_equC

 

VCF_complexVCD_complexVCE_complex
VPF_complexVPD_complexVPE_complex
FunctionConstructs a complex vector (either cartesian or polar coordinates) from its real and imaginary parts.
Syntax C/C++#include <VCFstd.h>
void VCF_complex( cfVector X, fVector Re, fVector Im, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::complex( vector<T> Re, vector<T> Im );
Pascal/Delphiuses VCFstd;
procedure VCF_complex( X:cfVector; Re, Im:fVector; size:UInt );
DescriptionIdentical to VF_ReImtoC,   VD_ReImtoC, and VE_ReImtoC. See these functions for details.

 

VCF_conjVCD_conjVCE_conj
VPF_conjVPD_conjVPE_conj
FunctionFind the complex conjugate of a vector.
Syntax C/C++#include <VCFmath.h>
int VCF_conj( cfVector Y, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<complex<T>>::conj( const vector<complex<T>>& X );
Pascal/Delphiuses VCFmath;
function VCF_conj( Y, X:cfVector; size:UInt ): IntBool;
DescriptionRe(Yi) = Re(Xi)
Im(Yi) = -Im(Xi)
Error handlingnone
Return valuealways FALSE (0)
See alsoVCF_neg,   VCF_abs

 

V_continuePlot
FunctionGet back into the last viewport used for plotting
Syntax C/C++#include <Vgraph.h>
void V_continuePlot( void );
Pascal/Delphiuses Vgraph;
procedure V_continuePlot;
DescriptionIf one wants to add new DataPlots to an existing coordinate system after one has already defined a new viewport (e.g., for text output), this function takes one back to the most recently used coordinate system.
Error handlingnone
Return valuenone
See alsoV_getCoordSystem,   V_setCoordSystem,   V_setPlotRegion

 

VF_convolveVD_convolveVE_convolve
FunctionCalculates the convolution of a vector with a response function.
Syntax C/C++#include <VFstd.h>
void VF_convolve( fVector Y, fVector Flt, fVector X, fVector Rsp, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::convolve( vector<T> Flt, const vector<T>& X, const vector<T>& Rsp );
Pascal/Delphiuses VFstd;
procedure VF_convolve( Y, Flt, X, Rsp:fVector; size:UInt );
DescriptionThe convolution of X with the response function Rsp is calculated and stored in Y. A filter Flt is also calculated. If more than one vector is to be convolved with the same Rsp, use VF_convolve only once and use VF_filter for the other vectors.
The response has to be stored in Rsp in wrap-around order: the response for zero and positive times (or whatever the independent variable is) is stored in Rsp0 to Rspsize/2 and the response for negative times (beginning with the most negative time) in Rspsize/2+1 to Rspsize-1. You may wish to use VF_rotate or VF_reflect to achieve this wrap-around order and to construct the response vector.
Notice that Rsp has to be of the same size as X.

The result of the convolution appears scaled with the sum of all elements of Rsp. Normally, therefore, Rsp should be normalized to 1.0.

X, Y, Rsp, and Flt must all be of the same size, which has to be an integer power of 2. X may be overwritten by Y, Rsp may be overwritten by Flt, but X and Flt as well as Y and Rsp have to be distinct from each other.

The treatment of round-off errors in the construction of Flt may be modified by VF_setRspEdit.

Example C/C++VF_ramp( Time, 1024, 0.0, 1.0 );
VF_Gauss( Rsp, Time, 513, 10.0, 0.0, 1.0 );
      /* Response function for zero and positive times */
VF_reflect( Rsp+1, 1023 );
      /* ... and for negative times */
VF_divC( Rsp, Rsp, 1024, VF_sum( Rsp, 1024 ) );
      /* Normalisation of Rsp */
VF_convolve( X, Rsp, X, Rsp, 1024 );
      /* Convolution; X is overwritten by the desired result
         and Rsp is overwritten by the frequency filter */
VF_filter( Y, Y, Rsp, 1024 );
      /* Next convolution: instead of another call to
         VF_convolve, Y is filtered using the frequency
         filter just obtained */
 
Example Pascal/DelphiVF_ramp( Time, 1024, 0.0, 1.0 );
VF_Gauss( Rsp, Time, 513, 10.0, 0.0, 1.0 );
      (* Response function for zero and positive times *)
VF_reflect( VF_Pelement(Rsp,1), 1023 );
      (* ... and for negative times *)
VF_divC( Rsp, Rsp, 1024, VF_sum( Rsp, 1024 ) );
      (* Normalisation of Rsp *)
VF_convolve( X, Rsp, X, Rsp, 1024 );
      (* Convolution; X is overwritten by the desired result and Rsp is overwritten by the frequency filter *)
VF_filter( Y, Y, Rsp, 1024 );
      (* Next convolution: instead of another call to VF_convolve, Y is filtered using the frequency filter just obtained   *)

Mathematically, this convolution is based on the assumption that X is periodic; it still works well if X is non-periodic but converges on both ends to the same value X0 = Xsize-1. If that is not the case, the first and the last elements of Y are spoiled by "wrap-around" from elements on the other side. Extrapolate X on both sides in order to imbed the original X in a larger vector, if wrap-around is a problem. The minimum number of elements to be added equals half the width of the response function. (In the case of an asymmetric response function, it is the broader wing that counts.) After convolving the larger vector with the response function, it will be the dummy elements just added which become spoiled by wrap-around. Those elements of the result vector which correspond to the original X will represent the desired convolution of X with Rsp.
If X is smoothly converging on both sides to different values, it is not necessary to employ the procedure just described. Rather, the difference between the end points may be regarded as a linear trend. In this case, remove the trend, convolve the resultant vector and add the trend to the result.

Example C/C++d = (X[size-1] - X[0]) / (size-1);
VF_ramp( Trend, size, 0.0, d );
VF_subV( Y, X, Trend, size );
VF_convolve( Y, Flt, Y, Rsp, size );
VF_addV( Y, Y, Trend, size );
Example for treatment of end effects in Pascal/Delphi d := (VF_element(X,size-1) - X^) / (size-1);
VF_ramp( Trend, size, 0.0, d );
VF_subV( Y, X, Trend, size );
VF_convolve( Y, Flt, Y, Rsp, size );
VF_addV( Y, Y, Trend, size );

You might notice that Flt is declared as fVector rather than cfVector, although the information stored in Flt consists of complex numbers. The reason is that these numbers are stored in the packed complex format (as described for VF_FFT) which is used only in connection with Fourier-Transform operations of real vectors.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_convolve is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuenone
See alsoVF_filter,   VF_deconvolve,   VF_FFT,   VF_autocorr,   VF_xcorr,   VF_spectrum

 

VF_corrcoeffVD_corrcoeffVE_corrcoeff
FunctionLinear correlation coefficient between two distributions
Syntax C/C++#include <VFstd.h>
float VF_corrcoeff( fVector X, fVector Y, ui size, float Xmean, float Ymean );
C++ VecObj#include <OptiVec.h>
T vector<T>::corrcoeff( const vector<T>& Y, T Xmean, T Ymean );
Pascal/Delphiuses VFstd;
function VF_corrcoeff( X, Y:fVector; size:UInt; Xmean, Ymean:Single ): Single;
DescriptionThe linear correlation coefficient ("Pearson's r") takes on values between -1.0 and +1.0. The mean values of both distributions must be known. They are passed to VF_corrcoeff as the parameters Xmean and Ymean.
Example C/C++r = VF_corrcoeff( X, Y, n, VF_mean( X, n ), VF_mean( Y, n ) );
Return valuelinear correlation coefficient r
See alsoVF_mean,   VF_varianceV,   VF_linregress

 

VF_cosVD_cosVE_cos
VFx_cosVDx_cosVEx_cos
VFr_cosVDr_cosVEr_cos
VFrx_cosVDrx_cosVErx_cos
VCF_cosVCD_cosVCE_cos
VCFx_cosVCDx_cosVCEx_cos
FunctionCosine function
Syntax C/C++#include <VFmath.h>
int VF_cos( fVector Y, fVector X, ui size );
int VFx_cos( fVector Y, fVector X, ui size, float A, float B, float C );
int VFr_cos( fVector Y, fVector X, ui size );
int VFrx_cos( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cos( const vector<T>& X );
int vector<T>::x_cos( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::r_cos( const vector<T>& X );
int vector<T>::rx_cos( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cos( Y, X:fVector; size:UInt ): IntBool;
function VFx_cos( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VFr_cos( Y, X:fVector; size:UInt ): IntBool;
function VFrx_cos( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cos ( Xi )
expanded versions: Yi = C * cos ( A*Xi + B )
For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as rational multiples of p, it is better to use VF_cosrpi than VF_cos.
If, on the other hand, one can be sure that all Xi are within the range -2p <= Xi <= +2p, one can employ the faster reduced-range versions with the prefixes VFr_ and VFrx_.
Error handlingPrecision errors in the real-value functions lead to a default result of 1.0 (as if the input were 0.0) and to a non-zero return value, but are otherwise ignored; _matherr is not called.
OVERFLOW errors can only occur in the complex versions and lead to a result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cos2,   VF_cosrpi,   VF_sin,   VF_cosh,   VF_acos,   cos

 

VF_cos2VD_cos2VE_cos2
VFx_cos2VDx_cos2VEx_cos2
VFr_cos2VDr_cos2VEr_cos2
VFrx_cos2VDrx_cos2VErx_cos2
FunctionSquare of the cosine function
Syntax C/C++#include <VFmath.h>
int VF_cos2( fVector Y, fVector X, ui size );
int VFx_cos2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cos2( const vector<T>& X );
int vector<T>::x_cos2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cos2( Y, X:fVector; size:UInt ): IntBool;
function VFx_cos2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cos2( Xi )
expanded versions: Yi = C * cos2( A*Xi + B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards. The reduced-range versions with the prefixes VFr_ and VFrx_ are for situations in which one can be sure that all input values lie in the range -2p <= Xi <= +2p.
Error handlingPrecision errors lead to a default result of 1.0 (as if the input were 0.0) and a non-zero return value, but are otherwise ignored; _matherr is not called.
OVERFLOW errors can only occur in the complex versions and lead to a result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cos,   VF_cosrpi,  cos

 

VF_cosecVD_cosecVE_cosec
VFx_cosecVDx_cosecVEx_cosec
FunctionCosecant function
Syntax C/C++#include <VFmath.h>
int VF_cosec( fVector Y, fVector X, ui size );
int VFx_cosec( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosec( const vector<T>& X );
int vector<T>::x_cosec( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cosec( Y, X:fVector; size:UInt ): IntBool;
function VFx_cosec( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cosec ( Xi ) = 1.0 / sin ( Xi )
expanded versions: Yi = C * cosec ( A*Xi + B )
The cosecant is defined as the inverse of the sine (not to be mistaken for the arcus function arcsin!) For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as rational multiples of p, it is better to use VF_cosecrpi than VF_cosec.
Error handlingFor TLOSS precision errors, the default result is arbitrarily set to 1.0 (as an exception from the general rule which would require the result to be the mean of the results for +0 and -0. This would be 0.0. However, zero is not a valid result for the cosecant function). For SING and OVERFLOW errors, the default result is ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cosec2,   VF_cosecrpi,   VF_sin,   VF_cosech,   sin

 

VF_cosec2VD_cosec2VE_cosec2
VFx_cosec2VDx_cosec2VEx_cosec2
FunctionSquare of the cosecant function
Syntax C/C++#include <VFmath.h>
int VF_cosec2( fVector Y, fVector X, ui size );
int VFx_cosec2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosec2( const vector<T>& X );
int vector<T>::x_cosec2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cosec2( Y, X:fVector; size:UInt ): IntBool;
function VFx_cosec2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cosec2 ( Xi )
expanded versions: Yi = C * cosec2 ( A*Xi + B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards.
Error handlingFor SING, OVERFLOW, and TLOSS errors, the default result is ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cosec,   VF_cosecrpi,  sin

 

VF_cosechVD_cosechVE_cosech
VFx_cosechVDx_cosechVEx_cosech
FunctionHyperbolic cosecant function
Syntax C/C++#include <VFmath.h>
int VF_cosech( fVector Y, fVector X, ui size );
int VFx_cosech( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosech( const vector<T>& X );
int vector<T>::x_cosech( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cosech( Y, X:fVector; size:UInt ): IntBool;
function VFx_cosech( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cosech ( Xi )
expanded versions: Yi = C * cosech ( A*Xi+B )
Error handlingSING errors lead to a default result of 0 (mean of +HUGE_VAL and -HUGE_VAL); OVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sinh,   VF_exp,   sinh

 

VF_cosecrpiVD_cosecrpiVE_cosecrpi
VF_cosecrpi2VD_cosecrpi2VE_cosecrpi2
VF_cosecrpi3VD_cosecrpi3VE_cosecrpi3
FunctionCosecant function of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_cosecrpi( fVector Y, iVector P, ui size, int q );
int VF_cosecrpi2( fVector Y, iVector P, ui size, int q );
int VF_cosecrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosecrpi( const vector<int>& P, int q );
int vector<T>::cosecrpi2( const vector<int>& P, int q );
int vector<T>::cosecrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_cosecrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cosecrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cosecrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = cosec( (Pi / q) * p )
The cosecant of fractional multiples of p is calculated. There are three versions: VF_cosecrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_cosecrpi2 should be used which is a highly optimized version using a look-up table. If q is a multiple of 3, VF_cosecrpi3 should be used. VF_cosecrpi2 and VF_cosecrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the tables.
Error handlingSING errors occur if Pi / q is exactly an integer number; the default result is 0.0 (which is the mean of +HUGE_VAL and -HUGE_VAL; in contrast to VF_cosec, 0.0 is chosen irrespective of the fact that it is not a valid result of the cosecant function); q must be non-zero; this is, however, not tested for.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cosec,   sin

 

VF_cosectab2VD_cosectab2VE_cosectab2
VF_cosectab3VD_cosectab3VE_cosectab3
 Table of cosecant values for arguments between 0 and p/2.
Syntax C/C++#include <xmath.h>
extern float    VF_cosectab2[ VF_tabsz2+1 ];
extern double   VD_cosectab2[ VD_tabsz2+1 ];
extern extended VE_cosectab2[ VE_tabsz2+1 ];
extern float    VF_cosectab3[ VF_tabsz3+1 ];
extern double   VD_cosectab3[ VD_tabsz3+1 ];
extern extended VE_cosectab3[ VE_tabsz3+1 ];
Pascal/Delphiuses FCSCTAB3, DCSCTAB3, ECSCTAB3;
VF_cosectab2: array[0..VF_tabsz2] of Single;
VD_cosectab2: array[0..VD_tabsz2] of Double;
VE_cosectab2: array[0..VE_tabsz2] of Extended;
VF_cosectab3: array[0..VF_tabsz3] of Single;
VD_cosectab3: array[0..VD_tabsz3] of Double;
VE_cosectab3: array[0..VE_tabsz3] of Extended;
Description VF_cosectab2[ i ] = cosec ( i/(2*VF_tabsz2) * p ),    i=0,...,VF_tabsz2-1
VF_cosectab3[ i ] = cosec ( i/(2*VF_tabsz3) * p ),    i=0,...,VF_tabsz3-1
VF_cosectab2[ VF_tabsz2 ] = VF_cosectab3[ VF_tabsz3 ] = 0

These look-up tables of cosecant values for arguments between 0 and p/2 are used by VF_cosecrpi2 and the other functions of that family and are also available to the user. Since the cosecant of p/2 is not defined, zero is stored at its place.
C/C++: The symbols VF_tabsz2 etc., denoting the size of the tables, are defined in <xmath.h>.
Pascal/Delphi: The symbols VF_tabsz2 etc. are defined in the same units as the tables themselves.

 

VF_coshVD_coshVE_cosh
VFx_coshVDx_coshVEx_cosh
VCF_coshVCD_coshVCE_cosh
VCFx_coshVCDx_coshVCEx_cosh
FunctionHyperbolic cosine
Syntax C/C++#include <VFmath.h>
int VF_cosh( fVector Y, fVector X, ui size );
int VFx_cosh( fVector Y, fVector X, ui size, float A, float B, float C );
int VCF_cosh( cfVector Y, cfVector X, ui size );
int VCFx_cosh( cfVector Y, cfVector X, ui size, fComplex A, fComplex B, fComplex C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosh( const vector<T>& X );
int vector<T>::x_cosh( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cosh( Y, X:fVector; size:UInt ): IntBool;
function VFx_cosh( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cosh ( Xi )
expanded versions: Yi = C * cosh ( A*Xi+B )
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sinh,   VF_exp,  cosh

 

VF_cosrpiVD_cosrpiVE_cosrpi
VF_cosrpi2VD_cosrpi2VE_cosrpi2
VF_cosrpi3VD_cosrpi3VE_cosrpi3
FunctionCosine function of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_cosrpi( fVector Y, iVector P, ui size, int q );
int VF_cosrpi2( fVector Y, iVector P, ui size, int q );
int VF_cosrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::cosrpi( const vector<int>& P, int q );
int vector<T>::cosrpi2( const vector<int>& P, int q );
int vector<T>::cosrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_cosrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cosrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cosrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = cos( (Pi / q) * p )
The cosine of fractional multiples of p is calculated. There are three versions: VF_cosrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_cosrpi2 should be used which is a highly optimized version reading the results from a look-up table, if possible. If q is a multiple of 3, VF_cosrpi3 should be used. VF_cosrpi3 offers a convenient way to use degrees instead of radians; if, for example, q is 180, the unit of the elements of P is "degree". VF_cosrpi2 and VF_cosrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the tables.
Error handlingThese functions are error-proof, as long as q != 0.
Return valuealways FALSE (0)
See alsoVF_cos,   cos

 

VF_cotVD_cotVE_cot
VFx_cotVDx_cotVEx_cot
FunctionCotangent function
Syntax C/C++#include <VFmath.h>
int VF_cot( fVector Y, fVector X, ui size );
int VFx_cot( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cot( const vector<T>& X );
int vector<T>::x_cot( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cot( Y, X:fVector; size:UInt ): IntBool;
function VFx_cot( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cot ( Xi )
expanded versions: Yi = C * cot ( A*Xi+B )
The cotangent is defined as the inverse of the tangent (not to be mistaken for the arcus function arctan!) For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as rational multiples of p, it is better to use VF_cotrpi than VF_cot.
Error handlingFor TLOSS precision errors, the default result is 0.0 (which is the mean of +HUGE_VAL and -HUGE_VAL); for SING and OVERFLOW errors, the default result is ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cot2,   VF_cotrpi,   VF_coth,   VF_atan,   VF_atan2,   tan

 

VF_cot2VD_cot2VE_cot2
VFx_cot2VDx_cot2VEx_cot2
FunctionSquare of the cotangent function
Syntax C/C++#include <VFmath.h>
int VF_cot2( fVector Y, fVector X, ui size );
int VFx_cot2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::cot2( const vector<T>& X );
int vector<T>::x_cot2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_cot2( Y, X:fVector; size:UInt ): IntBool;
function VFx_cot2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cot2( Xi )
expanded versions: Yi = C * cot2( A*Xi+B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards.
Error handlingFor SING, OVERFLOW and TLOSS errors, the default result is +HUGE_VAL (multiplied by the sign of C in the expanded versions).
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cot,   VF_cotrpi,   tan

 

VF_cothVD_cothVE_coth
VFx_cothVDx_cothVEx_coth
FunctionHyperbolic cotangent function
Syntax C/C++#include <VFmath.h>
int VF_coth( fVector Y, fVector X, ui size );
int VFx_coth( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::coth( const vector<T>& X );
int vector<T>::x_coth( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_coth( Y, X:fVector; size:UInt ): IntBool;
function VFx_coth( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = coth ( Xi )
expanded versions: Yi = C * coth ( A*Xi+B )
Error handlingSING errors lead to a default result of 0.0 (the mean of +HUGE_VAL and -HUGE_VAL); OVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sinh,   VF_tanh,   VF_exp,   tanh

 

VF_cotrpiVD_cotrpiVE_cotrpi
VF_cotrpi2VD_cotrpi2VE_cotrpi2
VF_cotrpi3VD_cotrpi3VE_cotrpi3
FunctionCotangent function of rational multiples of p
Syntax C/C++#include <VFmath.h>
int VF_cotrpi( fVector Y, iVector P, ui size, int q );
int VF_cotrpi2( fVector Y, iVector P, ui size, int q );
int VF_cotrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::cotrpi( const vector<int>& P, int q );
int vector<T>::cotrpi2( const vector<int>& P, int q );
int vector<T>::cotrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_cotrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cotrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_cotrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = cot( (Pi / q) * p )
The cotangent of fractional multiples of p is calculated. There are three versions: VF_cotrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_cotrpi2 should be used which is a highly optimized version using a look-up table. If q is a multiple of 3, VF_cotrpi3 should be used. VF_cotrpi2 and VF_cotrpi3 also work with q values they are not optimized for; in this case, however, memory space is wasted for the tables.
Error handlingSING errors occur if Pi / q is a whole number. The default result is 0.0 (which is the mean of +HUGE_VAL and -HUGE_VAL); q must be non-zero; this is, however, not tested for.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cot,   tan

 

VF_cprintVD_cprintVE_cprint
VCF_cprintVCD_cprintVCE_cprint
VPF_cprintVPD_cprintVPE_cprint
VI_cprintVBI_cprintVSI_cprintVLI_cprintVQI_cprint
VU_cprintVUB_cprintVUS_cprintVUL_cprintVUI_cprint
Functionprint a vector to the screen. Only DOS and Win32 console applications; not for Visual C++.
Syntax C/C++#include <VFstd.h>
void VF_cprint( fVector X, ui size, unsigned nperline );
C++ VecObj#include <OptiVec.h>
void vector<T>::cprint( unsigned nperline );
Pascal/Delphiuses VFstd;
procedure VF_cprint( X:fVector; size, nperline:UInt );
Descriptionsize elements of X are printed to the screen (or "console"), into the actual text window, nperline elements in each line.

The display starts always with a new line. Please note that this may lead to an empty line at the beginning.
Each line begins with the index of the first element printed into that line. The index is followed by a colon and by the requested nperline elements.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}. Polar complex numbers are also written in braces, with the Mag and Arg parts separated by an at-sign: {Mag @ Arg}.

The display pauses every screenful. The user is prompted after each page to continue or to stop printing.
The number of digits per element is determined by the available space, which depends in turn on the line width and on the parameter nperline.

This family of functions is available only for DOS and Win32 console applications. It should not be used within TurboVision DOS programs.

Error handlingIf nperline exceeds the maximum number of entries possible in the current text mode, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the program chooses the maximum number nperline that is possible.
Return valuenone
See alsoVF_fprint,   VF_print,   VF_write,   VF_store,   cprintf

 

VF_CtoAbsVD_CtoAbsVE_CtoAbs
FunctionAbsolute value (magnitude) of cartesian complex numbers
Syntax C/C++#include <VCFstd.h>
void VF_CtoAbs( fVector Abs, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoAbs( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoAbs( Abs:fVector; X:cfVector; size:UInt );
DescriptionAbsi = sqrt( Re2(Xi) + Im2(Xi) )
The absolute value, i.e. the magnitude of each element of the complex vector X is calculated. This function is almost identical to VCF_abs, but does not perform any error handling.
Error handlingnone
Return valuenone
See alsoVCF_abs,   VF_PolartoC,   VF_CtoReIm,   VF_CtoArg,   VF_CtoNorm

 

VF_CtoArgVD_CtoArgVE_CtoArg
FunctionArgument (angle) of cartesian-complex numbers
Syntax C/C++#include <VCFstd.h>
void VF_CtoArg( fVector Arg, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoArg( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoArg( Arg:fVector; X:cfVector; size:UInt );
DescriptionArgi = arctan( Im(Xi) / Re(Xi) )
The argument, i.e. the angle of each element of the complex vector X is calculated. For Cartesian coordinates {0, 0}, the angle is arbitrary and is set to zero.
When necessary, depending on the signs of Re(Xi) and Im(Xi), p is added or subtracted from the arctan to obtain the correct quadrant.
Error handlingnone
Return valuenone
See alsoVF_PolartoC,   VF_CtoPolar,   VF_atan2,   VF_CtoAbs,   VF_CtoReIm

 

VF_CtoImVD_CtoImVE_CtoIm
FunctionExtract the imaginary part from a cartesian-complex vector.
Syntax C/C++#include <VCFstd.h>
void VF_CtoIm( fVector Im, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoIm( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoIm( Im:fVector; X:cfVector; size:UInt );
DescriptionThe imaginary part of the complex vector X is extracted and stored in Im.
Error handlingnone
Return valuenone
See alsoVF_CtoReIm,   VF_ReImtoC,   VF_ImtoC,   VF_PolartoC

 

VF_CtoNormVD_CtoNormVE_CtoNorm
FunctionNorm (square of the absolute value) of cartesian-complex numbers
Syntax C/C++#include <VCFstd.h>
void VF_CtoNorm( fVector Norm, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoNorm( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoNorm( Norm:fVector; X:cfVector; size:UInt );
DescriptionNormi = Re2(Xi) + Im2(Xi)
This definition of the Norm of a complex number is the same as in C++, but it is not consistent with the usual definition in mathematics, where the term "norm" is used as a synomym for "absolute value" or "magnitude". As defined here, the Norm is the square of the absolute value. The absolute value itself is available by the functions VF_CtoAbs (without error handling) and VCF_abs (with error handling).
Error handlingnone
Return valuenone
See alsoVF_PolartoC,   VF_CtoReIm,   VF_CtoArg,   VF_CtoAbs

 

VF_CtoPVD_CtoPVE_CtoP
FunctionTransformation of a cartesian complex into a polar complex vector
Syntax C/C++#include <VPFstd.h>
void VF_CtoP( pfVector Y, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::CtoP( const vector<complex<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_CtoP( Y:pfVector; X:cfVector; size:UInt );
DescriptionX is transformed from cartesian coordinates {Re, Im} into polar coordinates {Mag @ Arg}.
Error handlingnone
Return valuenone
See alsoVF_CtoPolar,   VF_PtoC

 

VF_CtoPolarVD_CtoPolarVE_CtoPolar
FunctionTransformation of complex numbers from Cartesian into polar coordinates, stored in separate vectors Mag and Arg.
Syntax C/C++#include <VCFstd.h>
void VF_CtoPolar( fVector Mag, fVector Arg, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoPolar( vector<T> Arg, const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoPolar( Mag, Arg:fVector; X:cfVector; size:UInt );
DescriptionThe polar coordinates Mag (magnitude, absolute value) and Arg (argument, angle) of each element of the Cartesian complex vector X are calculated. For the Cartesian coordinates {0, 0}, the polar coordinates are also set to {0 @ 0}.
This function is similar to VF_CtoP, with the exception that Mag and Arg are stored in separate vectors instead of one polar complex vector, as in VF_CtoP.
Error handlingnone
Return valuenone
See alsoVF_CtoP,   VF_PolartoC,   VF_CtoReIm,   VF_CtoAbs,   VF_CtoArg

 

VF_CtoReVD_CtoReVE_CtoRe
FunctionExtracts the real part from a cartesian-complex vector.
Syntax C/C++#include <VCFstd.h>
void VF_CtoRe( fVector Re, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoRe( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoRe( Re:fVector; X:cfVector; size:UInt );
DescriptionThe real part of the complex vector X is extracted and stored in Re.
Error handlingnone
Return valuenone
See alsoVF_CtoReIm,   VF_ReImtoC,   VF_RetoC,   VF_PolartoC

 

VF_CtoReImVD_CtoReImVE_CtoReIm
FunctionExtracts the real and imaginary parts from a cartesian-complex vector.
Syntax C/C++#include <VCFstd.h>
void VF_CtoReIm( fVector Re, fVector Im, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::CtoReIm( vector<T> Im, const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VF_CtoReIm( Re, Im:fVector; X:cfVector; size:UInt );
DescriptionThe real and imaginary parts of the complex vector X are extracted and stored in Re and Im, resp.
Error handlingnone
Return valuenone
See alsoVF_CtoRe,   VF_ReImtoC,   VF_RetoC,   VF_PolartoC

 

VF_cubicVD_cubicVE_cubic
VFx_cubicVDx_cubicVEx_cubic
VFu_cubicVDu_cubicVEu_cubic
VFux_cubicVDux_cubicVEux_cubic
VCF_cubicVCD_cubicVCE_cubic
VCFx_cubicVCDx_cubicVCEx_cubic
VCFu_cubicVCDu_cubicVCEu_cubic
VCFux_cubicVCDux_cubicVCEux_cubic
VPF_cubicVPD_cubicVPE_cubic
VPFu_cubicVPDu_cubicVPEu_cubic
FunctionCubic (third power)
Syntax C/C++#include <VFmath.h>
int VF_cubic( fVector Y, fVector X, ui size );
int VFx_cubic( fVector Y, fVector X, ui size, float A, float B );
int VFu_cubic( fVector Y, fVector X, ui size );
int VFux_cubic( fVector Y, fVector X, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::cubic( const vector<T>& X );
int vector<T>::x_cubic( const vector<T>& X, const T& A, const T& B );
int vector<T>::u_cubic( const vector<T>& X );
int vector<T>::ux_cubic( const vector<T>& X, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_cubic( Y, X:fVector; size:UInt ): IntBool;
function VFx_cubic( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
function VFu_cubic( Y, X:fVector; size:UInt ): IntBool;
function VFux_cubic( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
Descriptionnormal versions: Yi = (Xi)3
expanded versions: Yi = (A*Xi+B)3

"unprotected" versions (prefix VFu_,   VFux_, etc.):
These functions do not perform any error handling, which makes them much faster (up to 50%) than the standard versions. The extended-precision complex (VCEu_ and VCEux_) versions do not take some of the security measures present in the standard version and might fail for results very near the overflow limit; results near the underflow limit might be rendered as 0.

Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_square,   VF_quartic,   VF_sqrt,   VF_pow,   VF_ipow,   VF_poly

 

VCF_dataPlotVCD_dataPlotVCE_dataPlot
FunctionPlot of a complex vector into an existing Cartesian complex plane.
Syntax C/C++#include <Vgraph.h>
void VCF_dataPlot( cfVector X, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::dataPlot( unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VCF_dataPlot( X:cfVector; size, form:UInt; color:COLORREF );
DescriptionThe vector X is plotted into a Cartesian complex plane that has been drawn previously by a call to either VCF_autoPlot, or VCF_2AutoPlot or V_drawAxes.
For a description of the parameters form and color, see VF_xyAutoPlot.
Error handlingnone
Return valuenone
See alsoVCF_autoPlot,   VCF_2AutoPlot,   VF_xyAutoPlot,  chapter 4.12

 

VF_deconvolveVD_deconvolveVE_deconvolve
FunctionDeconvolution
Syntax C/C++#include <VFstd.h>
void VF_deconvolve( fVector Y, fVector Flt, fVector X, fVector Rsp, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::deconvolve( vector<T> Flt, const vector<T>& X, const vector<T>& Rsp );
Pascal/Delphiuses VFstd;
procedure VF_deconvolve( Y, Flt, X, Rsp:fVector; size:UInt );
DescriptionX is assumed to be the result of a convolution of some "true" profile with the response function Rsp; a deconvolution is attempted and stored in Y. A filter Flt is also calculated; if more than one vector is to be deconvolved with the same Rsp, use VF_deconvolve only once and use the filter Flt thus obtained to deconvolve other vectors by calling VF_filter. The response has to be stored in Rsp in wrap-around order: the elements for zero and positive times (or whatever the independent variable is) are stored as Rsp0 to Rspsize/2 and the elements for negative times as Rspsize/2+1 to Rspsize-1.
You may wish to use VF_rotate or VF_reflect to obtain the correct order when constructing the response vector.

X, Y, Rsp, and Flt must all be of the same size, which has to be an integer power of 2. X may be overwritten by Y, Rsp may be overwritten by Flt, but X and Flt as well as Y and Rsp have to be distinct from each other.

Mathematically, Flt is the inverse of the Fourier transform of Rsp. If the Fourier transform of Rsp contains elements equal to zero, all information is lost for the respective frequency and no reconstruction is possible. The best one can do in this case is to accept this loss and to deconvolve only up to those frequencies where still something is left to be reconstructed.
You are therefore advised not to use this function blindly but rather to inspect the Fourier transform of Rsp and decide what to do on the basis of your specific application. If you wish to use this function nevertheless, you may rely on the automatic editing of the filter, built into VF_deconvolve. Thereby, Flt is set to zero (instead of infinity) at those frequences where all information has been lost. You may set the threshold for this implicit editing by VF_setRspEdit. In order to retrieve the threshold actually set, use VF_getRspEdit.

This deconvolution is based on the implicit assumption that X is periodic; if this is not the case, see the description of VF_convolve about how to avoid end effects.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_deconvolve is based) complains "Size must be an integer power of 2" and the program is aborted.
If, by VF_setRspEdit, you specified Trunc.Re = Trunc.Im = 0, SING errors may occur that are handled by setting Flt to ±HUGE_VAL at the respective frequency. During multiplication with the transform of X, this may lead to unhandled floating-point overflow errors (in case your guess of Rsp was wrong and there is some information left at the frequencies where you thought it was not).
Return valuenone
See alsoVF_filter,   VF_convolve,   VF_FFT,   VF_xcorr,   VF_spectrum

 

VF_deleteVD_deleteVE_delete
VCF_deleteVCD_deleteVCE_delete
VPF_deleteVPD_deleteVPE_delete
VI_deleteVSI_deleteVLI_deleteVQI_delete
VU_deleteVUS_deleteVUL_deleteVUI_delete
FunctionDelete one element from a vector
Syntax C/C++#include <VFstd.h>
void VF_delete( fVector X, ui size, ui pos );
C++ VecObj#include <OptiVec.h>
void vector<T>::delete( ui pos );
Pascal/Delphiuses VFstd;
procedure VF_delete( X:fVector; size, pos:UInt );
DescriptionThis is one of the few functions where the input vector itself is changed, instead of being mapped onto an output vector. The element numbered pos is deleted from the vector, and all the following elements are shifted one position lower; the last element is left undefined.
Error handlingnone
Return valuenone
See alsoVF_rotate,   VF_insert

 

VF_derivCVD_derivCVE_derivC
FunctionDerivative of an array with respect to an independent variable sampled at constant intervals
Syntax C/C++#include <VFstd.h>
void VF_derivC( fVector Y, fVector X, ui size, float DeltaT );
C++ VecObj#include <OptiVec.h>
void vector<T>::derivC( const vector<T>& X, T DeltaT );
Pascal/Delphiuses VFstd;
procedure VF_derivC( Y, X:fVector; size:UInt; DeltaT:Single );
DescriptionY(t) = dX(t) / dt.
The vector X is assumed to be a function of a variable t; the t values themselves are equally spaced. Therefore, only the spacing, DeltaT, must be passed to the function. By parabolic interpolation, the derivative of X with respect to t is calculated. This function does the inverse of the integration by VF_runintegralC.
Error handlingnone
Return valuenone
See alsoVF_derivV,   VF_runintegralC

 

VF_derivVVD_derivVVE_derivV
FunctionDerivative of one array with respect to another
Syntax C/C++#include <VFstd.h>
void VF_derivV( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::derivV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_derivV( Z, X, Y:fVector; size:UInt );
DescriptionZ(X) = dY(X) / dX.
The derivative of Y with respect to X is calculated by parabolic interpolation and stored in Z. If the elements of X are equally-spaced, it is better to use VF_derivC. The inverse procedure, i.e. integration, is performed by VF_runintegralV.
Error handlingnone
Return valuenone
See alsoVF_derivC,   VF_runintegralV

 

VF_distributionVD_distributionVE_distribution
FunctionDistribution function
Syntax C/C++#include <VFstd.h>
ui VF_distribution( uiVector Abund, fVector Limits, ui nbins, fVector X, ui sizex, int mode );
C++ VecObj#include <OptiVec.h>
ui vector<ui>::distribution( const vector<T>& Limits, const vector<T>& X, int mode=0 );
Pascal/Delphiuses VFstd;
function VF_distribution( Abund:uVector; Limits:fVector; bins:UInt; X:fVector; sizex:UInt; mode:Integer ):UInt;
DescriptionThis function counts the number of elements of X falling into each of the intervals defined by Limits. The abundances thus determined are stored in Abund.
nbins is the number of elements of Limits, i.e. the number of intervals. sizex is the size of X.

Limits must be in ascending order. The spacing between the elements of Limits need not necessarily be constant.

The parameter mode specifies how to interpret the values given in Limits.
mode > 0: Limits contains the upper limits of the intervals
mode < 0: Limits contains the lower limits of the intervals
mode = 0: Limits contains the mid-points of the intervals. An element of X belongs to the element of Limits closest to it. In case of exactly equal distances, the interval with the lower index is chosen.
The interval defined by Limits0 extends down to -HUGE_VAL, the interval defined by Limitsnbins-1 reaches up to +HUGE_VAL.

The number of elements of X not falling into one of the intervals is returned. For mode > 0, these are the elements greater than the highest limit. For mode < 0, these are the elements smaller than the lowest limit.
For mode = 0, the return value is always zero, because the intervals are open on both sides. So every element of X is accounted for in Abund.

In order to get the normalized distribution function, use the sequence
VF_distribution( Abund, Limits, nbins, X, sizex, 0 );
V_UItoD( Y, Abund, nbins ); /* C/C++ or */
V_UtoD( Y, Abund, nbins ); (* Pascal/Delphi *)
VD_divC( Y, Y, nbins, VD_integralV(Limits,Y,nbins) );

After that, a call to
VD_runintegralC( Y, Y, nbins, 1.0 );
yields the cumulated distribution function.

Error handlingnone
Return valuenumber of elements of X not accounted for in Abund
See alsoVF_searchV

 

VF_divCVD_divCVE_divC
VCF_divCVCD_divCVCE_divC
VCF_divReCVCD_divReCVCE_divReC
VPF_divCVPD_divCVPE_divC
VPF_divReCVPD_divReCVPE_divReC
VI_divCVBI_divCVSI_divCVLI_divCVQI_divC
VU_divCVUB_divCVUS_divCVUL_divCVUI_divC
FunctionDivide by a constant
Syntax C/C++#include <VFmath.h>
void VF_divC( fVector Y, fVector X, ui size, float C );
void VCF_divC( cfVector Y, cfVector X, ui size, fComplex C );
void VCF_divReC( cfVector Y, cfVector X, ui size, float CRe );
C++ VecObj#include <OptiVec.h>
void vector<T>::divC( const vector<T>& X, const T& C );
void vector<complex<T>>::divC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::divReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_divC( Y, X:fVector; size:UInt; C:Single );
procedure VCF_divC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCF_divReC( Y, X:cfVector; size:UInt; CRe:Single );
DescriptionYi = Xi / C
The integer versions perform an integer division, discarding the remainder; the remainder itself may be obtained by the functions of the VI_modC family.
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe by which the complex vector is divided.
Error handlingnone
Return valuenone
See alsoVF_divV,   VF_addC,   VF_subC,   VF_mulC,   VF_divrC,   VF_modC,   VF_visC,   VF_redC

 

VF_divrCVD_divrCVE_divrC
VCF_divrCVCD_divrCVCE_divrC
VCF_divrReCVCD_divrReCVCE_divrReC
VFx_divrCVDx_divrCVEx_divrC
VCFx_divrCVCDx_divrCVCEx_divrC
VPF_divrCVPD_divrCVPE_divrC
VPF_divrReCVPD_divrReCVPE_divrReC
VI_divrCVBI_divrCVSI_divrCVLI_divrCVQI_divrC
VU_divrCVUB_divrCVUS_divrCVUL_divrCVUI_divrC
FunctionReverse division: divide a constant by a vector
Syntax C/C++#include <VFmath.h>
void VF_divrC( fVector Y, fVector X, ui size, float C );
void VFx_divrC( fVector Y, fVector X, ui size, float A, float B, float C );
void VCF_divrC( cfVector Y, cfVector X, ui size, fComplex C );
void VCFx_divrC( cfVector Y, cfVector X, ui size, fComplex A, fComplex B, fComplex C );
void VCF_divrReC( cfVector Y, cfVector X, ui size, float CRe );
C++ VecObj#include <OptiVec.h>
void vector<T>::divrC( const vector<T>& X, const T& C );
void vector<T>::x_divrC( const vector<T>& X, const T& A, const T& B, const T& C );
void vector<complex<T>>::divrC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::x_divrC( const vector<complex<T>>& X, complex<T> A, complex<T> B, complex<T> C );
void vector<complex<T>>::divrReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_divrC( Y, X:fVector; size:UInt; C:Single );
procedure VFx_divrC( Y, X:fVector; size:UInt; A, B, C:Single );
procedure VCF_divrC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCFx_divrC( Y, X:cfVector; size:UInt; A, B, C:fComplex );
procedure VCF_divrReC( Y, X:cfVector; size:UInt; CRe:Single );
Descriptionnormal versions: Yi = C / Xi
expanded versions: Yi = C / (A*Xi+B)
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe which are divided by the complex vector.
Error handlingnone; for the floating-point versions, there are related functions that calculate 1.0 / Xi and 1.0 / (A*Xi+B): VF_inv and VFx_inv, respectively; both of these detect and handle SING errors.
Return valuenone
See alsoVF_divV,   VF_inv,   VF_addC,   VF_subC,   VF_mulC,   VF_divC,   VF_modC,   VF_visC,   VF_redC

 

VF_divrVVD_divrVVE_divrV
VCF_divrVVCD_divrVVCE_divrV
VCF_divrReVVCD_divrReVVCE_divrReV
VFx_divrVVDx_divrVVEx_divrV
VCFx_divrVVCDx_divrVVCEx_divrV
VCFx_divrReVVCDx_divrReVVCEx_divrReV
VPF_divrVVPD_divrVVPE_divrV
VPF_divrReVVPD_divrReVVPE_divrReV
VI_divrVVBI_divrVVSI_divrVVLI_divrVVQI_divrV
VU_divrVVUB_divrVVUS_divrVVUL_divrVVUI_divrV
FunctionDivide two vectors in reverse order
Syntax C/C++#include <VFmath.h>
void VF_divrV( fVector Z, fVector X, fVector Y, ui size );
void VFx_divrV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
void VCF_divrV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_divrReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCFx_divrV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_divrReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );
C++ VecObj#include <OptiVec.h>
void vector<T>::divrV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_divrV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::divrV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::divrReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::x_divrV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_divrReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_divrV( Z, X, Y:fVector; size:UInt );
procedure VFx_divrV( Z, X, Y:fVector; size:UInt; A, B:Single );
procedure VCF_divrV( Z, X, Y:cfVector; size:UInt );
procedure VCF_divrReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCFx_divrV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_divrReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );
Descriptionnormal versions: Zi = Yi / Xi
expanded versions: Zi = Yi / (A*Xi+B)
The complex floating-point versions exist in two variants: in the first variant (e.g., VCF_divrV,   VCFx_divrV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g., VCF_divrReV - "division in reverse order: divide a real vector by a complex one").
Error handlingnone
Return valuenone
See alsoVF_divrC,   VF_divrVI,   VF_addV,   VF_mulV,   VF_modV,   VF_visV,   VF_redV

 

VF_divrVIVD_divrVIVE_divrVI
VF_divrVBIVD_divrVBIVE_divrVBI
VF_divrVSIVD_divrVSIVE_divrVSI
VF_divrVLIVD_divrVLIVE_divrVLI
VF_divrVQIVD_divrVQIVE_divrVQI
VF_divrVUVD_divrVUVE_divrVU
VF_divrVUBVD_divrVUBVE_divrVUB
VF_divrVUSVD_divrVUSVE_divrVUS
VF_divrVULVD_divrVULVE_divrVUL
VF_divrVUIVD_divrVUIVE_divrVUI
FunctionReverse division: divide the elements of an integer vector by corresponding elements of a floating-point vector
Syntax C/C++#include <VFmath.h>
void VF_divrVI( fVector Z, fVector X, iVector Y,ui size );
void VF_divrVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::divrVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::divrVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_divrVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_divrVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Yi / Xi
Error handlingnone
Return valuenone
See alsoVF_divrV,   VF_divVI,   VF_addVI

 

VF_divVVD_divVVE_divV
VFs_divVVDs_divVVEs_divV
VFx_divVVDx_divVVEx_divV
VCF_divVVCD_divVVCE_divV
VCF_divReVVCD_divReVVCE_divReV
VCFx_divVVCDx_divVVCEx_divV
VCFx_divReVVCDx_divReVVCEx_divReV
VPF_divVVPD_divVVPE_divV
VPF_divReVVPD_divReVVPE_divReV
VI_divVVBI_divVVSI_divVVLI_divVVQI_divV
VU_divVVUB_divVVUS_divVVUL_divVVUI_divV
FunctionDivide two vectors
Syntax C/C++#include <VFmath.h>
void VF_divV( fVector Z, fVector X, fVector Y, ui size );
void VFs_divV( fVector Z, fVector X, fVector Y, ui size, float C );
void VFx_divV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
void VCF_divV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_divReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCFx_divV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_divReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );
C++ VecObj#include <OptiVec.h>
void vector<T>::divV( const vector<T>& X, const vector<T>& Y );
void vector<T>::s_divV( const vector<T>& X, const vector<T>& Y, const T& C );
void vector<T>::x_divV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::divV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::divReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::x_divV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_divReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_divV( Z, X, Y:fVector; size:UInt );
procedure VFs_divV( Z, X, Y:fVector; size:UInt; C:Single );
procedure VFx_divV( Z, X, Y:fVector; size:UInt; A, B:Single );
procedure VCF_divV( Z, X, Y:cfVector; size:UInt );
procedure VCF_divReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCFx_divV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_divrReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );
Descriptionnormal versions: Zi = Xi / Yi
scaled versions: Zi = C * (Xi / Yi)
expanded versions: Zi = (A*Xi+B) / Yi
The complex floating-point versions exist in two variants: in the first variant (e.g., VCF_divV,   VCFx_divV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g., VCF_divReV - "divide by a real vector").
Error handlingnone
Return valuenone
See alsoVF_divC,   VF_divVI,   VF_addV,   VF_mulV,   VF_modV,   VF_visV,   VF_redV

 

VF_divVIVD_divVIVE_divVI
VF_divVBIVD_divVBIVE_divVBI
VF_divVSIVD_divVSIVE_divVSI
VF_divVLIVD_divVLIVE_divVLI
VF_divVQIVD_divVQIVE_divVQI
VF_divVUVD_divVUVE_divVU
VF_divVUBVD_divVUBVE_divVUB
VF_divVUSVD_divVUSVE_divVUS
VF_divVULVD_divVULVE_divVUL
VF_divVUIVD_divVUIVE_divVUI
FunctionElement-wise division of a floating-point vector by an integer vector
Syntax C/C++#include <VFmath.h>
void VF_divVI( fVector Z, fVector X, iVector Y,ui size );
void VF_divVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::divVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::divVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_divVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_divVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Xi / Yi
Error handlingnone
Return valuenone
See alsoVF_divV,   VF_divrVI,   VF_addVI

 

V_drawAxes
FunctionDraws a Cartesian coordinate system.
Syntax C/C++#include <Vgraph.h>
void V_drawAxes( long double Xmin, long double Xmax, long double Ymin, long double Ymax );
Pascal/Delphiuses Vgraph;
procedure V_drawAxes( xmin, xmax, ymin, ymax:Extended );
DescriptionA Cartesian coordinate system is drawn with the axes scaled according to the values passed as Xmin, Xmax, Ymin, and Ymax. Ten subdivision lines are drawn on each axis. No adjustment of this scaling is performed; if automatic fine-tuning of the scaling is desired, call V_findAxes instead. Before using this function, either V_initGraph or V_initPlot has to be called. V_drawAxes is used internally by all functions of the AutoPlot family.
Error handlingnone
Return valuenone
See alsoV_findAxes,   V_initPlot,   VF_xyAutoPlot,   VF_xyDataPlot,  chapter 4.12

 

V_DtoFV_DtoE
FunctionData type conversions. See V_FtoD.

 

VF_elementVD_elementVE_element
VCF_elementVCD_elementVCE_element
VPF_elementVPD_elementVPE_element
VI_elementVBI_elementVSI_elementVLI_elementVQI_element
VU_elementVUB_elementVUS_elementVUL_elementVUI_element
FunctionReturns the value of a vector element
Syntax C/C++#include <VFstd.h>
float VF_element( fVector X, ui pos );
C++ VecObj#include <OptiVec.h>
T vector<T>::element( ui pos );
Pascal/Delphiuses VFstd;
function VF_element( X:fVector; pos:UInt ): Single;
DescriptionThe element at the position pos is returned.
Pascal/Delphi only: As fComplex and fPolar return values are not possible, the VCF_ and VPF_ versions store Xpos into the variable xpos.
This function is needed to read elements of dynamically allocated vectors, for which older versions of Borland C++ had a pointer arithmetics bug, and Pascal/Delphi - unlike C - does not provide an own mechanism at all.
VF_element is "read-only". This means, you c a n n o t write something like
VF_element( X, 4 ) := 5;
Error handlingnone
Return valueX[pos] (except Pascal/Delphi complex versions)
See alsoVF_Pelement

 

VF_equ0VD_equ0VE_equ0
VCF_equ0VCD_equ0VCE_equ0
VPF_equ0VPD_equ0VPE_equ0
VI_equ0VBI_equ0VSI_equ0VLI_equ0VQI_equ0
VU_equ0VUB_equ0VUS_equ0VUL_equ0VUI_equ0
Function(Re-) initialize a vector with zero.
Syntax C/C++#include <VFstd.h>
void VF_equ0( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::equ0();
Pascal/Delphiuses VFstd;
procedure VF_equ0( X:fVector; size:UInt );
DescriptionXi = 0
Error handlingnone
Return valuenone
See alsoVF_equ1,   VF_equC,   VF_equV

 

VF_equ1VD_equ1VE_equ1
VCF_equ1VCD_equ1VCE_equ1
VPF_equ1VPD_equ1VPE_equ1
FunctionInitialize a vector with 1.0.
Syntax C/C++#include <VFstd.h>
void VF_equ1( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::equ1();
Pascal/Delphiuses VFstd;
procedure VF_equ1( X:fVector; size:UInt );
DescriptionXi = 1.0
In the cartesian complex versions, the imaginary parts are set to zero. In the polar complex versions, all elements are set to {1.0 @ 0}.
Error handlingnone
Return valuenone
See alsoVF_equ0,   VF_equm1,   VF_equC,   VF_equV

 

VF_equCVD_equCVE_equC
VCF_equCVCD_equCVCE_equC
VPF_equCVPD_equCVPE_equC
VI_equCVBI_equCVSI_equCVLI_equCVQI_equC
VU_equCVUB_equCVUS_equCVUL_equCVUI_equC
FunctionInitializes a vector with a constant value.
Syntax C/C++#include <VFstd.h>
void VF_equC( fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::equC( const T& C );
Pascal/Delphiuses VFstd;
procedure VF_equC( X:fVector; size:UInt; C:Single );
DescriptionXi = C
Error handlingnone
Return valuenone
See alsoVF_equ0,   VF_equ1,   VF_equV,   VF_comb

 

VF_equm1VD_equm1VE_equm1
VCF_equm1VCD_equm1VCE_equm1
VPF_equm1VPD_equm1VPE_equm1
FunctionInitialize a vector with -1.0.
Syntax C/C++#include <VFstd.h>
void VF_equm1( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::equm1();
Pascal/Delphiuses VFstd;
procedure VF_equm1( X:fVector; size:UInt );
DescriptionXi = -1.0
In the cartesian complex versions, the imaginary parts are set to zero. In the polar complex versions, all elements are set to { 1.0 @ p }.
Error handlingnone
Return valuenone
See alsoVF_equ0,   VF_equ1,   VF_equC,   VF_equV

 

VF_equVVD_equVVE_equV
VCF_equVVCD_equVVCE_equV
VFx_equVVDx_equVVEx_equV
VCFx_equVVCDx_equVVCEx_equV
VPF_equVVPD_equVVPE_equV
VI_equVVBI_equVVSI_equVVLI_equVVQI_equV
VU_equVVUB_equVVUS_equVVUL_equVVUI_equV
FunctionCopies one vector to another.
Syntax C/C++#include <VFstd.h>
void VF_equV( fVector Y, fVector X, ui size );
void VFx_equV( fVector Y, fVector X, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::equV( const vector<T>& X );
void vector<T>::x_equV( const vector<T>& X, const T& A, const T& B );
Pascal/Delphiuses VFstd;
procedure VF_equV( Y, X:fVector; size:UInt );
procedure VFx_equV( Y, X:fVector; size:UInt; A, B:Single );
Descriptionnormal versions: Yi = Xi
expanded versions: Yi = A * Xi + B
Error handlingnone
Return valuenone
See alsoVF_equ0,   VF_equ1,   VF_equC

 

VF_erfVD_erfVE_erf
VFx_erfVDx_erfVEx_erf
FunctionError function
Syntax C/C++#include <VFmath.h>
int VF_erf( fVector Y, fVector X, ui size );
int VFx_erf( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::erf( const vector<T>& X );
int vector<T>::x_erf( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_erf( Y,X:fVector; size:UInt ): IntBool;
function VFx_erf( Y,X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = erf( Xi )
expanded versions: Yi = C * erf( A*Xi+B )
Error handlingthis function should be error-proof.
Return valuealways FALSE (0)
See alsoVF_erfc,   VF_Gauss

 

VF_erfcVD_erfcVE_erfc
VFx_erfcVDx_erfcVEx_erfc
FunctionComplementary error function
Syntax C/C++#include <VFmath.h>
int VF_erfc( fVector Y, fVector X, ui size );
int VFx_erfc( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::erfc( const vector<T>& X );
int vector<T>::x_erfc( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_erfc( Y,X:fVector; size:UInt ): IntBool;
function VFx_erfc( Y,X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 1.0 - erf( Xi )
expanded versions: Yi = C * (1.0 - erf( A*Xi+B ))
Error handlingthis function should be error-proof.
Return valuealways FALSE (0)
See alsoVF_erf,   VF_Gauss

 

VF_EuclidVD_EuclidVE_Euclid
FunctionCalculates the Euclidean norm of a vector
Syntax C/C++#include <VFstd.h>
float VF_Euclid( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::Euclid();
Pascal/Delphiuses VFstd;
function VF_Euclid( X:fVector; size:UInt ): Single;
Descriptionnorm = sqrt( sum( Xi2 ) )
The Euclidean norm of a vector is defined as the square-root of the scalar product of the vector with itself.
Error handlingnone (but beware of a possible overflow!)
Return valueThe Euclidean norm is returned
See alsoVF_ssq,   VF_rms,   VF_scalprod,   VF_xprod

 

VF_expVD_expVE_exp
VCF_expVCD_expVCE_exp
VFx_expVDx_expVEx_exp
VCFx_expVCDx_expVCEx_exp
VCF_exptoPVCD_exptoPVCE_exptoP
FunctionExponential function
Syntax C/C++#include <VFmath.h>
int VF_exp( fVector Y, fVector X, ui size );
int VFx_exp( fVector Y, fVector X, ui size, float A, float B, float C );
int VCF_exptoP( pfVector Y, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::exp( const vector<T>& X );
int vector<T>::x_exp( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<polar<T>>::exptoP( const vector<complex<T>>& X );
Pascal/Delphiuses VFmath;
function VF_exp( Y, X:fVector; size:UInt ): IntBool;
function VFx_exp( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VCF_exptoP( Y:pfVector; X:cfVector; size:UInt ): IntBool;
Descriptionnormal versions: Yi = exp( Xi )
expanded versions: Yi = C * exp( A*Xi+B )
Euler's constant e is raised to the Xi'th power.
For cartesian complex numbers, the result can be stored either in cartesian complex format (VCF_exp), or in polar coordinates (VCF_exptoP).
Variants of the exponential function, like its complement (VF_expc), the hyperbolic functions (e.g. VF_sinh), or the Gaussian distribution (VF_Gauss) are also available; see chapter 4.6.7 about "Exponentials" before using VF_exp for sums or other combinations of exponentials - maybe the desired function already exists.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_log,   VF_expc,   VF_pow,   VF_powexp,   VF_sinh,   VF_exp2,   VF_Gauss,   VPF_logtoC,   exp

 

VF_exp2VD_exp2VE_exp2
VFx_exp2VDx_exp2VEx_exp2
FunctionExponential function to the basis 2
Syntax C/C++#include <VFmath.h>
int VF_exp2( fVector Y, fVector X, ui size );
int VFx_exp2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::exp2( const vector<T>& X );
int vector<T>::x_exp2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_exp2( Y, X:fVector; size:UInt ): IntBool;
function VFx_exp2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 2 Xi
expanded versions: Yi = C * 2 (A*Xi+B)
Two is raised to the Xi'th power. These function names are used as synonyms for VF_pow2 etc.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_exp,   VF_exp10,   VF_ipow2,   VF_scale2,   VF_log2

 

VF_exp10VD_exp10VE_exp10
VFx_exp10VDx_exp10VEx_exp10
FunctionExponential function to the basis 10
Syntax C/C++#include <VFmath.h>
int VF_exp10( fVector Y, fVector X, ui size );
int VFx_exp10( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::exp10( const vector<T>& X );
int vector<T>::x_exp10( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_exp10( Y, X:fVector; size:UInt ): IntBool;
function VFx_exp10( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 10 Xi
expanded versions: Yi = C * 10 (A*Xi+B)
Ten is raised to the Xi'th power. These function names are used as synonyms for VF_pow10 etc.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_exp,   VF_exp2,   VF_ipow10,   VF_scale10,   VF_log10

 

VF_expArbBaseVD_expArbBaseVE_expArbBase
VCF_expArbBaseVCD_expArbBaseVCE_expArbBase
VFx_expArbBaseVDx_expArbBaseVEx_expArbBase
VCFx_expArbBaseVCDx_expArbBaseVCEx_expArbBase
FunctionExponential function of an arbitrary base
Syntax C/C++#include <VFmath.h>
int VF_expArbBase( fVector Y, fVector X, ui size, float Base );
int VFx_expArbBase( fVector Y, fVector X, ui size, float Base, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::expArbBase( const vector<T>& X, const T& Base );
int vector<T>::x_expArbBase( const vector<T>& X, const T& Base, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_expArbBase( Y, X:fVector; size:UInt; Base:Single ): IntBool;
function VFx_expArbBase( Y, X:fVector; size:UInt; Base, A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = Base Xi
expanded versions: Yi = C * Base (A*Xi+B)
Base must be positive and non-zero in the real-number versions. In the complex versions, Base must be non-zero.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_exp,   VF_pow

 

VF_expcVD_expcVE_expc
VFx_expcVDx_expcVEx_expc
FunctionComplementary exponential function
Syntax C/C++#include <VFmath.h>
int VF_expc( fVector Y, fVector X, ui size );
int VFx_expc( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::expc( const vector<T>& X );
int vector<T>::x_expc( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_expc( Y, X:fVector; size:UInt ): IntBool;
function VFx_expc( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 1 - exp( Xi )
expanded versions: Yi = C * (1 - exp [A*Xi + B ])
The difference between 1.0 and the exponential function of Xi is calculated. Note that the expc function is directly available from the 80x87 coprocessor in high accuracy; in fact, it is the exponential function itself that is internally calculated via the expc function. The expc function is often encountered in the natural sciences for the description of decay and growth processes.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_log,   VF_exp,   VF_pow,   VF_sinh,   VF_exp2,   VF_Gauss,  exp

 

VF_expmx2VD_expmx2VE_expmx2
VFx_expmx2VDx_expmx2VEx_expmx2
FunctionExponential function of the negative square of the argument
Syntax C/C++#include <VFmath.h>
int VF_expmx2( fVector Y, fVector X, ui size );
int VFx_expmx2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::expmx2( const vector<T>& X );
int vector<T>::x_expmx2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_expmx2( Y, X:fVector; size:UInt ): IntBool;
function VFx_expmx2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = exp( -Xi2 )
expanded versions: Yi = C * exp( -(A*Xi+B)2 )
This function yields a bell-shaped curve similar to the Gaussian function.
Error handlingThis function should be error-proof.
Return valuealways FALSE (0)
See alsoVF_log,   VF_exp,   VF_Gauss,   VF_sech2,   VF_Lorentz,   exp

 

VF_FFTVD_FFTVE_FFT
VF_FFTtoCVD_FFTtoCVE_FFTtoC
VCF_FFTVCD_FFTVCE_FFT
FunctionFast Fourier transform
Syntax C/C++#include <VFstd.h>
void VF_FFT( fVector Y, fVector X, ui size, int dir );
void VCF_FFT( cfVector Y, cfVector X, ui size, int dir );
void VF_FFTtoC( cfVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::FFT( const vector<T>& X, int dir=1 );
void vector<complex<T>>::FFT( const vector<complex<T>>& X, int dir=1 );
void vector<complex<T>>::FFTtoC( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_FFT( Y, X:fVector; size:UInt; dir:Integer );
procedure VCF_FFT( Y, X:cfVector; size:UInt; dir:Integer );
procedure VF_FFTtoC( Y:cfVector; X:fVector; size:UInt );
DescriptionThe Fourier transform of X is calculated and stored in Y. A Fast Fourier Transform algorithm is used that requires size to be a power of 2. The forward transform is obtained by setting dir = 1, the inverse (or backward) transform by setting dir = -1. As usual, the inverse transform involves scaling the result by the factor 1.0/size (complex FFT) or 2.0/size (real FFT). Since it is sometimes desirable to skip this implicit scaling, VF_FFT offers the possibility to do so: specify dir = -2 in this case.
Complex version: Both X and the output Y are complex vectors.
Real-to-complex version: The input vector X is real. The output vector is complex. As this function can only perform a forward transform, no argument "dir" is needed.
Purely real version: For the forward transform, X is a real vector. The output Y is also defined as fVector, although it consists of complex numbers. These are packed in a special way such as to fit into the same amount of memory as the original real vector X. The order of storage in Y is indicated in the following table (N=size, U is the uncompressed Fourier Transform of X):
 
Y0Y1Y2 Y3  .....   YN-2YN-1
U0.ReUN/2.ReU1.Re U1.Im  .....   UN/2-1.ReUN/2-1.Im

The reason for this packing is the following. If the size real data points of X represent a function of the time, X = g(t), then the forward transform yields a function U = G(f) in the frequency domain. In principle, U consists of size+1 complex data points: size/2 points for positive frequencies, another size/2 points for negative frequencies, and one point at frequency zero.
For the Fourier Transform of a real vector, the symmetry relation G(-f) = |G(f)|* holds (the asterisc denoting the complex conjugate). This means that the points at negative frequencies need not be stored; all information is already contained in the positive frequency half. Moreover, the zeroth and the size2'th element of the transform are both purely real. Therefore, only these two real and size/2-1 complex data points have to be stored - which exactly fit into the same amount of memory as the original size real data points of X. This allows X to be overwritten by its transform, if desired.

For the real version of the inverse transform, X has to be a complex vector packed in the way just described, and a real-valued vector Y is obtained.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, an error message "Size must be an integer power of 2" is generated and the program aborted.
Return valuenone
See alsoVF_filter,   VF_convolve,   VF_autocorr,   VF_xcorr,   VF_spectrum

 

VF_filterVD_filterVE_filter
VCF_filterVCD_filterVCE_filter
FunctionFrequency filtering
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/Delphiuses VFstd;
procedure VF_filter( Y, X, Flt:fVector; size:UInt );
DescriptionA 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 (fNyquist = 0.5 / sampling_interval; the desired cutoff frequency is fCutOff):
 

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 */

 
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: UInt;
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 *)
  ...
end;

If X is non-periodic, both ends of the filtered function may be spoiled by wrap-around. See VF_convolve about how to avoid end-effects by embedding X in a larger vector or by removing a possible linear trend.
About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_filter is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuenone
See alsoVF_FFT,   VF_convolve,   VF_autocorr,   VF_xcorr,   VF_spectrum,   VF_smooth

 

V_findAxes
FunctionCalculate an appropriate scaling and draw a Cartesian coordinate system.
Syntax C/C++#include <Vgraph.h>
void V_findAxes( long double Xmin, long double Xmax, long double Ymin, long double Ymax );
Pascal/Delphiuses Vgraph;
procedure V_findAxes( xmin, xmax, ymin, ymax:Extended );
DescriptionThis function will rarely be called by the user, but is used internally in VF_xyAutoPlot and other plotting functions. According to the x- and y ranges given in the parameters Xmin, Xmax, Ymin and Ymax, a linear Cartesian coordinate system is drawn with ten subdivisions both for the abscissa and the ordinate. If necessary, the x and y ranges are enlarged so as to meet the following conditions:
1. Every subdivision line represents an exact (and not only a rounded) value.
2. If the range of one axis or both includes zero, zero falls exactly on a subdivision line.

If the automatic scaling is not desired, use V_drawAxes instead.
Before calling V_findAxes, the plotting routines have to be initialized by either V_initGraph or V_initPlot.

Error handlingnone
Return valuenone
See alsoV_drawAxes,   V_initPlot,   VF_xyAutoPlot

 

VF_floorVD_floorVE_floor
VF_floortoIVD_floortoIVE_floortoI
VF_floortoBIVD_floortoBIVE_floortoBI
VF_floortoSIVD_floortoSIVE_floortoSI
VF_floortoLIVD_floortoLIVE_floortoLI
VF_floortoQIVD_floortoQIVE_floortoQI
VF_floortoUVD_floortoUVE_floortoU
VF_floortoUBVD_floortoUBVE_floortoUB
VF_floortoUSVD_floortoUSVE_floortoUS
VF_floortoULVD_floortoULVE_floortoUL
VF_floortoUIVD_floortoUIVE_floortoUI
FunctionRounding towards minus infinity
Syntax C/C++#include <VFmath.h>
int VF_floor( fVector Y, fVector X, ui size );
int VF_floortoI( iVector Y, fVector X, ui size );
int VF_floortoLI( liVector Y, fVector X, ui size );
int VF_floortoU( uVector Y, fVector X, ui size );

    (similarly all others)
C++ VecObj#include <OptiVec.h>
int vector<T>::floor( const vector<T>& X );
int vector<int>::floortoI( const vector<T>& X );
int vector<long>::floortoLI( const vector<T>& X );
int vector<unsigned>::floortoU( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_floor( Y, X:fVector; size:UInt ):IntBool;
function VF_floortoI( Y:iVector; X:fVector; size:UInt ):IntBool;
function VF_floortoLI( Y:liVector; X:fVector; size:UInt ):IntBool;

    (similarly all others)
DescriptionEach element of X is rounded to the nearest whole number that is less than or equal to the input number and the result stored in Y. The functions VF_floortoI,   VF_floortoLI,   VF_floortoU, etc. convert the result to the various integer data types (in the cases mentioned, to the types int, long int, or unsigned, respectively).
Error handlingOVERFLOW errors are handled by setting the result to the extreme value possible. Negative numbers in the versions VF_floortoU,   VF_floortoUS,   VF_floortoUL, and VF_floortoUI lead to DOMAIN errors; they are handled by setting the result to 0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_round,   VF_ceil,   VF_chop,   VF_trunc,   ceil,   floor

 

VF_flush0VD_flush0VE_flush0
VCF_flush0VCD_flush0VCE_flush0
FunctionSets vector elements with an absolute value less than a certain threshold to 0.
Syntax C/C++#include <VFmath.h>
void VF_flush0( fVector Y, fVector X, ui size, float AbsMin );
void VCF_flush0( fVector Y, fVector X, ui size, fComplex AbsMin );
C++ VecObj#include <OptiVec.h>
void vector<T>::flush0( const vector<T>& X, const T& AbsMin );
void vector<T>::flush0( const vector<T>& X, complex<T> AbsMin );
Pascal/Delphiuses VFmath;
procedure VF_flush0( Y, X:fVector; size:UInt; AbsMin:Single );
procedure VCF_flush0( Y, X:cfVector; size:UInt; AbsMin:fComplex );
DescriptionYi = Xi, if | Xi | >= AbsMin,
Yi = 0, otherwise
The complex versions treat the real and imaginary parts separately, using the real and imaginary parts of AbsMin to determine where to cut. If only the imaginary part is to be edited, set the real part of AbsMin to zero, e.g. (for C/C++):
VCF_flush0( Y, X, size, fcplx( 0, 1.e-6 ));
Error handlingnone
Return valuenone
See alsoVF_limit,   VF_maxC

 

VF_fmodCVD_fmodCVE_fmodC
VF_fmodVVD_fmodVVE_fmodV
VFx_fmodVVDx_fmodVVEx_fmodV
FunctionFloating-point modulo division
Syntax C/C++#include <VFmath.h>
void VF_fmodC( fVector Y, fVector X, ui size, float C );
void VF_fmodV( fVector Z, fVector X, fVector Y, ui size );
void VFx_fmodV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::fmodC( const vector<T>& X, const T& C );
void vector<T>::fmodV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_fmodV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/DelphiThese functions are not defined. Use VF_modC,   VF_modV, etc.
DescriptionThese functions have been included in order to provide consistency with ANSI C function names. They are implemented as macros that call VF_modC,   VF_modV,   VFx_modV etc. See these functions for details.

 

VF_fprintVD_fprintVE_fprint
VCF_fprintVCD_fprintVCE_fprint
VPF_fprintVPD_fprintVPE_fprint
VI_fprintVBI_fprintVSI_fprintVLI_fprintVQI_fprint
VU_fprintVUB_fprintVUS_fprintVUL_fprintVUI_fprint
Functionprint a vector to a stream
Syntax C/C++#include <VFstd.h>
void VF_fprint( FILE *stream, fVector X, ui size, unsigned nperline, unsigned linewidth );
C++ VecObj#include <OptiVec.h>
void vector<T>::fprint( FILE *stream, unsigned nperline, unsigned linewidth );
Pascal/Delphiuses VFstd;
procedure VF_fprint( var Stream:Text; X:fVector; size, nperline, linewidth:UInt );
Descriptionsize elements of X are written to stream, nperline in each line of linewidth characters.

Printing starts always with a new line. This may lead to an empty line at the beginning. Especially the first line of a file is reserved for a possible headline.

Each line begins with the index of the first element printed into that line. The index is followed by a colon and by the requested nperline elements.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}. Polar complex numbers are also written in braces, with the Mag and Arg parts separated by an at-sign: {Mag @ Arg}.

In contrast to VF_write and VF_nwrite, it is not possible to override the automatic choice of the format used for printing. The number of digits per element is determined by the available space, which depends in turn on the parameters nperline and linewidth.

Error handlingif nperline exceeds the maximum number of entries possible for the linewidth chosen, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the program chooses the maximum number nperline possible.
Return valuenone
See alsoVF_cprint,   VF_print,   VF_write,   VF_store,   fprintf

 

V_free
FunctionDe-allocate a single vector
Syntax C/C++#include <VecLib.h>
void V_free( void *X );
Pascal/Delphiuses VecLib;
procedure V_free( Ptr:Pointer );
DescriptionThe vector X is freed (i.e. de-allocated). V_free should be used only for the de-allocation of vectors which have previously be allocated by one of the functions of the VF_vector or VF_vector0 family. To free several vectors simultaneously, use V_nfree (C/C++ only).
Error handlingTrying to free a vector that has already been freed, or that has never been allocated memory, leads to a warning message "Cannot free non-existent vector". Program execution is continued without freeing anything in this case.
Return valuenone
See alsoV_nfree,   V_freeAll,   VF_vector,   VF_vector0

 

V_freeAll
FunctionDe-allocate all vectors (and matrices)
Syntax C/C++#include <VecLib.h>
void V_freeAll( void );
Pascal/Delphiuses VecLib;
procedure V_freeAll;
DescriptionAll vectors and matrices previously allocated by one of the functions of the VF_vector,   VF_vector0, or MF_matrix families are freed.
Error handlingnone
Return valuenone
See alsoV_free,   V_nfree,   VF_vector,   VF_vector0

 

VF_frexpVD_frexpVE_frexp
FunctionSplit up the elements of a vector into their mantissa and exponent parts.
Syntax C/C++#include <VFmath.h>
int VF_frexp( fVector Mant, iVector Exp, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::frexp( vector<int> Exp, const vector<T>& X );
Pascal/DelphiThese functions are not available for Pascal/Delphi;
DescriptionThe function is implemented as a macro calling VF_mantexp; the name VF_frexp is included only to maintain consistency with the ANSI C function name frexp. For details, see VF_mantexp and frexp.

 

VI_fsumVBI_fsumVSI_fsumVLI_fsumVQI_fsum
VU_fsumVUB_fsumVUS_fsumVUL_fsumVUI_fsum
Functionsum of the elements of an integer vector, returned in floating-point
Syntax C/C++#include <VIstd.h>
double VI_fsum( iVector X, ui size );

    (similarly VBI_,   VSI_,   VLI_,   VU_,   VUB_,   VUS_,   VUL_,   VUI_)
extended VQI_fsum( qiVector X, ui size );
C++ VecObj#include <OptiVec.h>
double vector<int>::fsum();
extended vector<quad>::fsum();
Pascal/Delphiuses VIstd;
function VI_fsum( X:iVector; size:UInt ); Double;

    (similarly VBI_,   VSI_,   VLI_,   VU_,   VUB_,   VUS_,   VUL_)
function VQI_fsum( X:qiVector; size:UInt ); Extended;
DescriptionThe elements of X are summed up. In order to avoid possible overflow, the sum is accumulated in a floating-point number. The 8, 16, and 32 bit variants return the result in double precision, whereas the 64 bit variant, VQI_fsum, returns an extended.
Error handlingnone
Return valuethe sum in floating-point format
See alsoVF_sum,   VF_mean

 

V_FtoDV_FtoEV_CFtoCDV_CFtoCE
V_DtoFV_DtoEV_CDtoCFV_CDtoCE
V_EtoFV_EtoDV_CEtoCFV_CEtoCD
FunctionData type interconversions.
Syntax C/C++#include <VDstd.h>
    (always include the <V..std.h> file of the destination data-type!)
void V_FtoD( dVector Y, fVector X, ui size );
    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<double>::FtoD( const vector<float>& X );
Pascal/Delphiuses VDstd;
    (always include the unit of the destination data-type!)
procedure V_FtoD( Y:dVector; X:fVector; size:UInt );
    (similarly all other functions of this family)
DescriptionEach element of X is converted from the data type specified for X to the data type specified for Y and stored in Y.
Error handlingOVERFLOW errors in the course of the "down-conversions" (e.g., V_EtoF); are silently handled: the extreme value possible for the destination data type is stored in Y with the correct sign. _matherr is not called.
Return valuenone
See alsoV_ItoF,   V_roundtoI,   V_roundtoLI

 

VF_GaussVD_GaussVE_Gauss
FunctionGaussian normal distribution function.
Syntax C/C++#include <VFmath.h>
int VF_Gauss( fVector Y, fVector X, ui size, float Wid, float Cent, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::Gauss( const vector<T>& X, T Wid, const T& Cent, const T& C );
Pascal/Delphiuses VFmath;
function VF_Gauss( Y, X:fVector; size:UInt; Wid, Cent, C:Single ): IntBool;
DescriptionYi = C / (Wid * sqrt(2*p)) * exp( -0.5*((Xi-Cent) / Wid)2 )
Wid = width of the distribution
Cent = center of the distribution
C is a scaling factor; for C = 1.0, the distribution is normalized.
For Wid = 0, the normal distribution is in fact a delta distribution with Y = C * INF at X = Cent and Y = 0 at all other values of X.
Since infinities are not supported, the existence of a point X = Cent will lead to a SING error in case Wid is zero.
Error handlingSING errors may occur only for a Wid of zero. They are handled with the default result set to ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_expmx2,   VF_erf,   VF_sech2,   VF_Lorentz

 

V_getCoordSystem
FunctionStore the scalings and position of the current coordinate system used for VectorLib plotting operations
Syntax C/C++#include <Vgraph.h>
void V_getCoordSystem( VCOORDSYSTEM *csys );
Pascal/Delphiuses Vgraph;
procedure V_getCoordSystem( var csys: VCOORDSYSTEM );
DescriptionIf one wants to "hop" between several coordinate systems, displayed in one and the same window, one has to store the specifications (position and scalings) of each coordinate system separately, using this function.
The address of a struct VCOORDSYSTEM is needed as the argument. VCOORDSYSTEM is defined in <Vgraph.h> (C/C++) or the unit Vgraph (Pascal/Delphi).
Example C/C++VCOORDSYSTEM csys1;
   ....
  /* create the first plot: */
V_setPlotRegion( 0, 0, 339, 200 );
VF_xyAutoPlot( X1, Y1, size1, PS_SOLID, LightGreen );
V_getCoordSystem( &csys1 ); /* store for later */
   /* create the second plot: */
V_setPlotRegion( 340, 0, 679, 200 );
VF_xyAutoPlot( X2, Y2, size2, PS_SOLID, LightRed );
   /* go back to the first plot: */
VF_setCoordSystem( &csys1 );
   /* add an additional DataPlot: */
VF_xyDataPlot( X1, Z1, size1, PS_SOLID, LightBlue );
Example Pascal/Delphivar cxyx1: VCOORDSYSTEM;
begin
   ....
     (* create the first plot: *)
   V_setPlotRegion( 0, 0, 339, 200 );
   VF_xyAutoPlot( X1, Y1, size1, PS_SOLID, LightGreen );
   V_getCoordSystem( csys1 ); (* store for later *)
      (* create the second plot: *)
   V_setPlotRegion( 340, 0, 679, 200 );
   VF_xyAutoPlot( X2, Y2, size2, PS_SOLID, LightRed );
      (* go back to the first plot: *)
   VF_setCoordSystem( csys1 );
      (* add an additional DataPlot: *)
   VF_xyDataPlot( X1, Z1, size1, PS_SOLID, LightBlue );
end;
Return valuenone
See alsoV_setCoordSystem,   V_setPlotRegion,   V_continuePlot

 

V_getFPAccuracy
FunctionTest the actual precision the coprocessor is switched to
Syntax C/C++#include <VecLib.h>
unsigned V_getFPAccuracy( void );
Pascal/Delphiuses VecLib;
function V_getFPAccuracy: UInt;
DescriptionThis function reads the FPU Control-Word. If the FPU is set to float / Single precision, 1 is returned. In case of double precision, the return value is 2, and extended precision yields 3. In order to change the coprocessor precision, use the (non-standardized) functions offered by the various compilers, or the OptiVec function V_setFPAccuracy.
Return value1, 2, or 3
See alsoV_setFPAccuracy

 

VF_getRspEditVD_getRspEditVE_getRspEdit
FunctionRead the present threshold for the editing of the filter in VF_convolve and VF_deconvolve
Syntax C/C++#include <VFstd.h>
fComplex VF_getRspEdit( void );
C++ VecObj#include <OptiVec.h>
complex <T> vector<T>::getRspEdit();
Pascal/Delphiuses VFstd;
procedure VF_getRspEdit( var Trunc:fComplex );
DescriptionThe threshold for the treatment of round-off errors in the functions for convolution and deconvolution is returned.
Error handlingnone
Return valuepresent threshold.
real part: acts on the real parts of the filter elements
imaginary part: acts on the imaginary parts of the filter elements
See alsoVF_setRspEdit,   VF_convolve,   VF_deconvolve

 

VF_HanningVD_HanningVE_Hanning
Function"Hanning" window for use in spectral analysis
Syntax C/C++#include <VFstd.h>
void VF_Hanning( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::Hanning();
Pascal/Delphiuses VFstd;
procedure VF_Hanning( X:fVector; size:UInt );
DescriptionXi = 0.5 * (1 - cos( 2 p i / (size-1) ))
Error handlingnone
Return valuenone
See alsoVF_Welch,   VF_Parzen,   VF_spectrum

 

VF_hypCVD_hypCVE_hypC
FunctionQuotient of Xi over the sum of Xi and a constant.
Syntax C/C++#include <VFmath.h>
void VF_hypC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::hypC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_hypC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = hyp( Xi, C ) = Xi / (Xi + C)
The function calculating Yi according to this formula is dubbed "hyp" for its formal similarity to the expression constructing a hyperbola.
Error handlingnone
Return valuenone
See alsoVF_hypV,   VF_redC,   VF_addC,   VF_subC,   VF_divC,   VF_visC

 

VF_hypVVD_hypVVE_hypV
VFx_hypVVDx_hypVVEx_hypV
FunctionQuotient of Xi over the sum of Xi and Yi
Syntax C/C++#include <VFmath.h>
void VF_hypV( fVector Z, fVector X, fVector Y, ui size );
void VFx_hypV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::hypV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_hypV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/Delphiuses VFmath;
procedure VF_hypV( Z, X, Y:fVector; size:UInt );
procedure VFx_hypV( Z, X, Y:fVector; size:UInt; A, B:Single );
Descriptionnormal versions: Zi = hyp( Xi, Yi ) = Xi / (Xi + Yi)
expanded versions: Zi = hyp( A*Xi+B), Yi )
Error handlingnone
Return valuenone
See alsoVF_hypC,   VF_redV,   VF_addV,   VF_subV,   VF_divV,   VF_visV

 

VF_hypotCVD_hypotCVE_hypotC
FunctionPythagoras "hypotenuse" function.
Syntax C/C++#include <VFmath.h>
int VF_hypotC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::hypotC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
function VF_hypotC( Y, X:fVector; size:UInt; C:Single ): IntBool;
DescriptionYi = sqrt( Xi2 + C2 )
This is a variant of the famous Pythagorean theorem for the hypotenuse of a right triangle.
Error handlingOVERFLOW errors lead to a default result of HUGE_VAL. Unlike the treatment of the ANSI C function hypot by several compilers, only an overflowing final result is regarded as an error. Intermediate overflows (by the calculation of the square) are avoided by appropriate scaling.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_hypotV,   VF_redC,   VF_visC,   VCF_abs,   hypot

 

VF_hypotVVD_hypotVVE_hypotV
VFx_hypotVVDx_hypotVVEx_hypotV
FunctionPythagoras "hypotenuse" function.
Syntax C/C++#include <VFmath.h>
int VF_hypotV( fVector Z, fVector X, fVector Y, ui size );
int VFx_hypotV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::hypotV( const vector<T>& X, const vector<T>& Y );
int vector<T>::x_hypotV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_hypotV( Z, X, Y:fVector; size:UInt ): IntBool;
function VFx_hypotV( Z, X, Y:fVector; size:UInt; A, B:Single ): IntBool;
Descriptionnormal version: Yi = sqrt( Xi2 + Yi2 )
expanded version: Yi = sqrt( (A*Xi+B)2 + Yi2 )
These are variants of the Pythagoras formula for the hypotenuse of a right triangle.
Error handlingOVERFLOW errors lead to a default result of HUGE_VAL. (Intermediate overflows are avoided by appropriate scaling.)
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_redC,   VF_visC,   VCF_abs,   hypot

 

VCF_imagVCD_imagVCE_imag
VPF_imagVPD_imagVPE_imag
FunctionExtracts the imaginary part from a complex vector.
Syntax C/C++#include <VCFstd.h>
void VCF_imag( fVector Im, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::imag( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VCF_imag( Im:fVector; X:cfVector; size:UInt );
DescriptionIdentical to the VF_CtoIm and VF_PtoIm families. See these functions for details.

 

VF_ImtoCVD_ImtoCVE_ImtoC
FunctionOverwrites the imaginary part of a cartesian-complex vector with a real-valued vector.
Syntax C/C++#include <VCFstd.h>
void VF_ImtoC( cfVector Y, fVector Im, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::ImtoC( const vector<T>& Im );
Pascal/Delphiuses VCFstd;
procedure VF_ImtoC( X:cfVector; Im:fVector; size:UInt );
DescriptionThe imaginary part of the complex vector Y is overwritten with the elements of the real-valued vector Im. The real part of Y is not affected.
Error handlingnone
Return valuenone
See alsoVF_CtoReIm,   VF_ReImtoC,   VF_RetoC,   VF_CtoIm,   VF_PolartoC

 

VF_indpickVD_indpickVE_indpick
VCF_indpickVCD_indpickVCE_indpick
VPF_indpickVPD_indpickVPE_indpick
VI_indpickVBI_indpickVSI_indpickVLI_indpickVQI_indpick
VU_indpickVUB_indpickVUS_indpickVUL_indpickVUI_indpick
FunctionFill a vector with elements "picked" from another one according to their indices.
Syntax C/C++#include <VFstd.h>
void VF_indpick( fVector Y, uiVector Ind, ui size, fVector X );
C++ VecObj#include <OptiVec.h>
void vector<T>::indpick( const vector<ui>& Ind, const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_indpick( Y:fVector; Ind:uVector; size:UInt; X:fVector );
DescriptionYi = X[ Indi ],   i=0,..size-1
The vector Y is filled with size elements taken from X according to their indices specified in Ind. The parameter size refers to Y and Ind. The size of X is unimportant, as long as the elements specified in Ind exist.
Error handlingnone
Return valuenone
See alsoVF_indput,   VF_subvector,   VF_sortind

 

VF_indputVD_indputVE_indput
VCF_indputVCD_indputVCE_indput
VPF_indputVPD_indputVPE_indput
VI_indputVBI_indputVSI_indputVLI_indputVQI_indput
VU_indputVUB_indputVUS_indputVUL_indputVUI_indput
FunctionDistribute the elements of one vector to the places within another vector specified by their indices.
Syntax C/C++#include <VFstd.h>
void VF_indput( fVector Y, fVector X, uiVector Ind, ui sizex );
C++ VecObj#include <OptiVec.h>
void vector<T>::indput( const vector<T>& X, const vector<ui>& Ind );
Pascal/Delphiuses VFstd;
procedure VF_indput( Y, X:fVector; Ind:uVector; sizex:UInt );
DescriptionY[ Indi ] = Xi,   i=0,..sizex-1
The sizex elements of X are put into the places of Y according to the indices specified in Ind. The parameter sizex refers to X and Ind. The size of Y is unimportant, as long as the elements specified in Ind exist.
Error handlingnone
Return valuenone
See alsoVF_indpick,   VF_subvector,   VF_sortind

 

V_initGraph
FunctionInitializes Borland's graphics system and the plotting functions of the VectorLib library (DOS only).
Syntax C/C++#include <Vgraph.h>
void V_initGraph( char *pathtodriver );
Pascal/Delphiuses Vgraph;
procedure V_initGraph( BGI_path:String );
DescriptionIn DOS programs, this function is used to initialize Borland's graphics system by calling Borland's function initgraph and to initialize the VectorLib plotting functions (by internally calling V_initPlot).
The search-path for graphics driver files has to be passed as a pointer to the string pathtodriver (see Borland's function initgraph for details).
The function uses initgraph to automatically detect the graphics driver present. This automatic detection ensures that programs may run on different PC systems without changes in the source code. If, however, it causes problems or for other reasons is not desired, do not use V_initGraph (but first initgraph and then V_initPlot). The global variable V_gmode is set to the graphics mode with the highest resolution possible for the detected graphics driver. If initgraph has already been called, do not use V_initGraph, but call only V_initPlot. Normally, V_initGraph will be called at the beginning of a program that uses graphics; to switch back into text mode within the program, use restorecrtmode. The next call to one of the AutoPlot functions switches again into graphics mode. You may also do that yourself by using
  setgraphmode( V_gmode );
(to do this, the declaration
  external int V_gmode;
has to appear in the module containing this call).
At the end of the program, free the memory allocated for graphics operations and go back to the standard mode with closegraph.

Windows programs do not use the BGI routines. Consequently, BGI initialization is available only under DOS, but not under Windows. V_initPlot has to be used in order to prepare the OptiVec plotting operations under Windows.

Error handlingIn case of failure, grapherrormsg is called, the appropriate error message displayed and the program aborted.
Return valuenone
See alsoV_initPlot,   V_setPlotRegion,   VF_xyAutoPlot,   VF_yAutoPlot,   VF_xyDataPlot,   VCF_autoPlot,   initgraph,   closegraph

 

V_initPlot
FunctionInitialize the global variables used by the plotting functions
Syntax C/C++#include <Vgraph.h>
#ifdef _Windows
    void V_initPlot( HWND vwindow, HDC vdc );
#else
    void V_initPlot( int graphmode );
#endif
Pascal/Delphifor Delphi:
uses Vgraph;
procedure V_initPlot( VPaintBox: TPaintBox );

for Borland Pascal:
uses Vgraph;
{$ifdef Windows}
    procedure V_initPlot( vwindow:HWND; vdc:HDC );
{$else}
    procedure V_initPlot( graphmode:Integer );
{$endif}
DescriptionDOS programs: If the graphics system has been initialized by a call to initgraph,   V_initPlot is used to initialize the global constants necessary for the operation of the VectorLib plotting functions like VF_xyAutoPlot. If the graphics system is not yet initialized, use V_initGraph to initialize both the basic graphics system and the plotting functions; a call to V_initPlot is not necessary then. graphmode is the graphics mode set by initgraph.

C/C++ and Pascal Windows programs:
vwindow is the handle for a window and vdc the handle of a device context. As long as these handles remain valid, future plotting operations (like VF_xyAutoPlot) will be directed to the window specified by vwindow and use the fonts defined in the device context vdc. Be sure that vwindow and vdc are still valid when a plotting operation is performed; if in doubt, call V_initPlot again. The natural place to call V_initPlot is in the virtual element function Paint. Then, the handle of the actual window is made available as "HWindow" by OWL, and the device context is the same as passed as a parameter to Paint.

Delphi programs:
VPaintBox is the paint box into which you wish to get a VectorLib plot. All future VectorLib plotting operations are directed into this paint box, unless you call V_initPlot again, with a new paint box as parameter.

all targets (DOS and Windows):
V_initPlot reserves the rightmost about 2/3 of the screen for following plotting operations, leaving one line empty at the top of the screen and a few lines at the bottom. To override this, call V_setPlotRegion after V_initPlot.

Error handlingnone
Return valuenone
See alsoV_initGraph,   VF_xyAutoPlot,   V_findAxes,   V_drawAxes,   V_setPlotRegion,   V_initPrint

 

V_initPrint
FunctionInitialize VectorLib plotting functions for use with a printer. Windows only!
Syntax C/C++#include <Vgraph.h>
void V_initPrint( HDC printdc );
Pascal/Delphiuses Vgraph;
procedure V_initPrint( printdc: HDC );
DescriptionThis function exists only for Windows. It tells the VectorLib plotting functions to send their output to the printer context specified as printdc. By default, one whole page is reserved for the printout. To change this, call V_setPlotRegion after V_initPrint.
To switch back to screen output, call V_initPlot.
Error handlingnone
Return valuenone
See alsoV_initPlot,   V_setPlotRegion,   VF_xyAutoPlot

 

VF_insertVD_insertVE_insert
VCF_insertVCD_insertVCE_insert
VPF_insertVPD_insertVPE_insert
VI_insertVBI_insertVSI_insertVLI_insertVQI_insert
VU_insertVUB_insertVUS_insertVUL_insertVUI_insert
FunctionInsert an element into a vector
Syntax C/C++#include <VFstd.h>
void VF_insert( fVector X, ui size, ui pos, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::insert( ui pos, const T& C );
Pascal/Delphiuses VFstd;
procedure VF_insert( X:fVector; size, pos:UInt; C:Single );
DescriptionThis is one of the few functions where the input vector is changed itself (instead of being mapped onto an output vector). A new element is inserted at the position pos and has the value C. Elements before pos are unchanged, elements from pos on are shifted one position higher; the last element is lost. (If you wish to save the last element, choose size big enough to have a dummy element at the end of the vector; now it will be the dummy that gets lost.)
Error handlingnone
Return valuenone
See alsoVF_delete,   VF_rotate

 

VF_integralCVD_integralCVE_integralC
FunctionIntegral of an array plotted over an equally-spaced abscissa.
Syntax C/C++#include <VFstd.h>
float VF_integralC( fVector X, ui size, float DeltaT );
C++ VecObj#include <OptiVec.h>
T vector<T>::integralC( T DeltaT );
Pascal/Delphiuses VFstd;
function VF_integralC( X:fVector; size:UInt; DeltaT:Single ): Single;
DescriptionThe vector X is assumed to be a function of a variable t; the t values themselves are equally spaced, so that only the spacing DeltaT is needed. The area under X, i.e. the integral of X over t from t0 to tsize-1 is calculated. If not only the value of the integral is of interest, but a point-by-point integration has to be performed, VF_runintegralC should be used.
Error handlingnone
Return valueThe value of the integral is returned.
See alsoVF_integralV,   VF_runintegralC,   VF_derivC

 

VF_integralVVD_integralVVE_integralV
FunctionIntegral
Syntax C/C++#include <VFstd.h>
float VF_integralV( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::integralV( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_integralV( X, Y:fVector; size:UInt ): Single;
DescriptionThe vector Y is assumed to be a function of X; the integral of Y over X is calculated. If the elements of X are regularly spaced with a constant difference between them, the integral is obtained more efficiently by VF_integralC. If not only the value of the integral is of interest, but a point-by-point integration has to be performed, VF_runintegralV may be used.
Error handlingnone
Return valueThe value of the integral is returned.
See alsoVF_integralC,   VF_runintegralV,   VF_derivV

 

VF_intfracVD_intfracVE_intfrac
FunctionSplit up the elements of a vector into their integer and fractional parts.
Syntax C/C++#include <VFmath.h>
int VF_intfrac( fVector IntPart, fVector FracPart, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::intfrac( vector<T> FracPart, const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_intfrac( IntPart, FracPart, X:fVector; size:UInt ):IntBool;
DescriptionThe integer parts of the elements of X are stored in IntPart, the fractional parts in FracPart. Notice that IntPart is a floating-point vector, even though it contains integer numbers (which might be larger than could be stored in the integer data types).
Error handlingnone
Return valuealways FALSE (0)
See alsoVF_mantexp,  modf (C/C++ only)

 

VF_invVD_invVE_inv
VFx_invVDx_invVEx_inv
VCF_invVCD_invVCE_inv
VCFx_invVCDx_invVCEx_inv
VPF_invVPD_invVPE_inv
FunctionInverse
Syntax C/C++#include <VFmath.h>
int VF_inv( fVector Y, fVector X, ui size );
int VFx_inv( fVector Y, fVector X, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::inv( const vector<T>& X );
int vector<T>::x_inv( const vector<T>& X, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_inv( Y, X:fVector; size:UInt ): IntBool;
function VFx_inv( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
Descriptionnormal versions: Yi = 1.0 / Xi
expanded versions: Yi = 1.0 / (A*Xi+B)
Error handlingSING and OVERFLOW errors lead to a result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_divrC,   VF_divrV

 

VF_ipowVD_ipowVE_ipow
VFx_ipowVDx_ipowVEx_ipow
VFu_ipowVDu_ipowVEu_ipow
VFux_ipowVDux_ipowVEux_ipow
VCF_ipowVCD_ipowVCE_ipow
VCFx_ipowVCDx_ipowVCEx_ipow
VCFu_ipowVCDu_ipowVCEu_ipow
VCFux_ipowVCDux_ipowVCEux_ipow
VPF_ipowVPD_ipowVPE_ipow
VPFu_ipowVPDu_ipowVPEu_ipow
FunctionRaise each element of a vector to a specified integer power.
Syntax C/C++#include <VFmath.h>
int VF_ipow( fVector Y, fVector X, ui size, int Expo );
int VFx_ipow( fVector Y, fVector X, ui size, int Expo, float A, float B, float C );
int VFu_ipow( fVector Y, fVector X, ui size, int Expo );
int VFux_ipow( fVector Y, fVector X, ui size, int Expo, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::ipow( const vector<T>& X );
int vector<T>::x_ipow( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::u_ipow( const vector<T>& X );
int vector<T>::ux_ipow( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_ipow( Y, X:fVector; size:UInt; ipow:Integer ): IntBool;
function VFx_ipow( Y, X:fVector; size:UInt; ipow:Integer; A, B, C:Single ): IntBool;
function VFu_ipow( Y, X:fVector; size:UInt; ipow:Integer ): IntBool;
function VFux_ipow( Y, X:fVector; size:UInt; ipow:Integer; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = XiExpo
expanded versions: Yi = C * (A*Xi+B)Expo
If Expo is larger than a data-type dependent threshold (which will be a very rare occasion), VF_ipow does not calculate the result itself, but calls VF_pow, which is safer and faster in this case.
The "unprotected" versions (prefix VFu_ and VFux_) do not perform any error handling and do not redirect calls to VF_pow. These simplifications make them very fast, but also risky; they should be used very carefully.
Error handlingSING errors occur, if zero is raised to a negative power; the default result is ±HUGE_VAL, as in the case of OVERFLOW errors.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow,   VF_poly,   VF_pow2,   VF_exp,  pow

 

VF_ipow10VD_ipow10VE_ipow10
FunctionInteger powers of 10
Syntax C/C++#include <VFmath.h>
int VF_ipow10( fVector Y, iVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::ipow10( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_ipow10( Y:fVector; X:iVector; size:UInt ): IntBool;
DescriptionYi = 10Xi
Notice: this function (and not VF_pow10 !) is the vectorized form of the function pow10 defined in Borland C/C++.
Error handlingOVERFLOW errors lead to a default result of HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow10,   VF_scale10,   VF_log10,   VF_ipow,   VF_exp,   pow

 

VF_ipow2VD_ipow2VE_ipow2
FunctionInteger powers of 2
Syntax C/C++#include <VFmath.h>
int VF_ipow2( fVector Y, iVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::ipow2( const vector<T>& X );
Pascal/Delphiuses VFmath; function VF_ipow2( Y:fVector; X:iVector; size:UInt ):
DescriptionYi = 2Xi
Error handlingOVERFLOW errors lead to a default result of HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow2,   VF_scale2,   VF_log2,   VF_pow,   VF_exp,   pow

 

VF_iselementCVD_iselementCVE_iselementC
VCF_iselementCVCD_iselementCVCE_iselementC
VPF_iselementCVPD_iselementCVPE_iselementC
VI_iselementCVBI_iselementCVSI_iselementCVLI_iselementCVQI_iselementC
VU_iselementCVUB_iselementCVUS_iselementCVUL_iselementCVUI_iselementC
FunctionTest if one or more elements of a table are equal to C.
Syntax C/C++#include <VFstd.h>
int VF_iselementC( fVector Tab, ui size, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::iselementC( const T& C );
Pascal/Delphiuses VFstd;
function VF_iselementC( Tab:fVector; size:UInt; C:Single ): IntBool;
DescriptionThe vector Tab is searched for the value C. If one or more elements are equal to C, TRUE (+1) is returned, otherwise FALSE (0). No ordering of Tab is assumed and a linear search performed. A related function that finds the table element closest (but not necessarily equal) to C is VF_searchC.
Error handlingnone
Return valueTRUE (+1), if C is an element of X, otherwise FALSE (0).
See alsoVF_searchC,   VF_iselementV,   lfind,   lsearch

 

VF_iselementVVD_iselementVVE_iselementV
VCF_iselementVVCD_iselementVVCE_iselementV
VPF_iselementVVPD_iselementVVPE_iselementV
VI_iselementVVBI_iselementVVSI_iselementVVLI_iselementVVQI_iselementV
VU_iselementVVUB_iselementVVUS_iselementVVUL_iselementVVUI_iselementV
FunctionTest for each element of a vector, if an identical element is present in a table.
Syntax C/C++#include <VFstd.h>
ui VF_iselementV( fVector Y, fVector X, ui sizex, fVector Tab, ui sizetab );
C++ VecObj#include <OptiVec.h>
ui vector<T>::iselementV( const vector<T>& X, const vector<T>& Tab );
Pascal/Delphiuses VFstd;
function VF_iselementV( Y, X:fVector; sizex:UInt; Tab:fVector; sizetab:UInt ):UInt;
DescriptionThe table Tab is searched for each of the elements of X. For those elements of X which are found in Tab, the corresponding element of Y is set to +1 (in the complex versions: {1, 0} ). No ordering of X and Tab is assumed and a linear search for each Xi performed. A related function that finds the table element closest (but not necessarily equal) to each element of X is VF_searchV.
Error handlingnone
Return valueThe number of elements of X for which an element of Tab was found is returned.
See alsoVF_searchV,   VF_iselementC

 

VF_ismonotonVD_ismonotonVE_ismonoton
FunctionTest if the elements of a vector are monotonously increasing or decreasing
Syntax C/C++#include <VFstd.h>
int VF_ismonoton( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::ismonoton( const vector<T>& X );
Pascal/Delphiuses VFstd;
function VF_ismonoton( X:fVector; size:UInt ): Integer;
DescriptionThe vector X is analyzed. If the elements are in strict descending order, -1 is returned; if they are either constant or in strict ascending order, +1 is returned. Otherwise the return value is 0. If X contains passages that are increasing as well as passages that remain at a constant value, X is regarded as monotonous only if the increasing passage follows the constant passage, but not the other way round. Thus, the series 0, 0, 0, 1, 2, 3 will be accepted as monotonous (return value +1), whereas the series 1, 2, 3, 4, 4, 4 will not (return value 0). Also the initially constant, then falling series 0, 0, 0, -1, -2, -3 will not be regarded as monotonous.
Error handlingnone
Return value+1 in case of monotonous rise, or if all elements are identical, -1 in case of monotonously falling values, 0 if neither of these conditions is fulfilled.
See alsoVF_sort

 

V_ItoFV_ItoDV_ItoE
V_BItoFV_BItoDV_BItoE
V_SItoFV_SItoDV_SItoE
V_LItoFV_LItoDV_LItoE
V_QItoFV_QItoDV_QItoE
V_UtoFV_UtoDV_UtoE
V_UBtoFV_UBtoDV_UBtoE
V_UStoFV_UStoDV_UStoE
V_ULtoFV_ULtoDV_ULtoE
V_UItoFV_UItoDV_UItoE
FunctionConvert integer numbers into floating-point data types.
Syntax C/C++#include <VFstd.h>
    (always the include-file belonging to the destination type!)
void V_ItoF( fVector Y, iVector X, ui size );
    (all other functions of this family are similar)
C++ VecObj#include <OptiVec.h>
void vector<float>::ItoF( const vector<int>& Y );
Pascal/Delphiuses VFstd;
    (always the unit belonging to the destination type!)
procedure V_ItoF( Y:fVector; X:iVector; size:UInt );
    (all other functions of this family are similar)
DescriptionEach element of X is converted from the data type int, byte, short int, long int, quad, unsigned, unsigned byte, unsigned short, unsigned long, or ui, resp., into the data type float, double, or extended, resp., and stored in Y. For the inverse procedure, i.e. the conversion of floating-point numbers to integers, the functions of the VF_roundtoI,   VF_floortoI,   VF_ceiltoI, and VF_choptoI families have to be used.
Error handlingnone
Return valuenone
See alsoVF_roundtoI,   VF_floortoI,   VF_ceiltoI,   VF_choptoI,   VF_trunctoI,   V_ItoLI

 

V_ItoBIV_ItoSIV_ItoLIV_ItoQI
V_BItoIV_BItoSIV_BItoLIV_BItoQI
V_SItoIV_SItoBIV_SItoLIV_SItoQI
V_LItoIV_LItoBIV_LItoSIV_LItoQI
V_QItoIV_QItoBIV_QItoSIV_QItoLI
V_UtoUBV_UtoUSV_UtoULV_UtoUI
V_UBtoUV_UBtoUSV_UBtoULV_UBtoUI
V_UStoUV_UStoUBV_UStoULV_UStoUI
V_ULtoUV_ULtoUBV_ULtoUSV_ULtoUI
V_UItoUV_UItoUBV_UItoUSV_UItoUL
V_ItoUV_BItoUBV_SItoUSV_LItoUL
V_UtoIV_UBtoBIV_UStoSIV_ULtoLI
FunctionInterconversion of the integer data types
Syntax C/C++#include <VLIstd.h>
    (or <VIstd.h>, <VUstd.h>,..., resp., depending on the destination data type!)
void V_ItoLI( liVector Y, iVector X, ui size );
    (all other functions of this family are similar)
C++ VecObj#include <OptiVec.h>
void vector<long>::ItoLI( const vector<long>& Y );
Pascal/Delphiuses VLIstd;
    (always the unit belonging to the destination type!)
procedure V_ItoLI( Y:liVector; X:iVector; size:UInt );
    (all other functions of this family are similar)
DescriptionEach element of the vector X is converted into the desired data type and stored in Y.
Error handlingsee chapter 5.2.
Return valuenone
See alsoV_ItoF

 

VF_KeplerVD_KeplerVE_Kepler
VFx_KeplerVDx_KeplerVEx_Kepler
FunctionAngular position of a planet according to Kepler's Second Law
Syntax C/C++#include <VFmath.h>
int VF_Kepler( fVector Y, fVector X, ui size, float T, float e );
int VFx_Kepler( fVector Y, fVector X, ui size, float T, float e, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::Kepler( const vector<T>& X, T t, T e );
int vector<T>::x_Kepler( const vector<T>& X, T t, T e, const T& A, const T& B );
Pascal/Delphi#include <VFmath.h>
function VF_Kepler( Y, X:fVector; size:UInt; T, e:Single ): IntBool;
function VFx_Kepler( Y, X:fVector; size:UInt; T, e, A, B:Single ): IntBool;
Descriptionnormal versions: Yi = Kepler( Xi/T, e );
expanded versions: Yi = Kepler( (A*Xi+B)/T, e );
The time-dependent angular position of a planet is calculated from its round-trip time T and its eccentricity e.
T must be non-zero; e may take on values 0 <= e <= 1. While there is no analytic solution to this problem, described by Johannes Kepler's Second Law, an efficient iterative algorithm is known and is used here. This algorithm is fast and stable up to the hyperbolic limit, e = 1.0.
Rather than treating the problem in terms of the reduced time m = t/T (like it is done in Astronomy textbooks), VF_Kepler expects the real times in X and divides them internally by T.

As there may hardly be any occasions when one might wish to scale the obtained angular position by a constant, no multiplication by C is included in the VFx_ version which, consequently, has only A and B as additional arguments (unlike most of the other "expanded versions" of VectorLib math functions).

This function may not be called while the FPU is set to reduced accuracy, or else it might hang in an infinite loop. See V_setFPAccuracy.

Error handlinge negative or e greater than 1.0 leads to an "Invalid parameter(s)" error. T = 0 leads to all Yi = 0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)

 

VF_LangevinVD_LangevinVE_Langevin
VFx_LangevinVDx_LangevinVEx_Langevin
FunctionLangevin function of dielectric relaxation
Syntax C/C++#include <VFmath.h>
int VF_Langevin( fVector Y, fVector X, ui size );
int VFx_Langevin( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::Langevin( const vector<T>& X );
int vector<T>::x_Langevin( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphi#include <VFmath.h>
function VF_Langevin( Y, X:fVector; size:UInt ): IntBool;
function VFx_Langevin( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = cot( Xi ) - 1/Xi;
expanded versions: x = A * Xi + B;
                                Yi = C * (cot(x) - 1/x);
The Langevin function has an S-shaped graph and describes, e.g., dielectric relaxation phenomena.
Error handlingThis function should be error-proof.
Return valuealways FALSE (0).

 

VF_ldexpVD_ldexpVE_ldexp
FunctionScale by an integer power of 2.
Syntax C/C++#include <VFmath.h>
int VF_ldexp( fVector Y, fVector X, ui size, int expo );
C++ VecObj#include <OptiVec.h>
int vector<T>::ldexp( const vector<T>& X );
Pascal/DelphiThese functions are absent. Use VF_scale2 etc.
DescriptionThese functions are implemented as alias names for VF_scale2 etc., in order to maintain consistency with the ANSI C function name ldexp. For details, see VF_scale2.

 

VF_limitVD_limitVE_limit
VCF_limitVCD_limitVCE_limit
FunctionLimit the values of the elements of a vector to a specified range.
Syntax C/C++#include <VFmath.h>
void VF_limit( fVector Y, fVector X, ui size, float Min, float Max );
void VCF_limit( cfVector Y, cfVector X, ui size, fComplex Min, fComplex Max );
C++ VecObj#include <OptiVec.h>
void vector<T>::limit( const vector<T>& X, T Min, T Max );
void vector<complex<T>>::limit( const vector<complex<T>>& X, complex<T> Min, complex<T> Max );
Pascal/Delphiuses VFmath;
procedure VF_limit( Y, X:fVector; size:UInt; Min, Max:Single );
procedure VCF_limit( Y, X:cfVector; size:UInt; Min, Max:fComplex );
DescriptionReal version:
Yi = Xi , if Min <= Xi <= Max
Yi = Max, if Xi > Max
Yi = Min, if Xi < Min
This function may be seen as a combination of VF_maxC and VF_minC.
Complex version:
Similar to the real version, but the real and imaginary parts are limited separately to the ranges specified in the respective parts of Min and Max.
Error handlingnone
Return valuenone
See alsoVF_maxC,   VF_minC,   VF_min,   VF_flush0

 

VF_lincombVD_lincombVE_lincomb
VCF_lincombVCD_lincombVCE_lincomb
Functionlinear combination of two vectors
Syntax C/C++#include <VFstd.h>
void VF_lincomb( fVector Z, fVector X, fVector Y, ui size, float CX, float CY );
C++ VecObj#include <OptiVec.h>
void vector<T>::lincomb( const vector<T>& X, const vector<T>& Y, const T& CX, const T& CY );
Pascal/Delphiuses VFstd;
procedure VF_lincomb( Z, X, Y:fVector; size:UInt; CX, CY:Single );
DescriptionZi = CX * Xi + CY * Yi
Error handlingnone
Return valuenone
See alsoVFx_addV,   VF_rotateCoordinates

 

VF_linregressVD_linregressVE_linregress
FunctionLinear regression
Syntax C/C++#include <VFstd.h>
void VF_linregress( fVector Param, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::linregress( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_linregress( Param, X, Y:fVector; size:UInt );
DescriptionThe X-Y data are fitted to a straight line y = ax + b; the parameters a and b are determined in such a way that the quantity
h2 = sum( (Yi - y(x=Xi) )2 )
is minimized. Uncertainties da and db are also determined. On output, Param is filled with the 5 elements {a, da, b, db, h2} in the order indicated.
Error handlingnone
Return valuenone
See alsoVF_linregresswW,   VF_corrcoeff,   VF_chi2,   VF_linfit,   VF_nonlinfit

 

VF_linregresswWVD_linregresswWVE_linregresswW
FunctionLinear regression with weights
Syntax C/C++#include <VFstd.h>
void VF_linregresswW( fVector Param, fVector X, fVector Y, fVector InvVar, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::linregresswW( const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar );
Pascal/Delphiuses VFstd;
procedure VF_linregresswW( Param, X, Y, InvVar:fVector; size:UInt );
DescriptionThe X-Y data are weighted with the inverse of their variances and fitted to a straight line y = ax + b; the parameters a and b are determined in such a way as to minimize the merit function
c2 = sum( (1 / Vari) * (Yi - y(x=Xi) )2 )
(see also VF_chi2). The inverse of the variance of each data point has to be passed to the function in the vector InvVar. Uncertainties da and db are also determined. On output, Param is filled with the 5 elements {a, da, b, db, c2} in the order indicated.
Error handlingnone
Return valuenone
See alsoVF_linregress,   VF_corrcoeff,   VF_chi2

 

V_LItoFV_LItoDV_LItoE
FunctionData type interconversions. See V_ItoF!

 

VF_lnVD_lnVE_ln
VCF_lnVCD_lnVCE_ln
VFx_lnVDx_lnVEx_ln
VCFx_lnVCDx_lnVCEx_ln
VPF_lntoCVPD_lntoCVPE_lntoC
FunctionNatural logarithm
Syntax C/C++#include <VFmath.h>
int VF_ln( fVector Y, fVector X, ui size );
int VFx_ln( fVector Y, fVector X, ui size, float A, float B, float C );
int VPF_lntoC( cfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::ln( const vector<T>& X );
int vector<T>::x_ln( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<complex<T>>::lntoC( const vector<polar<T>>& X );
Pascal/Delphiuses VFmath;
function VF_ln( Y, X:fVector; size:UInt ): IntBool;
function VFx_ln( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VPF_lntoC( Y:cfVector; X:pfVector; size:UInt ): IntBool;
DescriptionThese function names are synonyms for the functions of the VF_log family. See VF_log for details.

 

VF_localmaximaVD_localmaximaVE_localmaxima
FunctionFind the indices of local maxima
Syntax C/C++#include <VFstd.h>
ui VF_localmaxima( uiVector Ind, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
ui vector<ui>::localmaxima( const vector<T>& X );
Pascal/Delphiuses VFstd;
function VF_localmaxima( Ind:uVector; X:fVector; size:UInt ):UInt;
DescriptionThe indices of local maxima in X are stored in Ind and the number of local maxima is returned (this is the number of elements of Ind). A local maximum is defined as one element of X that is greater than both its neighbours to the right and to the left. That means that the zero'th and the last element of X (which have only one neighbour) cannot be local maxima. Also, if two adjacent elements are equal, none of them can be a local maximum.
Error handlingnone
Return valuenumber of local maxima found
See alsoVF_maxind,   VF_max,   VF_indpick,   VF_localminima

 

VF_localminimaVD_localminimaVE_localminima
FunctionFind the indices of local minima
Syntax C/C++#include <VFstd.h>
ui VF_localminima( uiVector Ind, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
ui vector<ui>::localminima( const vector<T>& Ind );
Pascal/Delphiuses VFstd;
function VF_localminima( Ind:uVector; X:fVector; size:UInt ):UInt;
DescriptionThe indices of local minima in X are stored in Ind and the number of local minima is returned (this is the number of elements of Ind). A local minimum is defined as one element of X that is smaller than both its neighbours to the right and to the left. That means that the zero'th and the last element of X (which have only one neighbour) cannot be local minima. Also, if two adjacent elements are equal, none of them can be a local minimum.
Error handlingnone
Return valuenumber of local minima found
See alsoVF_minind,   VF_min,   VF_indpick,   VF_localmaxima

 

VF_logVD_logVE_log
VCF_logVCD_logVCE_log
VFx_logVDx_logVEx_log
VCFx_logVCDx_logVCEx_log
VPF_logtoCVPD_logtoCVPE_logtoC
FunctionNatural logarithm
Syntax C/C++#include <VFmath.h>
int VF_log( fVector Y, fVector X, ui size );
int VFx_log( fVector Y, fVector X, ui size, float A, float B, float C );
int VPF_logtoC( cfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::log( const vector<T>& X );
int vector<T>::x_log( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<complex<T>>::logtoC( const vector<polar<T>>& X );
Pascal/Delphiuses VFmath;
function VF_log( Y, X:fVector; size:UInt ): IntBool;
function VFx_log( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VPF_logtoC( Y:cfVector; X:pfVector; size:UInt ): IntBool;
Descriptionnormal versions: Yi = ln( Xi )
expanded versions: Yi = C * ln( A*Xi+B )
The "logarithmus naturalis", i.e. the logarithm to the basis of Euler's constant e is calculated.
The logarithm of polar complex numbers is most naturally stored in cartesian format, as log{Mag@Arg} = {Mag,Arg}. Therefore, the VPF_ version exists only with the result in a cfVector.
Error handlingReal versions: DOMAIN errors occur in the case of negative Xi (including -0.0), with NAN ("not-a-number") as the default result. SING errors occur for Xi= +0.0 and yield a result of -HUGE_VAL. In the complex version, numbers with an imaginary part of zero are always treated as real numbers; therefore, an argument {0, 0} is treated as a real 0, causing a SING error with the default result {-HUGE_VAL, 0}.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_exp,   VF_log2,   VF_log10,   VF_pow,   log

 

VF_log10VD_log10VE_log10
VCF_log10VCD_log10VCE_log10
VFx_log10VDx_log10VEx_log10
VCFx_log10VCDx_log10VCEx_log10
VPF_log10toCVPD_log10toCVPE_log10toC
FunctionDecadic logarithm
Syntax C/C++#include <VFmath.h>
int VF_log10( fVector Y, fVector X, ui size );
int VFx_log10( fVector Y, fVector X, ui size, float A, float B, float C );
int VPF_log10toC( cfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::log10( const vector<T>& X );
int vector<T>::x_log10( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<complex<T>>::log10toC( const vector<polar<T>>& X );
Pascal/Delphiuses VFmath;
function VF_log10( Y, X:fVector; size:UInt ): IntBool;
function VFx_log10( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VPF_log10toC( Y:cfVector; X:pfVector; size:UInt ): IntBool;
Descriptionnormal versions: Yi = lg( Xi )
expanded versions: Yi = C * lg( A*Xi+B )
The decadic logarithm (to the basis of 10) is calculated.
Error handlingReal versions: DOMAIN errors occur in the case of negative Xi (including -0.0), with NAN ("not-a-number") as the default result. SING errors occur for Xi= +0.0 and yield a result of -HUGE_VAL. In the complex version, numbers with an imaginary part of zero are always treated as real numbers; therefore, an argument {0, 0} is treated as a real 0, causing a SING error with the default result {-HUGE_VAL, 0}.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow10,   VF_log,   VF_log2,   VF_pow,   log10 (the latter function is defined in ANSI C; for Pascal, it is available in the unit XMATH coming with OptiVec).

 

VF_log2VD_log2VE_log2
VCF_log2VCD_log2VCE_log2
VFx_log2VDx_log2VEx_log2
VCFx_log2VCDx_log2VCEx_log2
VPF_log2toCVPD_log2toCVPE_log2toC
FunctionBinary logarithm
Syntax C/C++#include <VFmath.h>
int VF_log2( fVector Y, fVector X, ui size );
int VFx_log2( fVector Y, fVector X, ui size, float A, float B, float C );
int VPF_log2toC( cfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::log2( const vector<T>& X );
int vector<T>::x_log2( const vector<polar<T>>& X, const T& A, const T& B, const T& C );
int vector<complex<T>>::log2toC( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_log2( Y, X:fVector; size:UInt ): IntBool;
function VFx_log2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VPF_log2toC( Y:cfVector; X:pfVector; size:UInt ): IntBool;
Descriptionnormal versions: Yi = lb( Xi )
expanded versions: Yi = C * lb( A*Xi+B )
The binary logarithm (to the basis 2) is calculated.
Error handlingReal versions: DOMAIN errors occur in the case of negative Xi (including -0.0), with NAN ("not-a-number") as the default result. SING errors occur for Xi= +0.0 and yield a result of -HUGE_VAL. In the complex version, numbers with an imaginary part of zero are always treated as real numbers; therefore, an argument {0, 0} is treated as a real 0, causing a SING error with the default result {-HUGE_VAL, 0}.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow2,   VF_log,   VF_log10,   VF_pow,   log2 (the latter function is neither defined in ANSI C nor in Pascal/Delphi, but an addition contained in <xmath.h> or in the unit XMATH).

 

VF_LorentzVD_LorentzVE_Lorentz
FunctionLorentzian lineshape function
Syntax C/C++#include <VFmath.h>
int VF_Lorentz( fVector Y, fVector X, ui size, float Wid, float Cent, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::Lorentz( const vector<T>& X, T Wid, const T& Cent, const T& C );
Pascal/Delphiuses VFmath;
function VF_Lorentz( Y, X:fVector; size:UInt; Wid, Cent, C:Single ): IntBool;
DescriptionYi = C * Wid2 / ( (Xi - Cent)2 + Wid2 )
Wid = width of the resonance line
Cent = centre of the line
C is a scaling factor; at the center of the line (Xi=Cent), the amplitude Yi equals C. This is even true for a width of zero.
Error handlingThis function should be error-proof.
Return valuealways FALSE (0)
See alsoVF_Gauss,   VF_sech2

 

VF_MagArgtoPVD_MagArgtoPVE_MagArgtoP
FunctionConstruct a polar complex vector from separate vectors for magnitude and argument
Syntax C/C++#include <VPFstd.h>
void VF_MagArgtoP( pfVector Y, fVector Mag, fVector Arg, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::MagArgtoP( const vector<T>& Mag, const vector<T>& Arg );
Pascal/Delphiuses VPFstd;
procedure VF_MagArgtoP( X:pfVector; Mag, Arg:fVector; size:UInt );
DescriptionThe polar complex vector Y is constructed from the two real vectors Mag and Arg.
Error handlingnone
Return valuenone
See alsoVF_PtoMagArg,   VF_ReImtoC,   VF_MagtoP,   VF_ArgtoP

 

VF_MagArgtoPrincipalVD_MagArgtoPrincipalVE_MagArgtoPrincipal
FunctionConstruct a polar complex vector from separate vectors for magnitude and argument, reducing to the principal value
Syntax C/C++#include <VPFstd.h>
void VF_MagArgtoPrincipal( pfVector Y, fVector Mag, fVector Arg, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::MagArgtoPrincipal( const vector<T>& Mag, const vector<T>& Arg );
Pascal/Delphiuses VPFstd;
procedure VF_MagArgtoPrincipal( X:pfVector; Mag, Arg:fVector; size:UInt );
DescriptionThe polar complex vector Y is constructed from the two real vectors Mag and Arg. The arguments are reduced to the principal value, -p < Arg <= +p
Error handlingnone
Return valuenone
See alsoVPF_principal,   VF_MagArgtoP

 

VF_MagtoPVD_MagtoPVE_MagtoP
FunctionOverwrite the Mag part of a polar complex vector with a real vector
Syntax C/C++#include <VPFstd.h>
void VF_MagtoP( pfVector Y, fVector Mag, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::MagtoP( const vector<T>& Mag );
Pascal/Delphiuses VPFstd;
procedure VF_MagtoP( X:pfVector; Mag:fVector; size:UInt );
DescriptionThe Mag part of the polar complex vector Y is overwritten with the elements of the real-valued vector Mag. The Arg part of Y is not affected.
Error handlingnone
Return valuenone
See alsoVF_PtoMagArg,   VF_MagArgtoP,   VF_ArgtoP

 

VF_mantexpVD_mantexpVE_mantexp
FunctionSplit up the elements of a vector into their mantissa and exponent parts
Syntax C/C++#include <VFmath.h>
int VF_mantexp( fVector MantPart, iVector ExpPart, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::mantexp( vector<int> ExpPart, const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_mantexp( MantPart:fVector; ExpPart:iVector; X:fVector; size:UInt ): IntBool;
DescriptionThe elements of X are split up into their mantissa, stored in MantPart, and exponent, stored as ints in ExpPart.
Error handlingnone
Return valuealways FALSE (0)
See alsoVF_scale2,   VF_intfrac,   frexp (only C/C++),  ldexp (only C/C++)

 

VF_maxVD_maxVE_max
VI_maxVBI_maxVSI_maxVLI_maxVQI_max
VU_maxVUB_maxVUS_maxVUL_maxVUI_max
FunctionFind the largest element of a vector.
Syntax C/C++#include <VFstd.h>
float VF_max( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::_max();
Pascal/Delphiuses VFstd;
function VF_max( X:fVector; size:UInt ): Single;
DescriptionThe vector X is searched for its largest element, whose value is returned. In order to avoid confusion with the macro "max" in C/C++, the VecObj version of this function is written with a leading underbar as "_max".
Error handlingnone
Return valuemaximum value encountered.
See alsoVF_min,   VF_absmax,   VF_maxexp,   VF_runmax,   VF_maxind

 

VF_maxCVD_maxCVE_maxC
VI_maxCVBI_maxCVSI_maxCVLI_maxCVQI_maxC
VU_maxCVUB_maxCVUS_maxCVUL_maxCVUI_maxC
FunctionCompare each element of a vector to a constant and take the larger of the two.
Syntax C/C++#include <VFmath.h>
void VF_maxC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::maxC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_maxC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = Xi, if Xi > C
Yi = C, if Xi <= C
Error handlingnone
Return valuenone
See alsoVF_maxV,   VF_minC,   VF_max,   VF_absmax,   VF_limit,   VF_flush0

 

VF_maxexpVD_maxexpVE_maxexp
FunctionLargest exponent within one vector
Syntax C/C++#include <VFstd.h>
int VF_maxexp( fVector X, ui size );

    (similarly VD_,   VE_)
C++ VecObj#include <OptiVec.h>
int vector<T>::maxexp();
Pascal/Delphiuses VFstd;
function VF_maxexp( X:fVector; size:UInt ): Integer;

    (similarly VD_,   VE_)
DescriptionConsidering that each number can be represented as a product, mantissa * 2exponent, where 1.0 <= mantissa < 2.0, the largest exponent occurring in a vector is returned. If the vector consisted of nothing but zeros, the exponent is returned as -231 (32-bit models) or -215 (16-bit models).
Error handlingnone
Return valuemaximum exponent encountered.
See alsoVF_minexp,   VF_max,   VF_absmax,   VF_runmax,   VF_absmaxind

 

VF_maxindVD_maxindVE_maxind
VI_maxindVBI_maxindVSI_maxindVLI_maxindVQI_maxind
VU_maxindVUB_maxindVUS_maxindVUL_maxindVUI_maxind
FunctionFind the largest element of a vector and its index.
Syntax C/C++#include <VFstd.h>
float VF_maxind( ui *Ind, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::maxind( ui *Ind );
Pascal/Delphiuses VFstd;
function VF_maxind( var Ind:UInt; X:fVector; size:UInt ): Single;
DescriptionThe vector X is searched for its largest element; its value is returned. At the address passed as Ind, the index of this element is stored.In the case of several maxima of equal height, the first one is chosen (i.e., the smallest index is stored in Ind).
Error handlingnone
Return valuemaximum value encountered.
See alsoVF_max,   VF_minind,   VF_absmax,   VF_runmax

 

VCF_maxReImVCD_maxReImVCE_maxReIm
FunctionFind the largest real and imaginary parts occurring in a vector.
Syntax C/C++#include <VFmath.h>
fComplex VCF_maxReIm( cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
complex<T> vector<complex<T>>::maxReIm();
Pascal/Delphiuses VCFstd;
procedure VCF_maxReIm( var Max:fComplex; X:cfVector; size:UInt );
DescriptionThe vector X is separately searched for its largest real and imaginary parts. These are packed together and either returned as an fComplex (in C/C++) or stored in Max (in Pascal/Delphi):
Max.Re: largest real part encountered,
Max.Im: largest imaginary part encountered.
Error handlingnone
Return valueC/C++:
struct or class instance of type fComplex (dComplex, eComplex, resp.), in which the maxima of the real and imaginary parts of X are packed together.
Pascal/Delphi:
since Pascal does not allow complex return values, the result is stored in the variable Max.
See alsoVCF_minReIm,   VCF_absmaxReIm,   VCF_absmax,   VCF_absmaxind

 

VF_maxVVD_maxVVE_maxV
VI_maxVVBI_maxVVSI_maxVVLI_maxVVQI_maxV
VU_maxVVUB_maxVVUS_maxVVUL_maxVVUI_maxV
FunctionCompare each element of a vector to the corresponding element of another vector and take the larger of the two.
Syntax C/C++#include <VFmath.h>
void VF_maxV( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::maxV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFmath;
procedure VF_maxV( Z, X, Y:fVector; size:UInt );
DescriptionZi = Xi, if Xi > Yi
Zi = Yi, if Xi <= Yi
Error handlingnone
Return valuenone
See alsoVF_minV,   VF_maxC,   VF_max,   VF_absmax

 

VF_meanVD_meanVE_mean
VCF_meanVCD_meanVCE_mean
VI_meanVBI_meanVSI_meanVLI_meanVQI_mean
VU_meanVUB_meanVUS_meanVUL_meanVUI_mean
FunctionMean of a one-dimensional distribution
Syntax C/C++#include <VFstd.h>
float VF_mean( fVector X, ui size );

    (similarly VD_,   VE_,   VCF_,   VCD_,   VCE_)
double VI_mean( iVector X, ui size );
    (similarly VBI_,   VSI_,   VLI_,   VU_,   VUB_,   VUS_,   VUL_,   VUI_)
extended VQI_mean( qiVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::mean();
double vector<int>::mean();
extended vector<quad>::mean();
Pascal/Delphiuses VFstd;
function VF_mean( X:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
procedure VCF_mean( var Mean:fComplex; X:cfVector; size:UInt );
    (similarly VCD_,   VCE_)
function VI_mean( X:iVector; size:UInt ); Double;
    (similarly VBI_,   VSI_,   VLI_,   VU_,   VUB_,   VUS_,   VUL_)
function VQI_mean( X:qiVector; size:UInt ); Extended;
Descriptionmean = (1 / size) * sum( Xi )
Integer versions: the mean of a distribution consisting of whole numbers generally is a fractional, i.e. a floating-point number. Therefore, the return value of the 8, 16, and 32-bit integer versions is a double. For the 64-bit integer version, VQI_mean, the return value is an extended.
Error handlingnone
Return valueMean of the vector elements (except complex versions in Pascal/Delphi)
See alsoVF_meanwW,   VF_median,   VF_meanvar,   VI_fsum,   VF_varianceC,   VF_linregress

 

VF_meanabsVD_meanabsVE_meanabs
FunctionMean of the absolute values of a one-dimensional distribution
Syntax C/C++#include <VFstd.h>
float VF_meanabs( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanabs();
Pascal/Delphiuses VFstd;
function VF_meanabs( X:fVector; size: UInt ): Single;
Descriptionmeanabs = (1 / size) * sum(| Xi |)
Error handlingnone
Return valueMean of the absolute values of all vector elements
See alsoVF_mean,   VF_sumabs

 

VF_meanvarVD_meanvarVE_meanvar
FunctionMean and variance of a one-dimensional distribution
Syntax C/C++#include <VFstd.h>
float VF_meanvar( float *Var, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanvar( T *Var );
Pascal/Delphiuses VFstd;
function VF_meanvar( var Variance:Single; X:fVector; size: UInt ): Single;
Descriptionmean = (1 / size) * sum( Xi )
var = (1 / (size-1)) * sum( (Xi - mean)2 )
Note that the denominator in the definition of var is size-1, whereas, in the routine VF_varianceC, it is simply size.The reason for that difference is that here the mean is calculated first and then the variance is determined using this value, whereas in VF_varianceC, the parameter C is pre-set. The mean is returned and the variance stored at the address passed as "Var" (C/C++), or in the variable "variance" (Pascal/Delphi).
Error handlingnone
Return valuemean of the vector elements.
See alsoVF_mean,   VF_varianceC,   VF_varianceV,   VF_sum,   VF_ssq,   VF_ssqdevC,   VF_linregress

 

VF_meanvarwWVD_meanvarwWVE_meanvarwW
FunctionMean and variance with weights
Syntax C/C++#include <VFmath.h>
float VF_meanvarwW( float *Var, fVector X, fVector Wt, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanvarwW( T *Var, const vector<T>& Wt );
Pascal/Delphiuses VFmath;
function VF_meanvarwW( var variance:Single; X, Wt:fVector; size:UInt ): Single;
Descriptionmean = (1 / sum( Wti )) * sum( Xi * Wti )
var = (1 / sum( Wti )) * sum( Wti * (Xi - mean)2 )
The weighted mean is returned and the variance stored at the address passed as "Var" (C/C++) or in the variable "variance" (Pascal/Delphi).
Error handlingnone
Return valuemean of the vector elements.
See alsoVF_meanwW,   VF_varianceCwW,   VF_varianceVwW,   VF_linregress

 

VF_meanwWVD_meanwWVE_meanwW
VCF_meanwWVCD_meanwWVCE_meanwW
FunctionMean with weights
Syntax C/C++#include <VFstd.h>
float VF_meanwW( fVector X, fVector Wt, ui size );

    (similarly VD_,   VE_)
fComplex VCF_meanwW( cfVector X, fVector Wt, ui size );
    (similarly VCD_,   VCE_)
C++ VecObj#include <OptiVec.h>
T vector<T>::meanwW( const vector<T>& Wt );
fComplex vector<complex<T>>::meanwW( const vector<T>& Wt );
Pascal/Delphiuses VFstd;
function VF_meanwW( X, Wt:fVector; size:UInt ): Single;

    (similarly VD_,   VE_)
procedure VCF_meanwW( var Mean:fComplex; X:cfVector; Wt:fVector; size:UInt );
    (similarly VCD_,   VCE_)
DescriptionmeanwW = (1 / sum( Wti )) * sum( Xi * Wti )
Notice that, also in the complex version, the weights are always real rather than complex.
Error handlingnone
Return valueweighted mean of the vector elements (except complex versions in Pascal/Delphi).
See alsoVF_mean,   VF_sum,   VF_ssq,   VF_ssqdevC,   VF_median,   VF_meanvarwW,   VF_linregresswW

 

VF_medianVD_medianVE_median
FunctionMedian of a one-dimensional distribution
Syntax C/C++#include <VFmath.h>
float VF_median( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::median();
Pascal/Delphiuses VFmath;
function VF_median( X:fVector; size:UInt ): Single;
DescriptionThe median of a distribution is defined as the value for which values above and below are equally probable, i.e., for which the number of elements greater and less than the median is equal. If the table X is ordered, the median is simply the element with the index (size+1)/2 (if size is odd) or the mean of the two central elements (if size is even). If a table is not ordered, VF_median finds its median by repeatedly scanning the table through, without actually sorting it.
Error handlingnone
Return valueThe median is returned.
See alsoVF_mean,   VF_meanwW,   VF_sum

 

VF_minVD_minVE_min
VI_minVBI_minVSI_minVLI_minVQI_min
VU_minVUB_minVUS_minVUL_minVUI_min
FunctionFinds the smallest (or the most negative) element of a vector.
Syntax C/C++#include <VFstd.h>
float VF_min( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::_min();
Pascal/Delphiuses VFstd;
function VF_min( X:fVector; size:UInt ): Single;
DescriptionThe vector X is searched for its smallest (or most negative) element. In order to avoid confusion with the macro "min" in C/C++, the VecObj version of this function is written with a leading underbar as "_min".
Error handlingnone
Return valueMinimum value encountered.
See alsoVF_absmin,   VF_minexp,   VF_runmin,   VF_minind

 

VF_minCVD_minCVE_minC
VI_minCVBI_minCVSI_minCVLI_minCVQI_minC
VU_minCVUB_minCVUS_minCVUL_minCVUI_minC
FunctionCompare each element of a vector to a constant and take the smaller of the two.
Syntax C/C++#include <VFmath.h>
void VF_minC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::minC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_minC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = Xi,  if Xi <= C
Yi = C,  if Xi > C
Error handlingnone
Return valuenone
See alsoVF_minV,   VF_maxC,   VF_min,   VF_absmin,   VF_limit,   VF_flush0

 

VF_minexpVD_minexpVE_minexp
FunctionSmallest exponent within one vector
Syntax C/C++#include <VFstd.h>
int VF_minexp( fVector X, ui size );

    (similarly VD_,   VE_)
C++ VecObj#include <OptiVec.h>
int vector<T>::minexp();
Pascal/Delphiuses VFstd;
function VF_minexp( X:fVector; size:UInt ): Integer;

    (similarly VD_,   VE_)
DescriptionConsidering that each number can be represented as a product, mantissa * 2exponent, where 1.0 <= mantissa < 2.0, the smallest or most negative exponent occurring in a vector is returned. If the absolutely smallest number was zero, the exponent is returned as -231 (32-bit models) or -215 (16-bit models).
Error handlingnone
Return valueminimum exponent encountered.
See alsoVF_maxexp,   VF_min,   VF_absmin,   VF_runmin,   VF_absminind

 

VF_minindVD_minindVE_minind
VI_minindVBI_minindVSI_minindVLI_minindVQI_minind
VU_minindVUB_minindVUS_minindVUL_minindVUI_minind
FunctionFind the smallest (or the most negative) element of a vector and its index.
Syntax C/C++#include <VFstd.h>
float VF_minind( ui *Ind, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::minind( ui *Ind );
Pascal/Delphiuses VFstd;
function VF_minind( var Ind:UInt; X:fVector; size:UInt ): Single;
DescriptionThe vector X is searched for its smallest (or most negative) element; its value is returned. At the address passed as Ind, the index of this element is stored. In the case of several mimima of equal depth, the first one is chosen (i.e., the smallest of their indices is stored in Ind).
Error handlingnone
Return valueminimum value encountered.
See alsoVF_min,   VF_maxind,   VF_absmin,   VF_runmin

 

VCF_minReImVCD_minReImVCE_minReIm
FunctionFind the smallest (or most negative) real and imaginary parts occurring in a vector.
Syntax C/C++#include <VCFstd.h>
fComplex VCF_minReIm( cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
complex<T> vector<complex<T>>::minReIm();
Pascal/Delphiuses VCFstd;
procedure VCF_minReIm( var Min:fComplex; X:cfVector; size:UInt );
DescriptionThe vector X is separately searched for its smallest real and imaginary parts. These are packed together and either returned as an fComplex (in C/C++) or stored in Min (in Pascal/Delphi):
Min.Re: smallest real part encountered,
Min.Im: smallest imaginary part encountered.
Error handlingnone
Return valueC/C++:
struct or class instance of type fComplex (dComplex, eComplex, resp.), in which the minima of the real and imaginary parts of X are packed together.
Pascal/Delphi:
since Pascal does not allow complex return values, the result is stored in the variable Min.
See alsoVCF_maxReIm,   VCF_absminReIm,   VCF_absmin,   VCF_absminind

 

VF_minVVD_minVVE_minV
VI_minVVBI_minVVSI_minVVLI_minVVQI_minV
VU_minVVUB_minVVUS_minVVUL_minVVUI_minV
FunctionCompare each element of a vector to the corresponding element of another vector and take the smaller of the two.
Syntax C/C++#include <VFmath.h>
void VF_minV( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::minV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_minV( Z, X, Y:fVector; size:UInt );
DescriptionZi = Xi,  if Xi <= Yi
Zi = Yi,  if Xi > Yi
Error handlingnone
Return valuenone
See alsoVF_maxV,   VF_minC,   VF_min,   VF_absmin

 

VF_modCVD_modCVE_modC
VI_modCVBI_modCVSI_modCVLI_modCVQI_modC
VU_modCVUB_modCVUS_modCVUL_modCVUI_modC
FunctionModulus, i.e. the remainder of a division by a constant
Syntax C/C++#include <VFmath.h>
void VF_modC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::modC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_modC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = Xi mod C
Floating-point versions: a constant C = 0.0 leads to all Yi being 0.0, independently of the Xi values (as in the ANSI C math function fmod ).
Integer versions: a constant C = 0 leads to a ZERODIVIDE error (as in the intrinsic "%" operation of ANSI C).
Error handlingnone
Return valuenone (also the floating-point versions are treated as basic arithmetic rather than mathematical functions, despite their relation to the math function fmod).
See alsoVF_modV,   VF_addC,   VF_mulC,   VF_divC,   VF_visC,   VF_redC

 

VF_modfVD_modfVE_modf
FunctionSplit up into integer and fractional parts.
Syntax C/C++#include <VFmath.h>
int VF_modf( fVector IntPart, fVector FracPart, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::modf( vector<T> FracPart, const vector<T>& X );
Pascal/DelphiThese functions are absent. Use VF_intfrac etc.
DescriptionThese functions are implemented as alias names for VF_intfrac etc., in order to maintain consistency with the ANSI C function name modf. For details, see VF_intfrac.

 

VF_modVVD_modVVE_modV
VFx_modVVDx_modVVEx_modV
VI_modVVBI_modVVSI_modVVLI_modVVQI_modV
VU_modVVUB_modVVUS_modVVUL_modVVUI_modV
FunctionModulus, i.e. the remainder of a division of corresponding vector elements
Syntax C/C++#include <VFmath.h>
void VF_modV( fVector Z, fVector X, fVector Y, ui size );
void VFx_modV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::modV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_modV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/Delphiuses VFmath;
procedure VF_modV( Z, X, Y:fVector; size:UInt );
procedure VFx_modV( Z, X, Y:fVector; size:UInt; A, B:Single );
Descriptionnormal versions: Zi = Xi mod Yi
expanded versions: Zi = (A * Xi + B) mod Yi
Floating-point versions: an argument Xi = 0.0 leads to Zi being 0.0, independently of Yi (as in the ANSI C math function fmod).
Integer versions: an argument Xi = 0 leads to a ZERODIVIDE error (as in the intrinsic "%" operation of ANSI C).
Error handlingnone
Return valuenone (also the floating-point versions are treated as basic arithmetic rather than mathematical functions, despite their relation to the math function fmod).
See alsoVF_modC,   VF_addV,   VF_mulV,   VF_divV,   VF_visV,   VF_redV

 

VF_mulCVD_mulCVE_mulC
VCF_mulCVCD_mulCVCE_mulC
VCF_mulReCVCD_mulReCVCE_mulReC
VPF_mulCVPD_mulCVPE_mulC
VPF_mulReCVPD_mulReCVPE_mulReC
VI_mulCVBI_mulCVSI_mulCVLI_mulCVQI_mulC
VU_mulCVUB_mulCVUS_mulCVUL_mulCVUI_mulC
FunctionMultiply all vector elements by a constant
Syntax C/C++#include <VFmath.h>
void VF_mulC( fVector Y, fVector X, ui size, float C );

    (similarly VD_,   VE_,   VI_, etc.)
void VCF_mulC( cfVector Y, cfVector X, ui size, fComplex C );
void VCF_mulReC( cfVector Y, cfVector X, ui size, float CRe );

    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
C++ VecObj#include <OptiVec.h>
void vector<T>::mulC( const vector<T>& X, const T& C );
void vector<complex<T>>::mulC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::mulReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_mulC( Y, X:fVector; size:UInt; C:Single );
procedure VCF_mulC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCF_mulReC( Y, X:cfVector; size:UInt; CRe:Single );
DescriptionYi = C * Xi
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe by which the complex vector is multiplied.
Error handlingnone
Return valuenone
See alsoVF_mulV,   VF_addC,   VF_divC,   VF_divrC,   VF_visC,   VF_redC

 


procedure VCFx_mulVconj( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
VF_mulVVD_mulVVE_mulV
VCF_mulVVCD_mulVVCE_mulV
VCF_mulReVVCD_mulReVVCE_mulReV
VCF_mulVconjVCD_mulVconjVCE_mulVconj
VFs_mulVVDs_mulVVEs_mulV
VFx_mulVVDx_mulVVEx_mulV
VCFx_mulVVCDx_mulVVCEx_mulV
VCFx_mulReVVCDx_mulReVVCEx_mulReV
VCFx_mulVconjVCDx_mulVconjVCEx_mulVconj
VPF_mulVVPD_mulVVPE_mulV
VPF_mulReVVPD_mulReVVPE_mulReV
VI_mulVVBI_mulVVSI_mulVVLI_mulVVQI_mulV
VU_mulVVUB_mulVVUS_mulVVUL_mulVVUI_mulV
FunctionMultiply corresponding vector elements
Syntax C/C++#include <VFmath.h>
void VF_mulV( fVector Z, fVector X, fVector Y, ui size );
void VFs_mulV( fVector Z, fVector X, fVector Y, ui size, float C );
void VFx_mulV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
void VCF_mulV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_mulReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCF_mulVconj( cfVector Z, cfVector X, cfVector Y, ui size );
void VCFx_mulV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_mulReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );
void VCFx_mulVconj( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
C++ VecObj#include <OptiVec.h>
void vector<T>::mulV( const vector<T>& X, const vector<T>& Y );
void vector<T>::s_mulV( const vector<T>& X, const vector<T>& Y, const T& C );
void vector<T>::x_mulV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::mulV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::mulReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::mulVconj( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::x_mulV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_mulReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_mulVconj( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_mulV( Z, X, Y:fVector; size:UInt );
procedure VFs_mulV( Z, X, Y:fVector; size:UInt; C:Single );
procedure VFx_mulV( Z, X, Y:fVector; size:UInt; A, B:Single );
procedure VCF_mulV( Z, X, Y:cfVector; size:UInt );
procedure VCF_mulReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCF_mulVconj( Z, X, Y:cfVector; size:UInt );
procedure VCFx_mulV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_mulReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );
Descriptionnormal versions: Zi = Xi * Yi
scaled versions (VFs_ etc.): Zi = C * (Xi * Yi)
expanded versions (VFx_ etc.): Zi = (A * Xi + B) * Yi
The complex floating-point versions exist in three variants: in the first variant (e.g. VCF_mulV,   VCFx_mulV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g. VCF_mulReV - "multiply by a real vector"); in the third variant, finally (e.g. VCF_mulVconj,   VCFx_mulVconj), X is multiplied by the complex conjugate of Y instead of Y itself.
Error handlingnone
Return valuenone
See alsoVF_mulC,   VF_addV,   VF_subV,   VF_divV,   VF_visV,   VF_mulVI

 

VF_mulVIVD_mulVIVE_mulVI
VF_mulVBIVD_mulVBIVE_mulVBI
VF_mulVSIVD_mulVSIVE_mulVSI
VF_mulVLIVD_mulVLIVE_mulVLI
VF_mulVQIVD_mulVQIVE_mulVQI
VF_mulVUVD_mulVUVE_mulVU
VF_mulVUBVD_mulVUBVE_mulVUB
VF_mulVUSVD_mulVUSVE_mulVUS
VF_mulVULVD_mulVULVE_mulVUL
VF_mulVUIVD_mulVUIVE_mulVUI
FunctionElement-wise multiplication of a floating-point vector by an integer vector
Syntax C/C++#include <VFmath.h>
void VF_mulVI( fVector Z, fVector X, iVector Y,ui size );
void VF_mulVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::mulVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::mulVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_mulVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_mulVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Xi * Yi
Error handlingnone
Return valuenone
See alsoVF_mulV,   VF_divVI,   VF_addVI

 

VF_negVD_negVE_neg
VCF_negVCD_negVCE_neg
VPF_negVPD_negVPE_neg
VI_negVBI_negVSI_negVLI_negVQI_neg
FunctionNegation
Syntax C/C++#include <VFmath.h>
int VF_neg( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::neg( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_neg( Y, X:fVector; size:UInt ): IntBool;
DescriptionYi = - (Xi)
VBI_,   VSI_,   VI_, and VLI_ versions only: the negation of the most negative number possible (-128 for byte/ByteInt, -32768 for short/SmallInt, -2147483648 for long/LongInt) is again the same - negative! - number. This is due to the implicit modulo-2n arithmetics, where the overflowing byte/ByteInt, +128, is stored as -128, the overflowing short/SmallInt, +32768, is stored as -32768, and the overflowing long/LongInt, +2147483648, is stored as -2147483648.
Error handlingnone
Return valueBy analogy with VF_abs, the floating-point versions are treated as math functions. Therefore, they have a return value which, since no errors can occur, is always FALSE (0). The integer versions have no return value.
See alsoVF_abs,   VCF_conj

 

V_nfree
FunctionDe-allocate memory occupied by one or more vectors.
Syntax C/C++#include <VecLib.h>
void V_nfree( unsigned numfree, ... );
Pascal/DelphiThis function is absent.
DescriptionThe parameter numfree "tells" the function how many vectors it has to free. These vectors follow in the parameter list after numfree. De-allocation of vectors not allocated by one of the functions of the VF_vector or VF_vector0 family is discouraged, especially in Windows programs.
Pascal/Delphi: since a variable number of parameters is not supported in Pascal language, this function is missing.
Example C/C++V_nfree( 3, X, Y, Z );
Return valuenone
See alsoV_free,   V_freeAll,   VF_vector,   VF_vector0

 

VF_noiseVD_noiseVE_noise
FunctionInitialize a vector with "white" noise
Syntax C/C++#include <VFstd.h>
long VF_noise( fVector X, ui size, long seed, float Amp );
C++ VecObj#include <OptiVec.h>
long vector<T>::noise( long seed, const T& Amp );
Pascal/Delphiuses VFstd;
function VF_noise( X:fVector; size:UInt; Seed:LongInt; Amp:Single ): LongInt;
DescriptionWhite noise is generated with the amplitude Amp, i.e., the output values are between -Amp/2 and +Amp/2 (both extrema included). "seed" may be chosen completely arbitrary. Successive calls with the same seed yield identical results; for different values of seed, the obtained results are uncorrelated.

Internally, these functions employ a 32-bit integer random number generator by H.W.Lewis, with additional steps (so-called "Bays-Durham shuffle") to break sequential correlations. This ensures very good randomness, far superior to simpler generators (like the rand function shipped with C/C++ and the Random function of Pascal).

A long value is returned which may be used as new seed for subsequent calls.

Error handlingnone
Return valuelast 32-bit random number internally generated; may be used as new seed value for future calls.
See alsorand,   random,   VF_random

 

VCF_normVCD_normVCE_norm
VCF_normtoCVCD_normtoCVCE_normtoC
VPF_normVPD_normVPE_norm
FunctionNorm (square of the magnitude) of complex numbers.
Syntax C/C++#include <VCFstd>
void VCF_norm( fVector Norm, cfVector X, ui size );
void VPF_norm( fVector Norm, pfVector X, ui size );
void VCF_normtoC( cfVector Norm, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::norm( const vector<complex<T>>& X );
void vector<complex<T>>::normtoC( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VCF_norm( Norm:fVector; X:cfVector; size:UInt );
procedure VPF_norm( Norm:fVector; X:pfVector; size:UInt );
procedure VCF_normtoC( Norm, X:cfVector; size:UInt );
DescriptionVCF_norm is identical to VF_CtoNorm, and VPF_norm is identical to VF_PtoNorm. See those functions for details.
VCF_normtoC calculates the norm of a cartesian complex vector and stores it as a complex vector (with all imaginary parts equal to 0).

 

VI_notVBI_notVSI_notVLI_notVQI_not
VU_notVUB_notVUS_notVUL_notVUI_not
FunctionBit-wise complement
Syntax C/C++#include <VImath.h>
void VI_not( iVector Y, iVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::not( const vector<T>& X );
Pascal/Delphiuses VImath;
procedure VI_not( Y, X:iVector; size:UInt );
DescriptionYi = ~(Xi)
Each single bit of the element Xi is inverted (i.e., it is 0 in Yi, if it was 1 in Xi, and vice versa).
Error handlingnone
Return valuenone
See alsoVI_and,   VI_or,   VI_neg

 

V_noteError
FunctionConstruct and print an error message
Syntax C/C++#include <VecLib.h>
void V_noteError( char *fname, unsigned why );
Pascal/Delphiuses VecLib;
procedure V_noteError( fname:PChar; why:UInt );
DescriptionIn case of an error, the math functions of VectorLib invoke the following steps:
C/C++: First call _matherr (or _matherrl), then inspect the return value of _matherr (or _matherrl) and call V_noteError in case this return value was 0.

Pascal/Delphi: Call V_noteError if V_FPErrorHandlingMode contains fpErrorNote for the type of error that occurred. V_noteError then constructs the appropriate error message and passes it to V_printErrorMsg, which is the function in charge of actually printing the error message.

By default, output is directed to the screen. This may be changed by a call to V_setErrorEventFile (see chapter 5.3).

"fname" is the name of the "complaining" function, and "why" specifies the reason for the complaint.
C/C++: see the description of _matherr in your compiler's documentation for error codes.
How to call V_noteError from a user-defined _matherr function is described in chapter 5.3..

Pascal/Delphi: The parameter "why" may take on the following values:
1 for DOMAIN errors
2 for SING errors
3 for OVERFLOW errors
4 for UNDERFLOW errors
5 for TLOSS errors

This function will not be included in versions of OptiVec for compilers that do already offer the possibility of printing error messages simultaneously to the screen and to an event file.

Return valuenone
See alsoV_setErrorEventFile,   V_printErrorMsg

 

VF_nreadVD_nreadVE_nread
VCF_nreadVCD_nreadVCE_nread
VPF_nreadVPD_nreadVPE_nread
VI_nreadVBI_nreadVSI_nreadVLI_nreadVQI_nread
VU_nreadVUB_nreadVUS_nreadVUL_nreadVUI_nread
FunctionRead the columns of a table from a stream
Syntax C/C++#include <VFstd.h>
void VF_nread( unsigned n, ui size, FILE *stream, ... );
Pascal/Delphiuses VFstd;
procedure VF_nread( VecList:^fVector; n:Word; size:UInt; var stream:Text );
Description C/C++n columns of a table are read into the vectors passed to VF_nread. The number of lines is specified as the number of elements of each vector, which is size.

The entries of each line should be separated by spaces (' ') or tab characters ('\t').

Each line must be terminated by a line-feed character ('\n'). The length of the lines is limited according the following rules:
- Either all lines have the same length. In this case, the length is determined automatically and might in principle be as large as 65535 characters.
- Or the maximum length is given by the number n of vectors to be read and by the data type:
 
VF_ 24*n
VBI_,   VUB_13*n
VD_ 32*n
VSI_,   VUS_21*n
VE_ 40*n
VLI_,   VUL_37*n
VCF_,   VPF_ 48*n
VQI_32*n
VCD_,   VPD_ 64*n
VI_,   VU_as VLI_,   VUL_
(in the 16-bit models as VSI_,   VUS_)
VCE_,   VPE_ 80*n
 

It is possible to read fewer vectors than there are columns in a table. In this case, the trailing columns are neglected. If, however, you try to read more vectors than there are columns, the result is undefined and might lead to an error.

Complex versions (both cartesian and polar):
Real und imaginary (or Mag and Arg) parts may, but need not, be enclosed in braces { }. However, you must be consequent: Either all or no element may be written with braces.

Whole-number versions except VQI_nread:
By default, the numbers to be read are interpreted as decimal numbers. You may use V_setRadix to define any radix between 2 and 36.

Example C/C++VF_nread( 3, 100, DataFile, X, Y, Z );
Description Pascal/Delphin columns of a table are read into the vectors passed as the list VecList to VF_nread. The number of lines is specified as the number of elements of each vector, which is size.

The entries of each line should be separated by spaces (' ') or tab characters (#9). Other separators are not allowed. Each line must be terminated by a line-feed character (#13).

It is possible to read fewer vectors than there are columns in a table. In this case, the trailing columns are neglected. If, however, you try to read more vectors than there are columns, the result is undefined and might lead to an error.

Complex versions (both cartesian and polar):
Real und imaginary (or Mag and Arg) parts may (but need not) be enclosed in braces { }. However, you must be consequent: Either all or no element may be written with braces.

Whereas the C version of these functions follows the conventions of the C functions strtod,   strtol, etc., the Pascal version has to follow the rules applying to the Pascal function Read. This makes the Pascal version much less flexible than the C version:
- no separation characters allowed other than ' ' and #9,
- no automatic truncation of overflowing numbers,
- no function V_setRadix

Example Pascal/Delphivar MyFile: Text;
    X, Y1, Y2: fVector;
    VList: array[0..2] of fVector;
begin
    X := VF_vector( 100 );
    Y1 := VF_vector( 100 );
    Y2 := VF_vector( 100 );
    VList[0] := X; VList[1] := Y1; VList[2] := Y2;
    Assign( MyFile, 'Myfile.DAT' );
    Reset( MyFile );
    VF_nread( @VList, 3, 100, MyFile );
    ...
end;
Error handlingC/C++:
Real, complex and quad versions:
Overflowing numbers are silently truncated to ±HUGE_VAL.
Whole-number versions except VQI_nread:
As long as the numbers can be represented as long or unsigned long, overflowing bits are ignored in the 16-bit versions.
Numbers beyond the long range yield -1 (signed types) or +HUGE_VAL (unsigned types).
Pascal/Delphi:
Overflowing numbers or numbers otherwise not conforming to the format requirements lead to an I/O error.
Return valuenone
See alsoVF_nwrite,   VF_read,   VF_store,   VF_recall, strtod,  strtol (C/C++ only)

 

VF_nwriteVD_nwriteVE_nwrite
VCF_nwriteVCD_nwriteVCE_nwrite
VPF_nwriteVPD_nwriteVPE_nwrite
VI_nwriteVBI_nwriteVSI_nwriteVLI_nwriteVQI_nwrite
VU_nwriteVUB_nwriteVUS_nwriteVUL_nwriteVUI_nwrite
FunctionWrite vectors as the columns of a table into a stream.
Syntax C/C++#include <VFstd.h>
void VF_nwrite( FILE *stream, unsigned n, ui size, ... );
Pascal/Delphiuses VFstd;
procedure VF_nwrite( var stream:Text; VecList:^fVector; n:UInt; size:UInt );
Description C/C++n vectors are written in ASCII format as the columns of a table into stream. The number of lines is given by the number of elements of each vector: size.

The default format and separation may be changed using VF_setWriteFormat and VF_setNWriteSeparate, respectively.

Example C/C++VF_nwrite( DataFile, 3, 100, X, Y, Z );
     /* generates a table with 3 columns and 100 lines;
        the columns are given by X, Y and Z. */
Pascal/Delphin vectors, passed as the list VecList, are written in ASCII format as the columns of a table into stream. The number of lines is given by the number of elements of each vector: size.

The separation character(s) between columns may be changed using VF_setNWriteSeparate. By default, it is a tab character (#9).

Please note that the Pascal version of these functions does not allow a free definition of the output format. Therefore, the function VF_setWriteFormat does not exist in the Pascal/Delphi version.

Error handlingnone
Return valuenone
See alsoVF_write,   VF_nread,   VF_store,   VF_recall,   fprintf

 

VF_ODVD_ODVE_OD
VU_ODtoFVU_ODtoDVU_ODtoE
VUB_ODtoFVUB_ODtoDVUB_ODtoE
VUS_ODtoFVUS_ODtoDVUS_ODtoE
VUL_ODtoFVUL_ODtoDVUL_ODtoE
VUI_ODtoFVUI_ODtoDVUI_ODtoE
VQI_ODtoFVQI_ODtoDVQI_ODtoE
FunctionOptical Density
Syntax C/C++#include <VFmath.h>
int VF_OD( fVector OD, fVector X, fVector X0, ui size );
int VUS_ODtoF( fVector OD, usVector X, usVector X0, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::OD( const vector<T>& X, const vector<T>& X0 );
int vector<flot>::ODtoF( const vector<unsigned>& X, const vector<unsigned>& X0 );
Pascal/Delphiuses VFmath;
function VF_OD( OD, X, X0:fVector; size:UInt ): IntBool;
function VUS_ODtoF( OD:fVector; X, X0:usVector; size:UInt ): IntBool;
DescriptionODi = log10( X0i/Xi ) for (X0i >= ODThresh0 && Xi >= ODThresh),
ODi = 0.0 otherwise
The "optical density" is calculated for positive, non-zero input numbers. By default, ODThresh and ODThresh0 are 0.001 for the versions with floating-point input vectors (VF_OD,   VD_OD, and VE_OD), and 1 for the versions with unsigned-integer input vectors.
The typical application of these functions would be an absorption measurement with a spectrometer, where each element of X corresponds to the light intensity at one specific wavelength, transmitted through the sample, and each element of X0 corresponds to the light intensity measured through air or through a reference sample. Normally, the intensity data will have been digitized with 12-bit or 16-bit precision. In this case, VUS_ODtoF or VUS_ODtoD will be the appropriate functions. For the rare cases of 8-bit or higher than 16-bit digitization, use the VUB_ or VUL_ versions.
You might wish to accumulate several measurements before calculating the OD. For example, repeated measurements in a usVector may be accumulated into a ulVector by VUL_accVUS, before the OD is calculated by VUL_ODtoD. Similarly, you might accumulate 32-bit data into a qiVector by VQI_accVUL and call then, e.g., VQI_ODtoE.

In order to cut off experimental noise, the input-number threshold below which the OD is corrected to 0.0 may be set to arbitrary positive values by VF_setODThresh,   VUS_setODThresh, etc.

If background values have to be taken into account, please use the functions of the VF_ODwDark family.

Error handlingnone
Return valuealways FALSE (0)
See alsoVF_ODwDark,   VF_log10

 

VF_ODwDarkVD_ODwDarkVE_ODwDark
VU_ODtoFwDarkVU_ODtoDwDarkVU_ODtoEwDark
VUB_ODtoFwDarkVUB_ODtoDwDarkVUB_ODtoEwDark
VUS_ODtoFwDarkVUS_ODtoDwDarkVUS_ODtoEwDark
VUL_ODtoFwDarkVUL_ODtoDwDarkVUL_ODtoEwDark
VUI_ODtoFwDarkVUI_ODtoDwDarkVUI_ODtoEwDark
VQI_ODtoFwDarkVQI_ODtoDwDarkVQI_ODtoEwDark
FunctionOptical Density with background subtraction
Syntax C/C++#include <VFmath.h>
int VF_ODwDark( fVector OD, fVector X, fVector XDark, fVector X0, fVector X0Dark, ui size );
int VUS_ODtoFwDark( fVector OD, usVector X, usVector XDark, usVector X0, usVector X0Dark, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::ODwDark( const vector<T>& X, const vector<T>& XDark, const vector<T>& X0, const vector<T>& X0Dark );
int vector<float>::ODtoFwDark( const vector<unsigned>& X, const vector<unsigned>& XDark, const vector<unsigned>& X0, const vector<unsigned>& X0Dark );
Pascal/Delphiuses VFmath;
function VF_ODwDark( OD, X, XDark, X0, X0Dark:fVector; size:UInt ): IntBool;
function VUS_ODtoFwDark( OD:fVector; X, XDark, X0, X0Dark:usVector; size:UInt ): IntBool;
Descriptionxxi = Xi - XiDark
x0i = X0i - X0iDark
ODi = log10( x0i/xxi ),  (x0i >= ODThresh0 && xxi >= ODThresh),
ODi = 0.0  otherwise

Dark currents XDark, X0Dark are subtracted from measured intensity data X, X0. The optical density is calculated for the resulting corrected data. If these happen to become negative or at least smaller than the thresholds ODThresh, ODThresh0, the OD is set to 0.0.

In order to cut off experimental noise, these thresholds may be set to arbitrary positive values by VF_setODThresh,   VU_setODThresh, etc.

Error handlingnone
Return valuealways FALSE (0)
See alsoVF_OD,   VF_setODThresh

 

VI_orVBI_orVSI_orVLI_orVQI_or
VU_orVUB_orVUS_orVUL_orVUI_or
FunctionBit-wise "OR" operation
Syntax C/C++#include <VImath.h>
void VI_or( iVector Y, iVector X, ui size, int C);
void VUL_or( ulVector Y, ulVector X, ui size, unsigned long C );
C++ VecObj#include <OptiVec.h>
void vector<T>::or( const vector<T>& X, const T& C );
Pascal/Delphiuses VImath;
procedure VI_or( Y, X:iVector; size:UInt; C:Integer );
DescriptionYi = (Xi) | C
The bit-wise "inclusive OR" operation is performed on each element Xi with the bit-mask given by C. A bit is 1 in Yi, if it was not simultaneously 0 in Xi and in C, i.e., if it was 1 at least in one of them.
Error handlingnone
Return valuenone
See alsoVI_not,   VI_and,   VI_xor

 

VF_ParzenVD_ParzenVE_Parzen
Function"Parzen" window for spectral analyses
Syntax C/C++#include <VFmath.h>
void VF_Parzen( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::Parzen();
Pascal/Delphiuses VFmath;
procedure VF_Parzen( X:fVector; size:UInt );
DescriptionXi = 1 - |(i - 0.5*(size - 1)) / 0.5*(size + 1)|
Error handlingnone
Return valuenone
See alsoVF_Welch,   VF_Hanning,   VF_spectrum

 

VF_PelementVD_PelementVE_Pelement
VCF_PelementVCD_PelementVCE_Pelement
VI_PelementVBI_PelementVSI_PelementVLI_PelementVQI_Pelement
VU_PelementVUB_PelementVUS_PelementVUL_PelementVUI_Pelement
FunctionPointer to a vector element
Syntax C/C++#include <VFstd.h>
(float *) VF_Pelement( fVector X, ui pos );
C++ VecObj#include <OptiVec.h>
T * vector<T>::Pelement( ui pos );
Pascal/Delphiuses VFstd;
function VF_Pelement( X:fVector; pos:UInt ): PSingle;
DescriptionC/C++:
returns X+pos = &( X[pos] ). This function is needed only for some older versions of Borland C, to avoid a bug in the pointer arithmetics.
Pascal/Delphi:
returns @( X[pos] ). This function is needed to access single vector elements, or to perform pointer arithmetics on dynamically allocated vectors, for which Pascal/Delphi - unlike C - does not provide a built-in mechanism.
Error handlingnone
Return valueC/C++:           X+pos
Pascal/Delphi: @( X[pos] )
See alsoVF_element

 

V_PDtoPFV_PDtoPE
V_PEtoPFV_PEtoPD
V_PFtoPDV_PFtoPE
FunctionData type conversions. See V_FtoD.

 

VCF_polarVCD_polarVCE_polar
VPF_polarVPD_polarVPE_polar
FunctionConstruct a Cartesian or polar complex vector from polar coordinates given as separate vectors.
Syntax C/C++#include <VCFstd>
void VCF_polar( cfVector X, fVector Mag, fVector Arg, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::polar( const vector<T>& Mag, const vector<T>& Arg );
Pascal/Delphiuses VCFstd;
procedure VCF_polar( X:cfVector; Mag, Arg:fVector; size:UInt);
DescriptionIdentical to VF_PolartoC etc. and VF_MagArgtoP, resp. See these functions for details.

 

VF_PolartoCVD_PolartoCVE_PolartoC
FunctionConstruct Cartesian complex numbers from polar coordinates, entered as separate vectors for Mag and Arg.
Syntax C/C++#include <VFmath.h>
void VF_PolartoC( cfVector X, fVector Mag, fVector Arg, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::PolartoC( const vector<T>& Mag, const vector<T>& Arg );
Pascal/Delphiuses VFmath;
procedure VF_PolartoC( X:cfVector; Mag, Arg:fVector; size:UInt );
DescriptionThe polar coordinates Mag (magnitude, absolute value) and Arg (argument, angle) of each element are used to construct the Cartesian complex vector X.
The difference between this function and VF_PtoC is that, in the latter, the input consists of one vector of type pfVector, rather than of two real-valued vectors for Mag and Arg.
Error handlingThe total loss of precision for very large values of Arg is treated tacitly (without an error message); if it occurs, the result is set to {Mag, 0}.
Return valuenone
See alsoVF_PtoC,   VF_CtoPolar,   VF_ReImtoC,   VF_CtoArg,   VF_CtoNorm

 

VF_polyVD_polyVE_poly
VFx_polyVDx_polyVEx_poly
FunctionPolynomial
Syntax C/C++#include <VFmath.h>
int VF_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg );
int VFx_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::poly( const vector<T>& X, const vector<T>& Coeff, unsigned deg );
int vector<T>::x_poly( const vector<T>& X, const vector<T>& Coeff, unsigned deg, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_poly( Y, X:fVector; size:UInt; Coeff:fVector; deg:UInt ): IntBool;
function VFx_poly( Y, X:fVector; size:UInt; Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
Descriptionnormal versions:
Yi = c0 + c1 * Xi + c2 * Xi2 + ... + cn * Xin
expanded versions:
xi = (A*Xi + B),
Yi = c0 + c1 * xi + c2 * xi2 + ... + cn * xin

A polynomial of degree deg is generated for every element of X, using the coefficients contained in the vector Coeff. The coefficients in Coeff have to be ordered in such a way that the constant term is the zero'th element, the linear coefficient the first element etc., up to the deg'th element which is the coefficient for the highest power used in the polynomial. (Beware a frequent source of errors: for a polynomial of deg = 4, there are 5 (!) coefficients; do not forget the constant term).

Error handlingOVERFLOW errors lead to ±HUGE_VAL as the default result. In contrast to the ANSI C function poly (where deg is declared as int), the declaration of deg as unsigned precludes DOMAIN errors (which would occur for negative deg).
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_ipow,   VF_pow,   poly

 

VF_polyinterpolVD_polyinterpolVE_polyinterpol
FunctionPolynomial interpolation of X-Y-table values
Syntax C/C++#include <VFstd.h>
void VF_polyinterpol( fVector Y, fVector X, ui sizex, fVector XTab, fVector YTab, ui sizetab, unsigned deg );
C++ VecObj#include <OptiVec.h>
void vector<T>::polyinterpol( const vector<T>& X, const vector<T>& XTab, const vector<T>& YTab, unsigned deg );
Pascal/Delphiuses VFstd;
procedure VF_polyinterpol( Y, X:fVector; sizex:UInt; XTab, YTab:fVector; sizetab:UInt; deg:UInt );
DescriptionFor each of the sizex elements of X, the corresponding element of Y is interpolated from the XTab-YTab value pairs. XTab must be ordered (either ascending or descending). All values of XTab must be distinct; otherwise a division by zero may occur and lead to a program abort. For each element of X, the routine finds itself the appropriate place in the table. The parameter deg denotes the number of points that will be taken into account for the interpolation (this is not the degree of the interpolating polynomial!). Any value between 0 and 2 will be interpreted as meaning linear interpolation. A maximum of 10-point interpolation is possible.
Error handlingTrying to use too many elements for the interpolation (deg > 10) leads to an error message "Not possible with more than 10 elements" and to a program abort. If deg exceeds sizetab, an error message "Invalid parameter(s)" is displayed and the program aborted.
No other errors are detected (you have to take care yourself that the XTab values are distinct and that the YTab values are not near the limit of overflowing).
Return valuenone
See alsoVF_ratinterpol,   VF_splineinterpol

 

VF_powVD_powVE_pow
VCF_powVCD_powVCE_pow
VFx_powVDx_powVEx_pow
VCFx_powVCDx_powVCEx_pow
VCF_powReExpoVCD_powReExpoVCE_powReExpo
VCFx_powReExpoVCDx_powReExpoVCEx_powReExpo
VPF_powReExpoVPD_powReExpoVPE_powReExpo
FunctionRaise each element of a vector to a specified power
Syntax C/C++#include <VFmath.h>
int VF_pow( fVector Y, fVector X, ui size, float Expo );
int VFx_pow( fVector Y, fVector X, ui size, float Expo, float A, float B, float C );
int VCF_pow( cfVector Y, cfVector X, ui size, fComplex Expo );
int VCFx_pow( cfVector Y, cfVector X, ui size, fComplex Expo, fComplex A, fComplex B, fComplex C );
int VCF_powReExpo( cfVector Y, cfVector X, ui size, float Expo );
int VCFx_powReExpo( cfVector Y, cfVector X, ui size, float Expo, fComplex A, fComplex B, fComplex C );
C++ VecObj#include <OptiVec.h>
int vector<T>::pow( const vector<T>& X, const T& Expo );
int vector<T>::x_pow( const vector<T>& X, const T& Expo, const T& A, const T& B, const T& C );
int vector<complex<T>>::pow( const vector<complex<T>>& X, complex<T> Expo );
int vector<complex<T>>::x_pow( const vector<complex<T>>& X, complex<T> Expo, complex<T> A, complex<T> B, complex<T> C );
int vector<complex<T>>::powReExpo( const vector<complex<T>>& X, const T& Expo );
int vector<complex<T>>::x_powReExpo( const vector<complex<T>>& X, const T& Expo, complex<T> A, complex<T> B, complex<T> C );
Pascal/Delphiuses VFmath;
function VF_pow( Y, X:fVector; size:UInt; Expo:Single ): IntBool;
function VFx_pow( Y, X:fVector; size:UInt; Expo, A, B, C:Single ): IntBool;
function VCF_pow( Y, X:cfVector; size:UInt; Expo:fComplex ): IntBool;
function VCF_powReExpo( Y, X:cfVector; size:UInt; Expo:Single ): IntBool;
function VCFx_powReExpo( Y, X:cfVector; size:UInt; Expo:Single; A, B, C:fComplex ): IntBool;
Descriptionnormal versions: Yi = Xi Expo
expanded versions: Yi = C * ((A*Xi+B) Expo)
If Expo is a moderately small integer number, the functions of this family pass the job to the appropriate routine of the VF_ipow family. More efficiently, the user could do just that himself.
The complex version exists in two variants: one for complex exponents, the other for complex numbers raised to a real exponent.
Error handlingDOMAIN errors occur, if negative numbers are raised to fractional powers; the default result is NAN ("not-a-number"). SING errors occur, if zero is raised to a negative power; the default result is ±HUGE_VAL, which is true for OVERFLOW errors as well.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_ipow,   VF_poly,   VF_pow2,   VF_exp,   VF_powexp,   pow

 

VF_pow10VD_pow10VE_pow10
VFx_pow10VDx_pow10VEx_pow10
FunctionReal powers of 10
Syntax C/C++#include <VFmath.h>
int VF_pow10( fVector Y, fVector X, ui size );
int VFx_pow10( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::pow10( const vector<T>& X );
int vector<T>::x_pow10( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_pow10( Y, X:fVector; size:UInt ): IntBool;
function VFx_pow10( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 10.0 Xi
expanded versions: Yi = C * 10.0A*Xi+B
This is an exponential function to the basis of 10.0.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_ipow10,   VF_scale10,   VF_log10,   VF_pow,   VF_exp,   pow10

 

VF_pow2VD_pow2VE_pow2
VFx_pow2VDx_pow2VEx_pow2
FunctionReal powers of 2
Syntax C/C++#include <VFmath.h>
int VF_pow2( fVector Y, fVector X, ui size );
int VFx_pow2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::pow2( const vector<T>& X );
int vector<T>::x_pow2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_pow2( Y, X:fVector; size:UInt ): IntBool;
function VFx_pow2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = 2.0 Xi
expanded versions: Yi = C * 2.0A*Xi+B
This is an exponential function to the basis of 2.0.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_ipow2,   VF_scale2,   VF_log2,   VF_pow,   VF_exp,   pow

 

VF_powexpVD_powexpVE_powexp
VFx_powexpVDx_powexpVEx_powexp
FunctionPower function, multiplied by exponential function
Syntax C/C++#include <VFmath.h>
int VF_powexp( fVector Y, fVector X, ui size, float Expo );
int VFx_powexp( fVector Y, fVector X, ui size, float Expo, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::powexp( const vector<T>& X, const T& Expo );
int vector<T>::x_powexp( const vector<T>& X, const T& Expo, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_powexp( Y, X:fVector; size:UInt; Expo:Single ): IntBool;
function VFx_powexp( Y, X:fVector; size:UInt; Expo, A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = XiExpo * exp(Xi)
expanded versions: Yi = C * (XiExpo) * exp(A*Xi+B)

Note for the expanded versions that (A*Xi+B) is taken only as the argument of the exponential function, whereas the power function is calculated for (Xi).
The implementation of this function guarantees the correct cancellation of potential simultaneous overflow and underflow of the two constituting factors (for large Xi, if either Expo or A*Xi – but not both – are negative, so that either the power function or the exponential function would yield a very small result, while the other would yield an overflowing result).
In contrast to VF_pow, negative X values in the power function always lead to a DOMAIN error, even if Expo is an integer.

Error handlingDOMAIN errors are caused by negative Xi; the default result is NAN ("not-a-number"). SING errors occur, if zero is raised to a negative power; the default result is ±HUGE_VAL, which is true for OVERFLOW errors as well.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_pow,   VF_poly,   VF_exp,   pow,  exp

 

VPF_principalVPD_principalVPE_principal
FunctionReduce polar complex numbers to principal value
Syntax C/C++#include <VPFstd.h>
void VPF_principal( pfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::principal( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VPF_principal( Y, X:pfVector; size:UInt );
DescriptionThe argument, i.e. the angle of each element is reduced to the range -p < Arg <= +p
Error handlingnone
Return valuenone
See alsoVF_MagArgtoPrincipal

 

VF_printVD_printVE_print
VCF_printVCD_printVCE_print
VI_printVBI_printVSI_printVLI_printVQI_print
VU_printVUB_printVUS_printVUL_printVUI_print
FunctionPrint a vector as ASCII numbers to stdout, assuming a linewidth of 80 characters.
Syntax C/C++#include <VFstd.h>
void VF_print( fVector X, ui size, unsigned nperline );
C++ VecObj#include <OptiVec.h>
void vector<T>::print( unsigned nperline );
Pascal/Delphiuses VFstd;
procedure VF_print( X:fVector; size, nperline:UInt );
Descriptionsize elements of X are printed to stdout, nperline in each line. The available linewidth is assumed to be 80 characters. Each line begins with the index of the first element printed into that line. The index is followed by a colon and by the requested nperline elements.

Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}. Polar complex numbers are also written in braces, with the Mag and Arg parts separated by an at-sign: {Mag @ Arg}.

In contrast to VF_cprint, no paging is performed.
The number of digits per element is determined by the available space, which depends in turn on nperline.

This family of functions is available under Windows only in connection with EasyWin, and should not be used within TurboVision programs.

Error handlingIf nperline exceeds the maximum number of entries possible within 80 characters, an error message "Cannot use requested format (too many entries per line)" is generated; in this case, the program chooses the maximum number nperline possible.
Return valuenone
See alsoVF_cprint,   VF_fprint,   VF_write,   VF_store,   printf (C/C++ only)

 

V_printErrorMsg
FunctionPrint an error message.
Syntax C/C++#include <VecLib.h>
void V_printErrorMsg( char *ErrMsg );
Pascal/Delphiuses VecLib;
procedure V_printErrMsg( ErrMsg: PChar );
DescriptionAs described in connection with V_noteError, this function is in charge of printing error messages. By default, output is directed to the screen. The function V_setErrorEventFile may be used to redirect the output into an event file (exclusively or in addition to the screen message). V_printErrorMsg may be called from user-defined routines in which error conditions are detected. If the message is longer than one line, carriage returns ("\n" or "\r\n" for C/C++, #13 for Pascal/Delphi) have to be included at the desired place. Note, however, that this function will not be included in versions of OptiVec for compilers that do already offer the possibility of printing error messages simultaneously to the screen and to an event file.
Return valuenone
See alsoV_setErrorEventFile,   V_noteError,   _matherr (C/C++ only)

 

VF_prodVD_prodVE_prod
VCF_prodVCD_prodVCE_prod
VPF_prodVPD_prodVPE_prod
FunctionCalculates the product of all the elements of a vector.
Syntax C/C++#include <VFstd.h>
float VF_prod( fVector X, ui size );
fComplex VCF_prod( cfVector X, ui size );
fPolar VPF_prod( pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::prod();
complex<T> vector<complex<T>>::prod();
polar<T> vector<polar<T>>::prod();
Pascal/Delphiuses VFstd;
function VF_prod( X:fVector; size:UInt ): Single;
procedure VCF_prod( var Prod:fComplex; X:cfVector; size:UInt);
procedure VPF_prod( var Prod:fPolar; X:pfVector; size:UInt);
DescriptionThe product of all elements of a vector is calculated.
Error handlingnone (but be careful: this function may easily overflow!)
Return valuethe product of the vector elements (except complex versions in Pascal/Delphi)
See alsoVF_runprod,   VF_sum

 

VF_PtoAbsVD_PtoAbsVE_PtoAbs
FunctionAbsolute value (magnitude) of polar complex numbers
Syntax C/C++#include <VPFstd.h>
void VF_PtoAbs( fVector Abs, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoAbs( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoAbs( Abs:fVector; X:pfVector; size:UInt );
DescriptionThe absolute value, i.e. the magnitude of each element of the polar complex vector X is extracted. This function is identical to VPF_abs and VF_PtoMag. For historical reasons, all three names have been preserved.
Error handlingnone
Return valuenone
See alsoVPF_abs,   VF_PtoMagArg,   VF_PtoArg,   VF_PtoNorm

 

VF_PtoArgVD_PtoArgVE_PtoArg
FunctionArgument (angle) of complex numbers
Syntax C/C++#include <VPFstd.h>
void VF_PtoArg( fVector Arg, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoArg( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoArg( Arg:fVector; X:pfVector; size:UInt );
DescriptionThe argument, i.e. the angle of each element is extracted from the polar complex vector X. In contrast to the analogous function for cartesian complex vectors, VF_CtoArg, no normalization of the argument is performed. If the normalized argument is needed, VPF_principal must be called first.
Error handlingnone
Return valuenone
See alsoVF_PtoAbs,   VF_PtoMagArg,   VF_PtoReIm

 

VF_PtoCVD_PtoCVE_PtoC
FunctionTransformation of a polar complex into a cartesian complex vector
Syntax C/C++#include <VPFstd.h>
void VF_PtoC( cfVector Y, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::PtoC( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoC( Y:cfVector; X:pfVector; size:UInt );
DescriptionX is transformed from polar coordinates {Mag @ Arg} into cartesian coordinates {Re, Im}.
Error handlingnone
Return valuenone
See alsoVF_CtoP,   VF_PtoReIm

 

VF_PtoImVD_PtoImVE_PtoIm
FunctionExtract the imaginary part from a polar complex vector.
Syntax C/C++#include <VPFstd.h>
void VF_PtoIm( fVector Im, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoIm( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoIm( Im:fVector; X:pfVector; size:UInt );
DescriptionThe imaginary part of the polar complex vector X is calculated and stored in Im.
Error handlingnone
Return valuenone
See alsoVF_PtoReIm,   VF_ReImtoP

 

VF_PtoMagVD_PtoMagVE_PtoMag
FunctionExtract the magnitudes of complex numbers
Syntax C/C++#include <VPFstd.h>
void VF_PtoMag( fVector Mag, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoMag( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoMag( Mag:fVector; X:pfVector; size:UInt );
DescriptionThe magnitude of each element is extracted from the polar complex vector X.
Error handlingnone
Return valuenone
See alsoVF_PtoArg

 

VF_PtoMagArgVD_PtoMagArgVE_PtoMagArg
FunctionSplit a polar complex vector into separate vectors for magnitude and argument.
Syntax C/C++#include <VPFstd.h>
void VF_PtoMagArg( fVector Mag, fVector Arg, pfVector X, ui size);
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoMagArg( vector<T> Arg, const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoMagArg( Mag, Arg:fVector; X:pfVector; size:UInt );
DescriptionMagnitude and argument of the polar complex vector X are stored in the separate vectors Mag and Arg.
Error handlingnone
Return valuenone
See alsoVF_PtoRe,   VF_MagArgtoP

 

VF_PtoNormVD_PtoNormVE_PtoNorm
FunctionNorm (square of the absolute value) of complex numbers
Syntax C/C++#include <VPFstd.h>
void VF_PtoNorm( fVector Norm, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoNorm( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoNorm( Norm:fVector; X:pfVector; size:UInt );
DescriptionNormi = Mag2(Xi)
This definition of the Norm of a complex number is the same as in C++, but it is not consistent with the usual definition in mathematics, where the term "norm" is used as a synomym for "absolute value" or "magnitude". As defined here, the Norm is the square of the absolute value. The absolute value itself is available by the function VPF_abs.
Error handlingnone
Return valuenone
See alsoVF_PtoReIm,   VPF_abs

 

VF_PtoReVD_PtoReVE_PtoRe
FunctionExtracts the real part from a polar complex vector.
Syntax C/C++#include <VPFstd.h>
void VF_PtoRe( fVector Re, pfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoRe( const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoRe( Re:fVector; X:pfVector; size:UInt );
DescriptionThe real part of the polar complex vector X is calculated and stored in Re.
Error handlingnone
Return valuenone
See alsoVF_PtoReIm,   VF_PtoIm

 

VF_PtoReImVD_PtoReImVE_PtoReIm
FunctionReal and imaginary parts of a polar complex vector.
Syntax C/C++#include <VPFstd.h>
void VF_PtoReIm( fVector Re, fVector Im, pfVector X, ui size);
C++ VecObj#include <OptiVec.h>
void vector<T>::PtoReIm( vector<T> Im, const vector<polar<T>>& X );
Pascal/Delphiuses VPFstd;
procedure VF_PtoReIm( Re, Im:fVector; X:pfVector; size:UInt );
DescriptionThe polar complex vector X is transformed into cartesian coordinates, which are stored in separate vectors Re and Im.
Error handlingnone
Return valuenone
See alsoVF_PtoRe,   VF_ReImtoP

 

VF_quarticVD_quarticVE_quartic
VFx_quarticVDx_quarticVEx_quartic
VFu_quarticVDu_quarticVEu_quartic
VFux_quarticVDux_quarticVEux_quartic
VCF_quarticVCD_quarticVCE_quartic
VCFx_quarticVCDx_quarticVCEx_quartic
VCFu_quarticVCDu_quarticVCEu_quartic
VCFux_quarticVCDux_quarticVCEux_quartic
VPF_quarticVPD_quarticVPE_quartic
VPFu_quarticVPDu_quarticVPEu_quartic
FunctionFourth power
Syntax C/C++#include <VFmath.h>
int VF_quartic( fVector Y, fVector X, ui size );
int VFx_quartic( fVector Y, fVector X, ui size, float A, float B );
int VFu_quartic( fVector Y, fVector X, ui size );
int VFux_quartic( fVector Y, fVector X, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::quartic( const vector<T>& X );
int vector<T>::x_quartic( const vector<T>& X, const T& A, const T& B );
int vector<T>::u_quartic( const vector<T>& X );
int vector<T>::ux_quartic( const vector<T>& X, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_quartic( Y, X:fVector; size:UInt ): IntBool;
function VFx_quartic( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
function VFu_quartic( Y, X:fVector; size:UInt ): IntBool;
function VFux_quartic( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
Descriptionnormal versions: Yi = Xi 4
expanded versions: Yi = (A*Xi+B) 4
The fourth power of the elements of X is stored in Y.
The "unprotected" versions (prefix VFu_,   VFux_, etc.) do not perform any error handling, which makes them much faster (up to 50%) than the standard versions. The extended-precision complex (VCEu_ and VCEux_) versions do not take some of the security measures present in the standard version and might fail for results very near the overflow limit; results near the underflow limit might be rendered as 0.
Error handlingOVERFLOW errors lead to a default result of HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_square,   VF_cubic,   VF_sqrt,   VF_pow,   VF_ipow,   VF_poly

 

VF_rampVD_rampVE_ramp
VCF_rampVCD_rampVCE_ramp
VI_rampVBI_rampVSI_rampVLI_rampVQI_ramp
VU_rampVUB_rampVUS_rampVUL_rampVUI_ramp
FunctionInitialize a vector with an ascending or descending "ramp".
Syntax C/C++#include <VFstd.h>
void VF_ramp( fVector X, ui size, float Start, float Rise );

    (similarly VD_,   VE_,   VCF_,   VCD_,   VCE_,   VI_, etc.)
void VU_ramp( uVector X, ui size, unsigned Start, int Rise );
    (similarly VUB_,   VUS_,   VUL_)
C++ VecObj#include <OptiVec.h>
void vector<T>::ramp( T Start, T Rise );
void vector<unsigned>::ramp( unsigned Start, int Rise );
Pascal/Delphiuses VFstd;
procedure VF_ramp( X:fVector; size:UInt; Start, Rise:Single );

    (similarly VD_,   VE_,   VCF_,   VCD_,   VCE_,   VI_, etc.)
procedure VU_ramp( X:uVector; size:UInt; Start:UInt; Rise:Integer );
    (similarly VUB_,   VUS_,   VUL_)
DescriptionXi = Start + i * Rise
For the floating-point versions, remember the limited accuracy of floating-point numbers. For example, after calling
VF_ramp( F1, 101, -1.0, 0.01 );
the element F1100 will not be 0.0, as you might wish, but rather something like 2.2E-8. Ths is due to the fact that the number 0.01 (passed as a float to the function) is not exactly representable in the data type float. If that is a problem, consider building the ramp with moderately large integers and dividing by a scaling factor afterwards:
VF_ramp( F1, 101, -100.0, 1.0 );
VF_divC( F1, F1, 101, 100.0 );

Note that Rise is defined as int instead of unsigned in the VU_ version and as long instead of unsigned long in the VUL_ version; this exception from the general rules - that all parameters in one function be of the same data type - allows to create descending ramps of unsigned numbers, which would not be possible otherwise.

Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_Parzen,   VF_Welch,   VF_equ1,   VF_random

 

VF_randomVD_randomVE_random
VCF_randomVCD_randomVCE_random
VI_randomVBI_randomVSI_randomVLI_randomVQI_random
VU_randomVUB_randomVUS_randomVUL_randomVUI_random
FunctionHigh-quality random numbers
Syntax C/C++#include <VFstd.h>
long VF_random( fVector X, ui siz, long seed, float MinVal, float MaxVal );
C++ VecObj#include <OptiVec.h>
long vector<T>::random( long seed, T MinVal, T MaxVal );
Pascal/Delphiuses VFstd;
function VF_random( X:fVector; size:UInt; seed:LongInt; MinVal, MaxVal:Single ): LongInt;
DescriptionThe X vector is filled with a sequence of random numbers. Within the ranges defined by MinVal and MaxVal, and within the restrictions of floating-point representation, all numbers are equally probable (including the extreme values themselves), i.e., so-called "uniform deviates" are produced. The parameter seed may be any number. Successive calls to one and the same of these functions will yield identical sequences, if seed is chosen equal; if seed is chosen differently for successive calls, the results will be uncorrelated.

Internally, these functions employ a 32-bit integer random number generator by H.W.Lewis, with additional steps (so-called "Bays-Durham shuffle") to break sequential correlations. This ensures very good randomness, far superior to simpler generators (like the rand function of C/C++ compilers or the random function of Pascal/Delphi).

A long value is returned which may be used as new seed for subsequent calls.

Error handlingnone
Return valuelast 32-bit random number generated; this may be used as a new seed value for future calls.
See alsoVF_noise,   rand,   srand (C/C++ only),  random

 

VF_ratinterpolVD_ratinterpolVE_ratinterpol
FunctionDiagonal-rational interpolation
Syntax C/C++#include <VFmath.h>
void VF_ratinterpol( fVector Y, fVector X, ui sizex, fVector XTab, fVector YTab, ui sizetab, unsigned deg );
C++ VecObj#include <OptiVec.h>
void vector<T>::ratinterpol( const vector<T>& X, const vector<T>& XTab, const vector<T>& YTab, unsigned deg );
Pascal/Delphiuses VFmath;
procedure VF_ratinterpol( Y, X:fVector; sizex:UInt; XTab, YTab:fVector; sizetab:UInt; deg:UInt );
DescriptionFor each of the sizex elements of X, the corresponding element of Y is interpolated from the XTab-YTab value pairs. XTab must be ordered (either ascending or descending). All values of XTab must be distinct; otherwise a division by zero may occur and lead to a program abort. The parameter deg denotes the number of points that will be taken into account for the interpolation; the diagonal rational interpolation scheme by Stoer and Bulirsch is used. The interpolating function is formed by the quotient of two polynomials, the polynomial in the denominator being of the same order (for even deg) or of an order higher by one (for odd deg) than the polynomial of the numerator.
Diagonal rational interpolation is superior to polynomial interpolation, especially in the presence of poles. It is, however, much slower.
deg must be between 3 and 20.
Error handlingA pole (infinity) in the interpolated function is recognized and leads to a SING error with the proposed result being ±HUGE_VAL. (Note: the x-value passed to _matherr is the first element of XTab). Trying to use too many elements for the interpolation (deg > 20) leads to an error message "Not possible with more than 20 elements" and to a program abort. If deg is not between 3 and 20, or exceeds sizetab, an error message "Invalid parameter(s)" is displayed and the program aborted.
Return valuenone
See alsoVF_polyinterpol,   VF_splineinterpol

 

VF_readVD_readVE_read
VCF_readVCD_readVCE_read
VPF_readVPD_readVPE_read
VI_readVBI_readVSI_readVLI_readVQI_read
VU_readVUB_readVUS_readVUL_readVUI_read
Functionreads a vector in ASCII format from a stream
Syntax C/C++#include <VFstd.h>
void VF_read( fVector X, ui size, FILE *stream );
C++ VecObj#include <OptiVec.h>
void vector<T>::read( FILE *stream );
Pascal/Delphiuses VFstd;
procedure VF_read( X:fVector; size:UInt; var Stream:Text );
Descriptionsize elements are read in ASCII format (up to 80 characters) from stream and stored in X. Normally, this function will be used to import vectors from a program which cannot store numbers in machine format. It can also be used to retrieve vectors previously stored by VF_write. For storing and retrieving intermediate results, however, the function pair VF_store / VF_recall is to be preferred over VF_write / VF_read (see VF_write).

Complex versions:
Real und imaginary parts (cartesian complex) or the Mag and Arg parts (polar complex) may, but need not, be enclosed in braces { } or brackets ( ). However, you must be consequent: Either all or no element may be written with braces or brackets.
A komma may (but need not) separate the two parts. The imaginary part (cartesian) or the Arg part (polar) must always be explicitly specified, even if it is zero.
Examples for legal formats are:
0.3 0.5    (neither braces nor separating komma)
0.3, 0.5    (no braces; separating komma)
{0.3 0.5}    (braces; no separating komma)
(0.3, 0.5)    (brackets and separating komma)

C/C++ specific:The entries to be read must be separated by whitespace (' ', '\n', or '\t'). Additionally, one (!) "non-whitespace" character is tolerated after each entry, if it follows directly after the last digit. After it, there must be one or more whitespace characters.

Whole-number versions except VQI_read:
By default, the numbers to be read are interpreted as decimal numbers. You may use V_setRadix to define any radix between 2 and 36.

Pascal/Delphi specific:The entries to be read must be separated by whitespace (' ', #13, or #9).

Whereas the C/C++ version of these functions follows the conventions of the C functions strtod,   strtol, etc., the Pascal/Delphi version has to follow the rules applying to the Pascal/Delphi function Read. This makes the Pascal/Delphi version much less flexible than the C version:
- no separation characters allowed other than ' ' and #9,
- no automatic truncation of overflowing numbers,
- no function V_setRadix

Error handlingC/C++:
Real, complex and quad versions:
Overflowing numbers are silently truncated to ±HUGE_VAL.
Whole-number versions except VQI_read:
As long as the numbers can be represented as long or unsigned long, overflowing bits are ignored in the 16-bit versions. Numbers beyond the long range yield -1 (signed types) or +HUGE_VAL (unsigned types).
Pascal/Delphi:
Overflowing numbers or numbers otherwise not conforming to the format requirements lead to an I/O error.
Return valuenone
See alsoVF_nread,   VF_write,   VF_store,   VF_recall,   strtod,   strtol

 

VCF_realVCD_realVCE_real
VPF_realVPD_realVPE_real
FunctionReal part of a complex vector.
Syntax C/C++#include <VCFstd.h>
void VCF_real( fVector Re, cfVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::real( const vector<complex<T>>& X );
Pascal/Delphiuses VCFstd;
procedure VCF_real( Re:fVector; X:cfVector; size:UInt );
DescriptionIdentical to VF_CtoRe,   VD_CtoRe, and VE_CtoRe. See these functions for details.

 

VF_recallVD_recallVE_recall
VCF_recallVCD_recallVCE_recall
VPF_recallVPD_recallVPE_recall
VI_recallVBI_recallVSI_recallVLI_recallVQI_recall
VU_recallVUB_recallVUS_recallVUL_recallVUI_recall
FunctionRead a vector in binary format from a stream
Syntax C/C++#include <VFstd.h>
void VF_recall( fVector X, ui size, FILE *stream );
C++ VecObj#include <OptiVec.h>
void vector<T>::recall( FILE *stream );
Pascal/Delphiuses VFstd;
procedure VF_recall( X:fVector; size:UInt; var Stream:FILE );
Descriptionsize elements of X are read from stream in binary format. Normally, these functions are used to retrieve data stored by the respective function of the VF_store family. The data type for reading and writing has to be the same. It is not possible to, e.g., store data by VF_store and recall them by VD_recall (in contrast to the corresponding write/read functions in ASCII format, see VF_read).

The VecObj version differs from the "normal" C/C++ version in that it reads vector objects, not only the vector elements. It first reads a ui, giving the size of the vector, and then size elements, whereas the V?_recall functions assume size as known and take it as an argument. Therefore, the VecObj function recall can be used only to read vector objects previously stored with the VecObj function store, but not vectors stored with one of the V?_store functions.

Error handlingnone
Return valuenone
See alsoVF_store,   VF_write,   VF_print,   fwrite,   fread

 

VF_redCVD_redCVE_redC
Function"Reduce" by a constant
Syntax C/C++#include <VFmath.h>
void VF_redC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::redC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_redC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = red( Xi, C ) = Xi * C / (Xi + C)
Expressions of this type are frequently used in physics; for example, the "reduced mass" of a two-body system is the product of both masses divided by their sum.
Error handlingnone
Return valuenone
See alsoVF_redV,   VF_addC,   VF_subC,   VF_divC,   VF_visC

 

VF_redVVD_redVVE_redV
VFx_redVVDx_redVVEx_redV
Function"Reduce" by corresponding vector elements
Syntax C/C++#include <VFmath.h>
void VF_redV( fVector Z, fVector X, fVector Y, ui size );
void VFx_redV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::redV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_redV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/Delphiuses VFmath;
procedure VF_redV( Z, X, Y:fVector; size:UInt );
procedure VFx_redV( Z, X, Y:fVector; size:UInt; A, B:Single );
Descriptionnormal versions:
Zi = red( Xi, Yi ) = Xi * Yi / (Xi + Yi)
expanded versions:
xi = (A * Xi + B),
Zi = red( xi, Yi )
Error handlingnone
Return valuenone
See alsoVF_redC,   VF_addV,   VF_subV,   VF_divV,   VF_visV

 

VF_reflectVD_reflectVE_reflect
VCF_reflectVCD_reflectVCE_reflect
VPF_reflectVPD_reflectVPE_reflect
VI_reflectVBI_reflectVSI_reflectVLI_reflectVQI_reflect
VU_reflectVUB_reflectVUS_reflectVUL_reflectVUI_reflect
FunctionDerive the second half of a vector from the first half by reflection at the midpoint.
Syntax C/C++#include <VFstd.h>
void VF_reflect( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::reflect();
Pascal/Delphiuses VFstd;
procedure VF_reflect( X:fVector; size:UInt );
DescriptionXsize-i-1 = Xi,   i=0,...,(size-1)/2
The elements of the lower half of a vector are copied in reverse order into the upper half, i.e., the zero'th element is copied to the last, the element number 1 to the second last, and so on. The elements of the first half are not affected by this operation. This function will be used, e.g., to construct a response function for convolutions (see VF_convolve). In this case, note that the zero'th element is to appear only once in the response function and must not be included in the reflection by VF_reflect. Therefore, you have to calculate the response function for size/2+1 elements and to apply reflection from element 1 on. For an example, see VF_convolve.
Error handlingnone
Return valuenone
See alsoVF_rotate,   VF_rev,   VF_convolve,   VF_deconvolve,   VF_filter

 

VF_ReImtoCVD_ReImtoCVE_ReImtoC
FunctionConstruct a cartesian complex vector from real and imaginary parts
Syntax C/C++#include <VCFstd.h>
void VF_ReImtoC( cfVector Y, fVector Re, fVector Im, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::ReImtoC( const vector<T>& Re, const vector<T>& Im );
Pascal/Delphiuses VCFstd;
procedure VF_ReImtoC( X:cfVector; Re, Im:fVector; size:UInt );
DescriptionThe complex vector Y is constructed from two real vectors that become the real and imaginary parts of Y.
Error handlingnone
Return valuenone
See alsoVF_CtoReIm,   VF_RetoC,   VF_PolartoC

 

VF_ReImtoPVD_ReImtoPVE_ReImtoP
FunctionConstruct a polar complex vector from real and imaginary parts
Syntax C/C++#include <VPFstd.h>
void VF_ReImtoP( pfVector Y, fVector Re, fVector Im, ui size );
C++ VecObj#include <OptiVec.h>
void vector<polar<T>>::ReImtoP( const vector<T>& Re, const vector<T>& Im );
Pascal/Delphiuses VPFstd;
procedure VF_ReImtoP( X:pfVector; Re, Im:fVector; size:UInt );
DescriptionThe polar complex vector Y is constructed from cartesian coordinates entered as the two real vectors Re and Im.
Error handlingnone
Return valuenone
See alsoVF_PtoReIm,   VF_MagArgtoP

 

VF_RetoCVD_RetoCVE_RetoC
FunctionOverwrite the real part of a cartesian complex vector with a real vector
Syntax C/C++#include <VCFstd.h>
void VF_RetoC( cfVector Y, fVector Re, ui size );
C++ VecObj#include <OptiVec.h>
void vector<complex<T>>::RetoC( const vector<T>& Re );
Pascal/Delphiuses VCFstd;
procedure VF_RetoC( X:cfVector; Re:fVector; size:UInt );
DescriptionThe real part of the complex vector Y is overwritten with the elements of the real-valued vector Re. The imaginary part of Y is not affected.
Error handlingnone
Return valuenone
See alsoVF_CtoReIm,   VF_ReImtoC,   VF_ImtoC,   VF_PolartoC

 

VF_revVD_revVE_rev
VCF_revVCD_revVCE_rev
VPF_revVPD_revVPE_rev
VI_revVBI_revVSI_revVLI_revVQI_rev
VU_revVUB_revVUS_revVUL_revVUI_rev
FunctionReverse the ordering of the elements of a vector
Syntax C/C++#include <VFstd.h>
void VF_rev( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::rev( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_rev( Y, X:fVector; size:UInt );
DescriptionYi = Xsize-i-1
Error handlingnone
Return valuenone
See alsoVF_reflect,   VF_rotate

 

VF_rmsVD_rmsVE_rms
FunctionRoot of the mean square
Syntax C/C++#include <VFstd.h>
float VF_rms( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::rms();
Pascal/Delphiuses VFstd;
function VF_rms( X:fVector; size:UInt ); Single;
Descriptionrms = sqrt( (1/size) * sum( Xi2 ) )
Error handlingnone
Return valuerms
See alsoVF_ssq,   VF_Euclid,   VF_mean

 

VF_rotateVD_rotateVE_rotate
VCF_rotateVCD_rotateVCE_rotate
VPF_rotateVPD_rotateVPE_rotate
VI_rotateVBI_rotateVSI_rotateVLI_rotateVQI_rotate
VU_rotateVUB_rotateVUS_rotateVUL_rotateVUI_rotate
FunctionRotate the ordering of the elements of a vector
Syntax C/C++#include <VFstd.h>
void VF_rotate( fVector Y, fVector X, ui size, int pos );
C++ VecObj#include <OptiVec.h>
void vector<T>::rotate( const vector<T>& X, int pos );
Pascal/Delphiuses VFstd;
procedure VF_rotate( Y, X:fVector; size:UInt; pos:Integer );
DescriptionYi = Xsize-pos+i,   i=0,..,pos-1
Yi = Xi-pos,      i=pos,..,size-1
The output vector equals the rotated input vector. Clockwise rotation is achieved by a positive number pos.
Error handlingnone
Return valuenone
See alsoVF_reflect,   VF_rev

 

VF_rotateCoordinatesVD_rotateCoordinatesVE_rotateCoordinates
VCF_rotateCoordinatesVCD_rotateCoordinatesVCE_rotateCoordinates
FunctionCounter-clockwise rotation of cartesian coordinates
Syntax C/C++#include <VFmath.h>
void VF_rotateCoordinates( fVector Xrot, fVector Yrot, fVector X, fVector Y, ui size, float costheta, float sintheta );

void VCF_rotateCoordinates( cfVector XYrot, cfVector XY, ui size, float costheta, float sintheta );
C++ VecObj#include <OptiVec.h>
void vector<T>::rotateCoordinates( const vector<T>& Yrot, const vector<T>& X,const vector<T>& Y, T costheta, T sintheta );
void vector<complex<T> >::rotateCoordinates( const vector<complex<T> >& XY, T costheta, T sintheta );
Pascal/Delphiuses VFmath;
procedure VF_rotateCoordinates( Xrot, Yrot, X, Y:fVector; size:UInt; costheta, sintheta:Single );

procedure VCF_rotateCoordinates( XYrot, XY:cfVector; size:UInt; costheta, sintheta:Single );
DescriptionThe coordinates specified either in the real vector pair X,Y or in the complex vector XY are rotated counter-clockwise by the angle theta, specified as its cosine and sine, costheta and sintheta:
Xroti = cos(theta) * Xi - sin(theta) * Yi,
Yroti = sin(theta) * Xi + cos(theta) * Yi

The result can be scaled by a constant factor: Just multiply the arguments costheta and sintheta by the desired scaling factor. costheta and sintheta need not actually correspond to any real angle.

Error handlingnone
Return valuenone
See alsoVF_lincomb

 

VF_roundVD_roundVE_round
VF_roundtoIVD_roundtoIVE_roundtoI
VF_roundtoBIVD_roundtoBIVE_roundtoBI
VF_roundtoSIVD_roundtoSIVE_roundtoSI
VF_roundtoLIVD_roundtoLIVE_roundtoLI
VF_roundtoQIVD_roundtoQIVE_roundtoQI
VF_roundtoUVD_roundtoUVE_roundtoU
VF_roundtoUBVD_roundtoUBVE_roundtoUB
VF_roundtoUSVD_roundtoUSVE_roundtoUS
VF_roundtoULVD_roundtoULVE_roundtoUL
VF_roundtoUIVD_roundtoUIVE_roundtoUI
FunctionRounding to the nearest whole number.
Syntax C/C++#include <VFmath.h>
int VF_round( fVector Y, fVector X, ui size );
int VF_roundtoI( iVector Y, fVector X, ui size );
int VF_roundtoLI( liVector Y, fVector X, ui size );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
int vector<T>::round( const vector<T>& X );
int vector<int>::roundtoI( const vector<T>& X );
int vector<long>::roundtoLI( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_round( Y, X:fVector; size:UInt ):IntBool;
function VF_roundtoI( Y:iVector; X:fVector; size:UInt ):IntBool;
function VF_roundtoLI( Y:liVector; X:fVector; size:UInt ):IntBool;

    (similarly all other functions of this family)
DescriptionEach element of X is rounded to the nearest integer value. In case of a fractional part of exactly 0.5, the nearest even integer value is chosen and stored in Y. For example, 2.5 is rounded to 2, and 3.5 is rounded to 4.
The functions VF_roundtoI,   VF_roundtoLI,   VF_roundtoU, etc. convert the result into the various integer data types.
Error handlingOVERFLOW and DOMAIN errors are handled "silently", i.e., without any error message and without being indicated by the return value. In the case of OVERFLOW errors, the result is set to the extreme value possible. Negative numbers in the versions VF_roundtoU,   VF_roundtoUB,   VF_roundtoUS,   VF_roundtoUL, and VF_roundtoUI (which would lead to DOMAIN errors) are handled by setting the result to 0.
Return valuealways FALSE (0)
See alsoVF_ceil,   VF_floor,   VF_chop,   VF_trunc

 

VF_runintegralCVD_runintegralCVE_runintegralC
Function"running integral" of an array sampled at equally-spaced abscissa points.
Syntax C/C++#include <VFstd.h>
void VF_runintegralC( fVector Y, fVector X, ui size, float DeltaT );
C++ VecObj#include <OptiVec.h>
void vector<T>::runintegralC( const vector<T>& X, T DeltaT );
Pascal/Delphiuses VFstd;
procedure VF_runintegralC( Y, X:fVector; size:UInt; DeltaT:Single );
DescriptionThe vector X is assumed to be a function of a variable t; the t values themselves are equally spaced. Therefore, only their spacing, DeltaT, must be known to the function. Each element of Y is the integral of all elements of X up to and including the one with the same index. Thus, the last element of Y contains the value of the integral over the whole of X (the area under X). If only this value is of interest, VF_integralC should be used.
Error handlingnone
Return valuenone
See alsoVF_runintegralV,   VF_integralC,   VF_derivC,   VF_runsum

 

VF_runintegralVVD_runintegralVVE_runintegralV
Function"running integral"
Syntax C/C++#include <VFmath.h>
void VF_runintegralV( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::runintegralV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFmath;
procedure VF_runintegralV( Z, X, Y:fVector; size:UInt );
DescriptionY is a function of the variable x which is represented by X. Each element of Z is the integral over all elements of Y up to and including the one with the same index. The first element of Z is always FALSE (0).0. The last element of Z is equal to the value of the integral, i.e. to the area under Y. If only this value of the integral is of interest, VF_integralV should be used.
Error handlingnone
Return valuenone
See alsoVF_runintegralC,   VF_integralV,   VF_derivV

 

VF_runmaxVD_runmaxVE_runmax
VI_runmaxVBI_runmaxVSI_runmaxVLI_runmaxVQI_runmax
VU_runmaxVUB_runmaxVUS_runmaxVUL_runmaxVUI_runmax
Function"running" maximum.
Syntax C/C++#include <VFstd.h>
void VF_runmax( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::runmax( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_runmax( Y, X:fVector; size:UInt );
DescriptionEach element of Y is the maximum of the corresponding and all preceding elements of X.
Error handlingnone
Return valuenone
See alsoVF_max,   VF_runmin,   VF_runsum

 

VF_runminVD_runminVE_runmin
VI_runminVBI_runminVSI_runminVLI_runminVQI_runmin
VU_runminVUB_runminVUS_runminVUL_runminVUI_runmin
Function"running" minimum
Syntax C/C++#include <VFstd.h>
void VF_runmin( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::runmin( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_runmin( Y, X:fVector; size:UInt );
DescriptionEach element of Y is the minimum of the corresponding and all preceding elements of X.
Error handlingnone
Return valuenone
See alsoVF_min,   VF_runmax,   VF_runsum

 

VF_runprodVD_runprodVE_runprod
VCF_runprodVCD_runprodVCE_runprod
VPF_runprodVPD_runprodVPE_runprod
Function"running" product
Syntax C/C++#include <VFstd.h>
void VF_runprod( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::runprod( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_runprod( Y, X:fVector; size:UInt );
DescriptionEach element of Y is the product of the corresponding and all preceding elements of X. This function should be used with care: overflow is easily reached, and underflow may lead to all elements from a certain position on being zero.
Error handlingnone
Return valuenone
See alsoVF_prod,   VF_runsum

 

VF_runsumVD_runsumVE_runsum
VCF_runsumVCD_runsumVCE_runsum
VI_runsumVBI_runsumVSI_runsumVLI_runsumVQI_runsum
VU_runsumVUB_runsumVUS_runsumVUL_runsumVUI_runsum
Function"running" sum
Syntax C/C++#include <VFstd.h>
void VF_runsum( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::runsum( const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_runsum( Y, X:fVector; size:UInt );
DescriptionEach element of Y is the sum of the corresponding and all preceding elements of X.
Error handlingnone (but be careful: this function may easily overflow!)
Return valuenone
See alsoVF_sum,   VF_runprod

 

VCF_sabsmaxVCD_sabsmaxVCE_sabsmax
FunctionLargest complex vector element in terms of the sum |Re| + |Im|
Syntax C/C++#include <VCFstd.h>
fComplex VCF_sabsmax( cfVector X, ui size);
C++ VecObj#include <OptiVec.h>
T vector<complex<T>>::sabsmax();
Pascal/Delphiuses VCFstd;
procedure VCF_sabsmax( var Max:fComplex; X:cfVector; size:UInt );
DescriptionBy the criterion of the sum |Re| + |Im|, the largest element of a cartesian complex vector is found and returned. In many applications, this function may serve as a much faster replacement for VCF_cabsmax. The latter function uses the absolute value, sqrt(Re2 + Im2), as its criterion.
Error handlingnone
Return valuelargest element
See alsoVCF_absmax,   VCF_absmaxReIm,   VCF_cabsmax

 

VCF_sabsminVCD_sabsminVCE_sabsmin
FunctionSmallest complex vector element in terms of the sum |Re| + |Im|
Syntax C/C++#include <VCFstd.h>
fComplex VCF_sabsmin( cfVector X, ui size);
C++ VecObj#include <OptiVec.h>
T vector<complex<T>>::sabsmin();
Pascal/Delphiuses VCFstd;
procedure VCF_sabsmin( var Min:fComplex; X:cfVector; size:UInt );
DescriptionBy the criterion of the sum |Re| + |Im|, the smallest element of a cartesian complex vector is found and returned. In many applications, this function may serve as a much faster replacement for VCF_cabsmin. The latter function uses the absolute value, sqrt(Re2 + Im2), as its criterion.
Error handlingnone
Return valuesmallest element
See alsoVCF_absmin,   VCF_absminReIm,   VCF_cabsmin

 

VF_scale10VD_scale10VE_scale10
FunctionScaling by an integer power of 10.
Syntax C/C++#include <VFmath.h>
int VF_scale10( fVector Y, fVector X, ui size, int Expo );
C++ VecObj#include <OptiVec.h>
int vector<T>::scale10( const vector<T>& X, int Expo );
Pascal/Delphiuses VFmath;
function VF_scale10( Y, X:fVector; size:UInt; Expo:Integer ): IntBool;
DescriptionYi = Xi * (10 Expo)
Note that higher powers of ten are not representable as exact numbers, which may lead to the introduction of round-off error by the scaling. If this is a problem, VF_scale2 should be used instead.
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_scale2,   VF_mantexp

 

VF_scale2VD_scale2VE_scale2
FunctionScaling by an integer power of 2.
Syntax C/C++#include <VFmath.h>
int VF_scale2( fVector Y, fVector X, ui size, int Expo );
C++ VecObj#include <OptiVec.h>
int vector<T>::scale2( const vector<T>& X, int Expo );
Pascal/Delphiuses VFmath;
function VF_scale2( Y, X:fVector; size:UInt; Expo:Integer ): IntBool;
DescriptionYi = Xi * (2 Expo)
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_scale10,   VF_mantexp,   ldexp (C/C++)

 

VF_scalprodVD_scalprodVE_scalprod
FunctionScalar product of two vectors
Syntax C/C++#include <VFstd.h>
float VF_scalprod( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::scalprod( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_scalprod( X, Y:fVector; size:UInt ): Single;
Descriptionscalprod = sum( Xi * Yi )
The scalar (or dot) product of two vectors is defined as the sum of the products of the corresponding elements. The scalar product of a vector with itself is the square of its magnitude and may be calculated using the function VF_ssq.
Error handlingnone
Return valueproduct
See alsoVF_prod,   VF_xprod,   VF_sum,   VF_ssq

 

VF_searchCVD_searchCVE_searchC
FunctionBinary searches of an ordered table for the entry coming closest to a specified value
Syntax C/C++#include <VFstd.h>
ui VF_searchC( fVector X, ui size, float C, int mode );
C++ VecObj#include <OptiVec.h>
ui vector<T>::searchC( const T& C, int mode );
Pascal/Delphiuses VFstd;
function VF_searchC( X:fVector; size:UInt; C:Single; mode:Integer ):UInt;
DescriptionIn a binary search, the element of X is located that is closest to the value specified as C. X has to be an ordered table (either ascending or descending); if this condition is not fulfilled, the result will be wrong. If C is outside the range covered by X, the first or the last element of X is chosen, whichever is closer to C. If C is within the range of the table, three modes of the search are available:
mode = +1:find the next element greater than or equal to C
mode =   0:find the element closest to C; if two elements are within equal distance, choose the lower index
mode =  -1:find the next element less than or equal to C
Error handlingnone
Return valueindex of the element found.
See alsoVF_searchV,   VF_sort,   VF_polyinterpol

 

VF_searchVVD_searchVVE_searchV
FunctionBinary search of an ordered table for the entries coming closest to the values specified as the elements of a vector
Syntax C/C++#include <VFstd.h>
void VF_searchV( uiVector Ind, fVector X, ui sizex, fVector Tab, ui sizetab, int mode );
C++ VecObj#include <OptiVec.h>
void vector<ui>::searchV( const vector<T>& X, const vector<T>& Tab, int mode );
Pascal/Delphiuses VFmath;
procedure VF_searchV( Ind:uVector; X:fVector; sizex:UInt; Tab:fVector; sizetab:UInt; mode:Integer );
DescriptionFor each element of X, the element of the table Tab is located that is closest to it. Tab has to be ordered (either ascending or descending); if this condition is not fulfilled, the results will be wrong.
If Xi is outside the range of the table, the first or the last element of the table is chosen, whichever is appropriate. Otherwise, three modes of the search are available:
mode = +1: find the next element greater than or equal to Xi
mode =   0:find the element closest to Xi; if two elements are within equal distance, choose the lower index
mode =  -1:find the next element less than or equal to Xi

sizex is the number of elements of X and of Ind, whereas sizetab denotes the number of elements of the table Tab.

Error handlingnone
Return valuenone
See alsoVF_searchC,   VF_indpick,   VF_sortind,   VF_polyinterpol

 

VF_secVD_secVE_sec
VFx_secVDx_secVEx_sec
FunctionSecant function
Syntax C/C++#include <VFmath.h>
int VF_sec( fVector Y, fVector X, ui size );
int VFx_sec( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sec( const vector<T>& X );
int vector<T>::x_sec( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sec( Y, X:fVector; size:UInt ): IntBool;
function VFx_sec( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sec( Xi )    = 1 / cos( Xi )
expanded versions: Yi = C * sec( A*Xi+B )
The secant is defined as the inverse of the cosine (not to be mistaken for the arcus function arccos). For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as rational multiples of p, it is better to use VF_secrpi than VF_sec.
Error handlingSING or OVERFLOW errors lead to the default result ±HUGE_VAL. TLOSS precision errors lead to a result of 1.0 (as if the input were 0.0).
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sec2,   VF_secrpi,   VF_cos,   VF_sech,   cos

 

VF_sec2VD_sec2VE_sec2
VFx_sec2VDx_sec2VEx_sec2
FunctionSquare of the secant function
Syntax C/C++#include <VFmath.h>
int VF_sec2( fVector Y, fVector X, ui size );
int VFx_sec2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sec2( const vector<T>& X );
int vector<T>::x_sec2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sec2( Y, X:fVector; size:UInt ): IntBool;
function VFx_sec2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sec2( Xi )
expanded versions: Yi = C * sec2( A*Xi+B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards.
Error handlingFor SING and OVERFLOW errors, the default result is HUGE_VAL (multiplied by the sign of C in the expanded versions); TLOSS errors lead to a default result of 1.0 or C, resp. (as if the input were 0.0).
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sec,   VF_secrpi

 

VF_sechVD_sechVE_sech
VFx_sechVDx_sechVEx_sech
FunctionHyperbolic secant function
Syntax C/C++#include <VFmath.h>
int VF_sech( fVector Y, fVector X, ui size );
int VFx_sech( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sech( const vector<T>& X );
int vector<T>::x_sech( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sech( Y, X:fVector; size:UInt ): IntBool;
function VFx_sech( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions:
Yi = sech( Xi )
    = 2 / (exp( Xi ) + exp( -Xi ))
expanded versions:
Yi = C * sech( A*Xi+B )
Error handlingThese functions should be error-proof.
Return valuealways FALSE (0)
See alsoVF_sinh,   VF_sech2,   VF_exp,   sinh

 

VF_sech2VD_sech2VE_sech2
VFx_sech2VDx_sech2VEx_sech2
FunctionSquare of the hyperbolic secant function
Syntax C/C++#include <VFmath.h>
int VF_sech2( fVector Y, fVector X, ui size );
int VFx_sech2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sech2( const vector<T>& X );
int vector<T>::x_sech2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sech2( Y, X:fVector; size:UInt ): IntBool;
function VFx_sech2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sech2( Xi )
expanded versions: Yi = C * sech2( A*Xi+B )
The sech2 function is used in physics, e.g., to describe the shape of ultrashort light pulses. Compared to a Gaussian or Lorentzian pulse shape of the same autocorrelation width (see VF_autocorr), the sech2 function has the smallest FWHM (full width to half maximum).
Error handlingThese functions should be error-proof.
Return valuealways FALSE (0)
See alsoVF_sech,   VF_sinh,   VF_exp,   VF_Gauss,   VF_Lorentz

 

VF_secrpiVD_secrpiVE_secrpi
VF_secrpi2VD_secrpi2VE_secrpi2
VF_secrpi3VD_secrpi3VE_secrpi3
FunctionSecant function of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_secrpi( fVector Y, iVector P, ui size, int q );
int VF_secrpi2( fVector Y, iVector P, ui size, int q );
int VF_secrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::secrpi( const vector<int>& P, int q );
int vector<T>::secrpi2( const vector<int>& P, int q );
int vector<T>::secrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_secrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_secrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_secrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = sec( (Pi / q) * p )
The secant of fractional multiples of p is calculated. There are three versions: VF_secrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_secrpi2 should be used which is a highly optimized version utilizing a look-up table. If q is a multiple of 3, VF_secrpi3 should be used. VF_secrpi2 and VF_secrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the tables.
Error handlingSING errors occur if Pi / q is an odd multiple of 1/2; the default result is 0.0 (which is the mean of +HUGE_VAL and -HUGE_VAL; similarly to VF_cosecrpi2, 0.0 is chosen irrespective to the fact that it is not a valid result of the secant function!);
q must be non-zero; this is, however, not tested for.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sec,  cos

 

VF_selected_meanVD_selected_meanVE_selected_mean
FunctionMean of the elements of a one-dimensional distribution, falling into a specified interval
Syntax C/C++#include <VFstd.h>
float VF_selected_mean( ui *nsel, fVector X, ui size float XMin, float XMax );
C++ VecObj#include <OptiVec.h>
T vector<T>::selected_mean( ui *nsel, T XMin, T XMax );
Pascal/Delphiuses VFstd;
function VF_selected_mean( var nsel:Uint; X:fVector; size:UInt; XMin, XMax:Single ): Single;
DescriptionThose elements of X are selected, which fall into the interval XMin <= Xi <= XMax.
Their mean is calculated, and the number of selected elements is stored at the address nsel. If this number is not needed, nsel may be passed to the function as NULL (C/C++) or nil (Pascal/Delphi).
Error handlingnone
Return valueMean of the selected vector elements
See alsoVF_mean

 

V_setCoordSystem
FunctionRestore the scalings and position of a coordinate system previously saved by V_getCoordSystem
Syntax C/C++#include <Vgraph.h>
void V_setCoordSystem( VCOORDSYSTEM *csys );
Pascal/Delphiuses Vgraph;
procedure V_setCoordSystem( csys: VCOORDSYSTEM );
DescriptionIf one wants to "hop" between several coordinate systems, displayed in one and the same window, one has to store the specifications (position and scalings) of each coordinate system separately, using V_getCoordSystem, and to retrieve them as needed, using this function.
The address of a struct VCOORDSYSTEM is passed as the argument. VCOORDSYSTEM is defined in <Vgraph.h> (C/C++) or the unit Vgraph (Pascal/Delphi).
For an example, see V_getCoordSystem.
Error handlingnone
Return valuenone
See alsoV_getCoordSystem,   V_setPlotRegion,   V_continuePlot

 

V_setErrorEventFile
FunctionPrepare a file for printing error messages into it
Syntax C/C++#include <VecLib.h>
void V_setErrorEventFile( char *filename, unsigned ScreenAndFile );
Pascal/Delphiuses VecLib;
procedure V_setErrorEventFile( filename:PChar; ScreenAndFile:IntBool );
DescriptionThis function determines where to print messages notifying math errors that occur within VectorLib routines. filename is the desired name of the event file (often called "log-file"). ScreenAndFile decides if you wish to have error messages printed simultaneously into the file and onto the screen (ScreenAndFile = TRUE (non-zero)) or exclusively into the file (ScreenAndFile = FALSE (0)).
The default, i.e., printing error messages to the screen, is restored by V_closeErrorEventFile.
This function will not be included in versions of OptiVec for compilers which offer the possibility of printing error messages simultaneously to the screen and into an event file.

If a user-defined _matherr function (C/C++) or any other custom error handler (both C/C++ and Pascal/Delphi) calls V_noteError, also errors occurring outside OptiVec routines w ill lead to a message printed into the event file (see chapter 5.5).

Error handlingIf the desired event file cannot be opened or created, the program is aborted with a message "Cannot open error event file".
Return valuenone
See alsoV_noteError,   V_closeErrorEventFile

 

V_setFPAccuracy
FunctionSet the coprecessor to a specific precision
Syntax C/C++#include <VecLib.h>
void V_getFPAccuracy( unsigned level );
Pascal/Delphiuses VecLib;
procedure V_getFPAccuracy( level:UInt );
DescriptionThis function changes the FPU Control-Word to switch the FPU to a specified accuracy, passed to the function as the argument level. For level=1, float / Single precision is obtained, level=2 leads to double precision, whereas level=3 switches the FPU into extended precision. The actual accuracy the coprocessor is switched to may be read through V_getFPAccuracy.
Operating the floating-point processor at float / Single precision may significantly speed up program execution, especially for any functions involving divisions and on Pentium or higher. This is true for functions (including OptiVec functions) of any floating-point data type. Thereby, you may even operate VD_ and VE_ functions at float / Single accuracy – preserving double or extended range, but calculating results to single precision only.
There are, however, several groups of functions which rely on full coprocessor accuracy for intermediate results, or which use precision-controlled iterations. Obviously, if the FPU operates in single precision only, such a function will never attain double precision and may get caught in an infinite loop. You should never call any of the following functions while the FPU is switched to single precision (or, for VE_ functions, to double precision):
V?_Kepler,
M?_SVdecompose,
or any of the nonlinear data fitting functions like VF_nonlinfit.
Return valuenone
See alsoV_getFPAccuracy

 

V_setFPErrorHandling
FunctionDefine the action taken in the case of floating-point errors (Pascal/Delphi only).
Syntax Pascal/Delphiuses VecLib;
type V_fphand = 0..$1717;
procedure V_setFPErrorHandling( hand:V_fpHand );
DescriptionAs Pascal/Delphi does not handle floating-point errors through a user-definable function _matherr, as does C/C++, the function V_setFPErrorHandling is offered in OptiVec as a means for the programmer to exert at least some control over the actions to be taken in the case of floating-point errors occurring within OptiVec functions. A number of pre-defined constants fperrXXX is available for the construction of the desired error-handling mode:
 
ConstantValueMeaning
fperrIgnore0Ignore all floating-point errors: handle them silently, do not print a message, continue program execution
fperrNoteDOMAIN$0001Print a message in case of a DOMAIN error
fperrNoteSING$0002Print a message in case of a SING error
fperrNoteOVERFLOW$0003Print a message in case of an OVERFLOW error
fperrNoteTLOSS$0004Print a message in case of a TLOSS error
fperrAbortDOMAIN$0101Abort program in case of a DOMAIN error
fperrAbortSING$0202Abort program in case of a SING error
fperrAbortOVERFLOW$0303Abort program in case of an OVERFLOW error
fperrAbortTLOSS$0404Abort program in case of a TLOSS error
fperrDefaultHandling$0107Same as fperrAbortDOMAIN or fperrNoteSING or fperrNoteOVERFLOW
 
ExampleV_setFPErrorHandling( fperrAbortDOMAIN + fperrAbortSING + fperrAbortOVERFLOW + fperrNoteTLOSS );
In this example, program execution will be aborted (with the appropriate message) in the case of the most severe errors, DOMAIN and SING. In the case of OVERFLOW and TLOSS errors, a warning will be displayed, but program execution will be continued with default results set by the respective functions where the errors occur. The repeated occurrence of the same type of error within one and the same function will lead to only one message being generated. Subsequent errors will be treated silently.
Error handlingnone
Return valuenone
See alsoV_setIntErrorHandling,   V_setErrorEventFile,   V_noteError,   V_printErrorMsg

 

V_setIntErrorHandling
FunctionDefine the action taken in the case of INTEGER OVERFLOW and INTEGER DOMAIN errors.
Syntax C/C++#include <VecLib.h>
typedef enum {
    ierrIgnore = 0, ierrNote, ierrAbort
} V_ihand;
void V_setIntErrorHandling( V_ihand ihand );
Pascal/Delphiuses VecLib;
type V_ihand = 0..2;
procedure V_setIntErrorHandling( ihand:V_iHand );
DescriptionThis function allows to set the handling mode for OVERFLOW and DOMAIN errors occurring within integer functions of OptiVec. It has to be called with one of the following pre-defined constants as argument:
    ierrIgnore = 0;
    ierrNote = 1;
    ierrAbort = 2;

The default is that these errors are ignored, i.e., they are treated by discarding overflowing bits (see chapter 5.2 for details on integer error handling). If you wish to change this behaviour, call, e.g.,
V_setIntErrorHandling( ierrNote );
and add the letter "o" to the prefixes of those integer functions for which you wish to trap errors: VIo_,   VUSo_, etc.
Error handlingnone
Return valuenone
See alsoV_setFPErrorHandling,   V_setErrorEventFile,   V_noteError,   V_printErrorMsg,  chapter 5.2

 

V_setLineThickness
FunctionModify the line thickness used in plotting functions
Syntax C/C++#include <Vgraph.h>
void V_setLineThickness( unsigned linethickness );
Pascal/Delphiuses Vgraph;
procedure V_setLineThickness( linethickness:UInt );
DescriptionThe line thickness used in the plotting functions VF_xyAutoPlot,   VCF_autoPlot, etc., is set to linethickness. To reset the default value, call V_setLineThickness with linethickness = 1.
DOS:
There are only two possible values for linethickness:
   C/C++: NORM_WIDTH = 1 and THICK_WIDTH = 3.
   Pascal/Delphi: NormWidth = 1 and ThickWidth = 3.
Any value of linethickness below 3 is interpreted as NORM_WIDTH, any value above 3 is taken as THICK_WIDTH.
Windows:
Any value of linethickness between 1 and 500 is allowed, useful values ranging from 1 to about 10. A minimum thickness of one pixel is always secured, even if linethickness is set to 0. Note that broken or dotted lines are plotted accurately only with a linethicknes of 1. At higher values of linethickness, all lines will look like solid lines. Thicker lines are plotted considerably slower than thinner ones.
Error handlingDOS: "silent" correction of the input value.
Windows: A value of linethickness greater than 500 leads to a warning message "Cannot use line thicker than 500 pixels." Program execution is continued with linethickness set to 500.
Return valuenone
See alsoVF_xyAutoPlot,   V_setSymbolSize

 

VF_setNWriteSeparateVD_setNWriteSeparateVE_setNWriteSeparate
VCF_setNWriteSeparateVCD_setNWriteSeparateVCE_setNWriteSeparate
VPF_setNWriteSeparateVPD_setNWriteSeparateVPE_setNWriteSeparate
VI_setNWriteSeparateVBI_setNWriteSeparateVSI_setNWriteSeparate
VLI_setNWriteSeparateVQI_setNWriteSeparate
VU_setNWriteSeparateVUB_setNWriteSeparateVUS_setNWriteSeparate
VUL_setNWriteSeparateVUI_setNWriteSeparate
FunctionDefinition of the string to be used by the V.._nwrite functions to separate table entries.
Syntax C/C++#include <VFstd.h>
void VF_setNWriteSeparate( char *SepString );
Pascal/Delphiuses VFstd;
procedure VF_setNWriteSeparate( SepString:PChar );
DescriptionThis function defines the character string to be inserted between the columns of a table written by VF_nwrite. VF_setNWriteSeparate does not influence the end of each line which is always a line-feed character ("\n" for C/C++ and #13 for Pascal/Delphi).
SepString may contain up to twelve characters. The default setting is a tab character ("\t" for C/C++ and #9 for Pascal/Delphi).
Error handlingIn the case of SepString longer than twelve characters, the program is aborted with the error message "Invalid Parameter(s)".
The contents of SepString is not checked.
Return valuenone
See alsoVF_setWriteFormat,   VF_setWriteSeparate,   VF_nwrite,   VF_nread

 

VF_setODThreshVD_setODThreshVE_setODThresh
VU_setODThreshVUB_setODThreshVUS_setODThresh
VUL_setODThreshVQI_setODThresh
FunctionSet the threshold for optical density calculation
Syntax C/C++#include <VFmath.h>
void VF_setODThresh( float minX, float minX0 );
C++ VecObj#include <OptiVec>
void vector<T>::setODThresh( T minX, T minX0 );
Pascal/Delphiuses VFmath;
procedure VF_setODThresh( minX, minX0:Single );
DescriptionAs described for VF_OD and VF_ODwDark, the threshold below which input numbers for these functions are regarded as "experimental noise", with the OD being set to 0.0, can be set to any positive number by VF_setODThresh etc.
Error handlingnone
Return valuenone
See alsoVF_OD,   VF_ODwDark

 

V_setPlotRegion
FunctionDefines a screen or printer-page region to be used by VectorLib plotting operations.
Syntax C/C++#include <Vgraph.h>
void V_setPlotRegion( int left, int top, int right, int bottom );
Pascal/Delphiuses Vgraph;
procedure V_setPlotRegion( left, top, right, bottom:Integer);
DescriptionThe rectangular region defined by the parameters, passed to V_setPlotRegion, will hold the coordinate system including all labels generated by future calls to VectorLib plotting functions such as VF_xyAutoPlot. The parameters left, top, right, and bottom are in pixels, counting from the upper left corner of the screen or of the printer page.
V_setPlotRegion has to be called after (!) V_initPlot or V_initPrint.
Error handlingnone
Return valuenone
See alsoV_initPlot,   V_initPrint

 

V_setRadix
FunctionDefine the radix for the whole-number read functions: C/C++ only!
Syntax C/C++#include <VIstd.h>
    (or <VSIstd.h>, <VLIstd.h>, <VUstd.h>, ... *)
void V_setRadix( int radix );
DescriptionBy default, the V.._read functions for the whole-number data types interpret all numbers as decimal numbers. V_setRadix allows to change this default behaviour.
The radix set by V_setRadix will be used in VI_read,   VI_nread and their VBI_,   VSI_,   VLI_,   VUB_,   VUS_,   VU_,   VUL_, and VUL_ analogues. It does, however, not affect VQI_read or VQI_nread (where the radix is always 10).

radix may take on values between 2 and 36 or 0.
In the case of radix=0, the basis of each number is determined at run-time:
All numbers beginning with the ciphers 1-9 are recognized as decimal numbers. All numbers beginning with "0x" are interpreted as hexadecimal and all numbers beginning with "0" without "x" are read as octal numbers.

Error handlingradix < 0, radix=1, or radix > 36 lead to a program abort with the error message "Invalid Parameter(s)".
Return valuenone
See alsoVI_read,   VI_nread,   strtol,   strtoul

 

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 );
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.

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 handlingnone
Return valuenone
See alsoVF_convolve,   VF_deconvolve,   VF_getRspEdit

 

V_setSymbolSize
FunctionModify the size of the symbols used in plotting functions
Syntax C/C++#include <Vgraph.h>
void V_setSymbolSize( float symsiz );
Pascal/Delphiuses Vgraph;
procedure V_setSymbolSize( symsize:Single );
DescriptionThe size of the symbols used in the plotting functions VF_xyAutoPlot,   VCF_autoPlot, etc., is modified by scaling with symsiz. To reset the symbol size to the default value, call V_setSymbolSize with symsiz=1.0. Note that it is not possible to make the symbols completely vanish (e.g., by setting symsiz = 0.0), since a minimum radius of one pixel is always secured. Useful values of symsiz range from about 0.5 to 5.0. Values above 50.0 are prohibited.

When magnifying the symbols, you should also consider modifying the thickness of the connecting lines, if you are using any. See V_setLineThickness.

Note: An automatic scaling is always performed in order to maintain a constant relation between the symbol size and the overall size of the coordinate grid (which is especially important for Windows applications). The factor symsiz of this function scales the symbol size with respect to the automatically-found value. The automatic scaling cannot be switched off.

Error handlingDOS: "silent" correction of the input value.
Windows: A value of symsiz greater than 50.0 leads to a warning message "Cannot scale symbols by more than a factor of 50.0". Program execution is continued with symsiz set to 50.0.
Return valuenone
See alsoVF_xyAutoPlot,   V_setLineThickness

 

VF_setWriteFormatVD_setWriteFormatVE_setWriteFormat
VCF_setWriteFormatVCD_setWriteFormatVCE_setWriteFormat
VPF_setWriteFormatVPD_setWriteFormatVPE_setWriteFormat
VI_setWriteFormatVBI_setWriteFormantVSI_setWriteFormat
VLI_setWriteFormatVQI_setWriteFormat
VU_setWriteFormatVUB_setWriteFormatVUS_setWriteFormat
VUL_setWriteFormatVUI_setWriteFormat
FunctionDefinition of the format to be used by V.._write and V.._nwrite: C/C++ only!
Syntax C/C++#include <VFstd.h>
void VF_setWriteFormat( char *FormatString );
C++ VecObj#include <OptiVec.h>
void vector<T>::setWriteFormat( char *FormatString );
DescriptionThe functions of the VF_write and VF_nwrite families employ internally the ANSI C function fprintf in order to print numbers into a stream.
According to the rules described in the documentation of your C compiler's printf function, the format may be specified as fits your needs. When defining a write format, one should always be aware of the restrictions imposed by the read functions (not all formats you can write will be read correcly, see VF_read).

VF_setWriteFormat should not be used for the definition of whitespace before or after the numbers. This is the task of VF_setWriteSeparate.

For details about the formats used for each of the various data types, please refer to the following table. The last column of this table gives the maximum length of the format string.

VersionStandard FormatAlternative Examplemax. length
VF_"% 11.8e""% 8.4f"16
VD_"% 19.16le""% 16.8lf"16
VE_"% 22.19Le""% 22.19LG"16
VCF_"% 11.8e, % 11.8e""{% 8.4f, % 8.4f}"32
VCD_"% 19.16le, % 19.16le""{% 19.16lE % 19.16lE}"32
VCE_"% 22.19Le, % 22.19Le""{% 22.19Lg % 22.19Lg}"32
VPF_"% 11.8e @% 11.8e""{% 8.4f @% 8.4f}"32
VPD_"% 19.16le @% 19.16le""{% 19.16lE @% 19.16lE}"32
VPE_"% 22.19Le @% 22.19Le""{% 22.19Lg @% 22.19Lg}"32
VI_32-bit: "% 10d"
16-bit: "% 5d"
"0x% 8x"
"0x% 4x"
12
12
VBI_"% 3hd""0x% 2hX"12
VSI_"% 5hd""0x% 4hX"12
VLI_"% 10ld""%08lXh"12
VQI_"% 20.0Lf"16
VU_32-bit: "% 10u"
16-bit "% 5u"
"%04xh"
"%04xh"
12
12
VUB_"% 3hu""0%02ho"12
VUS_"% 5hu""0%04ho"12
VUL_"% 10lu""0%08lO"12

The data type quad is converted into extended before being passed to fprintf (which, at present, does not support quads). This explains why the format string in the VQI_ version tells fprintf to expect a long double. Similarly, byte-sized integers are extended to 16-bit, so that the format specifier has to be for 16-bit numbers.

Error handlingFormat strings longer than the maximum length specified in the above table lead to a program abort with the error message "Invalid Parameter(s)".
The contents of the format string is not checked. So you have to be very careful to specify a format which is valid for the respective data type.
Return valuenone
See alsoVF_setWriteSeparate,   VF_write,   VF_nwrite,   VF_read,   VF_nread

 

VF_setWriteSeparateVD_setWriteSeparateVE_setWriteSeparate
VCF_setWriteSeparateVCD_setWriteSeparateVCE_setWriteSeparate
VPF_setWriteSeparateVPD_setWriteSeparateVPE_setWriteSeparate
VI_setWriteSeparateVBI_setWriteSeparateVSI_setWriteSeparate
VLI_setWriteSeparateVQI_setWriteSeparate
VU_setWriteSeparateVUB_setWriteSeparateVUS_setWriteSeparate
VUL_setWriteSeparateVUI_setWriteSeparate
FunctionDefinition of the separation string used by V.._write
Syntax C/C++#include <VFstd.h>
void VF_setWriteSeparate( char *SepString );
C++ VecObj#include <OptiVec.h>
void vector<T>::setWriteSeparate( char *SepString );
Pascal/Delphiuses VFstd;
procedure VF_setWriteSeparate( SepString:PChar );
DescriptionBy default, VF_write puts a line feed character after each vector element written into a stream. This means that each element gets its own line. You may use VF_setWriteSeparate to define another separation string. This may be, for example, a tab character ("\t" for C/C++ or #9 for Pascal/Delphi) or a series of spaces (e.g., "    " for C/C++ or '    ' for Pascal/Delphi).

VF_write will insert the separation string only in between the vector elements. At the end, after the last element, there is always a line feed ("\n") instead of the separation string.

SepString may contain up to twelve characters.
C/C++ only:
If you use VF_write with the output sent directly to the printer (stream = stdprn), you probably have to explicitly use a carriage return character in addition to the line feed. To do this, call
VF_setWriteSeparate( "\n\r" );

Error handlingIn the case of SepString longer than twelve characters, the program is aborted with the error message "Invalid Parameter(s)".
The contents of SepString is not checked.
Return valuenone
See alsoVF_setWriteFormat,   VF_setNWriteSeparate,   VF_write,   VF_read

 

VF_sgnVD_sgnVE_sgn
FunctionSignum function, compares each element of a vector with 0.
Syntax C/C++#include <VFmath.h>
void VF_sgn( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::sgn( const vector<T>& X );
Pascal/Delphiuses VFmath;
procedure VF_sgn( Y, X:fVector; size:UInt );
DescriptionEach element of X is compared with 0 and the result of the comparison stored in Y:
Yi = +1.0, if Xi > 0
Yi =   0.0, if Xi = 0
Yi =  -1.0, if Xi < 0.
This function is identical to VF_cmp0.
Error handlingnone
Return valuenone
See alsoVF_cmp_...,   VF_cmpC,   VF_cmpV

 

VI_shlVBI_shlVSI_shlVLI_shlVQI_shl
VU_shlVUB_shlVUS_shlVUL_shlVUI_shl
Function"Shift to the left", i.e. multiply by integer powers of 2.
Syntax C/C++#include <VImath.h>
void VI_shl( iVector Y, iVector X, ui size, unsigned C );
void VUL_shl( ulVector Y, ulVector X, ui size, unsigned C );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::shl( const vector<T>& X, unsigned C );
Pascal/Delphiuses VImath;
procedure VI_shl( Y, X:iVector; size:UInt; C:UInt );
procedure VUL_shl( Y, X:ulVector; size:UInt; C:UInt );

    (similarly all other functions of this family)
DescriptionYi = Xi << C
All bits of Xi are shifted to the left by as many positions as indicated in the parameter C. This corresponds to a multiplication by 2C, neglecting possible overflow (in all versions) and loss of the sign bit (for signed numbers, i.e. in the VI_,   VBI_,   VSI_,   VLI_, and VQI_ versions).
Note that by shifting 8-bit numbers (VBI_,   VUB_ versions) by more than 7 positions, any non-zero bit present in the original number is lost and the result is 0. The same is true for 16-bit numbers (VSI_,   VUS_ versions) shifted by more than 15 positions, and for 32-bit numbers (VLI_, VUL_) shifted by more than 31 positions.
C is always of the data type unsigned. Shifting by negative numbers C is, therefore, not possible. To perform a right-shift, the appropriate function of the VI_shr family has to be used.
Error handlingnone
Return valuenone
See alsoVI_mulC,   VI_shr

 

VI_shrVBI_shrVSI_shrVLI_shrVQI_shr
VU_shrVUB_shrVUS_shrVUL_shrVUI_shr
Function"Shift to the right", i.e., divide by integer powers of 2.
Syntax C/C++#include <VImath.h>
void VI_shr( iVector Y, iVector X, ui size,unsigned C );
void VUL_shr( ulVector Y, ulVector X, ui size, unsigned C );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::shr( const vector<T>& X, unsigned C );
Pascal/Delphiuses VImath;
procedure VI_shr( Y, X:iVector; size:UInt; C:UInt );
procedure VUL_shr( Y, X:ulVector; size:UInt; C:UInt );

    (similarly all other functions of this family)
DescriptionYi = Xi >> C
All bits of Xi are shifted to the right by as many positions as indicated in the parameter C. This corresponds to an integer division by 2C. The sign of Yi is always the same as of Xi. In contrast to explicit integer divisions, the result is always rounded toward minus infinity: -15 / 2 = -7, but -15 >> 1 = -8.
Note that by shifting 8-bit numbers by more than 7 positions, any unsigned or positive number yields 0, whereas any negative number yields -1 in this case.
The same is true for 16-bit numbers upon shifting by more than 15 positions, and for 32-bit numbers being shifted by more than 31 positions.

C is always of the data type unsigned. Shifting by negative numbers C is, therefore, not possible. To perform a left-shift, the appropriate function of the VI_shl family has to be used.

Error handlingnone
Return valuenone
See alsoVI_divC,   VI_shl

 

VF_sinVD_sinVE_sin
VFx_sinVDx_sinVEx_sin
VFr_sinVDr_sinVEr_sin
VFrx_sinVDrx_sinVErx_sin
VCF_sinVCD_sinVCE_sin
VCFx_sinVCDx_sinVCEx_sin
FunctionSine function
Syntax C/C++#include <VFmath.h>
int VF_sin( fVector Y, fVector X, ui size );
int VFx_sin( fVector Y, fVector X, ui size, float A, float B, float C );
int VFr_sin( fVector Y, fVector X, ui size );
int VFrx_sin( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sin( const vector<T>& X );
int vector<T>::x_sin( const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::r_sin( const vector<T>& X );
int vector<T>::rx_sin( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sin( Y, X:fVector; size:UInt ): IntBool;
function VFx_sin( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VFr_sin( Y, X:fVector; size:UInt ): IntBool;
function VFrx_sin( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sin( Xi )
expanded versions: Yi = C * sin( A*Xi+B )
For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as fractional multiples of p, it is better to use VF_sinrpi than VF_sin.
If, on the other hand, one can be sure that all Xi are within the range -2p <= Xi <= +2p, one can employ the faster reduced-range versions with the prefixes VFr_ and VFrx_.
Error handlingPrecision errors lead to a default result of 0.0 and a non-zero return value, but are ignored otherwise; _matherr is not called.
OVERFLOW errors can only occur in the complex versions and lead to a result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_sin2,   VF_sinrpi,   VF_cos,   VF_sinh,   VF_asin,   sin

 

VF_sin2VD_sin2VE_sin2
VFx_sin2VDx_sin2VEx_sin2
VFr_sin2VDr_sin2VEr_sin2
VFrx_sin2VDrx_sin2VErx_sin2
FunctionSquare of the sine function
Syntax C/C++#include <VFmath.h>
int VF_sin2( fVector Y, fVector X, ui size );
int VFx_sin2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sin2( const vector<T>& X );
int vector<T>::x_sin2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sin2( Y, X:fVector; size:UInt ): IntBool;
function VFx_sin2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sin2( Xi )
expanded versions: Yi = C * sin2( A*Xi+B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards. The reduced-range versions with the prefixes VFr_ and VFrx_ are for situations in which one can be sure that all input values lie in the range -2p <= Xi <= +2p.
Error handlingPrecision errors lead to a default result of 0.0 and a non-zero return value, but are otherwise ignored; _matherr is not called.
OVERFLOW errors can only occur in the complex versions and lead to a result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sin,   VF_sinrpi,  sin

 

VF_sincVD_sincVE_sinc
VFx_sincVDx_sincVEx_sinc
FunctionSinc function
Syntax C/C++#include <VFmath.h>
int VF_sinc( fVector Y, fVector X, ui size );
int VFx_sinc( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sinc( const vector<T>& X );
int vector<T>::x_sinc( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sinc( Y, X:fVector; size:UInt ): IntBool;
function VFx_sinc( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sinc( Xi ) = sin( Xi ) / Xi
expanded versions: Yi = C * sinc( A*Xi+B )
The sinc function for an argument of 0.0 is defined as 1.0. The sinc function is the Fourier transform of a square pulse and is used, for example, to describe the diffraction pattern of a slit.
Error handlingThese functions should be error-proof.
Return valuealways FALSE (0).
See alsoVF_sin,   VF_sinrpi,   sin

 

VF_sincosVD_sincosVE_sincos
VFx_sincosVDx_sincosVEx_sincos
VFr_sincosVDr_sincosVEr_sincos
VFrx_sincosVDrx_sincosVErx_sincos
FunctionSine and Cosine simultaneously
Syntax C/C++#include <VFmath.h>
int VF_sincos( fVector YSin, fVector YCos, fVector X, ui size );
int VFx_sincos( fVector YSin, fVector YCos, fVector X, ui size, float A, float B, float C );
int VFr_sincos( fVector YSin, fVector YCos, fVector X, ui size );
int VFrx_sincos( fVector YSin, fVector YCos, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sincos( vector<T> YCos, const vector<T>& X );
int vector<T>::x_sincos( vector<T> YCos, const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::r_sincos( vector<T> YCos, const vector<T>& X );
int vector<T>::rx_sincos( vector<T> YCos, const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sincos( Sin, Cos, X:fVector; size:UInt ): IntBool;
function VFx_sincos( Sin, Cos, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VFr_sincos( Sin, Cos, X:fVector; size:UInt ): IntBool;
function VFrx_sincos( Sin, Cos, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions:
YSini = sin( Xi )
YCosi = cos( Xi )
expanded versions:
YSini = C * sin( A*Xi+B )
YCosi = C * cos( A*Xi+B )
The sine and the cosine are calculated simultaneously, which is far more efficient than calculating them separately if both of them are needed. For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as fractional multiples of p, it is better to use VF_sincosrpi than VF_sincos.
If, on the other hand, one can be sure that all Xi are within the range -2p <= Xi <= +2p, one can employ the faster reduced-range versions with the prefixes VFr_ and VFrx_.
Error handlingPrecision errors lead to a result of 0.0 for the sine and 1.0 for the cosine (as if the input were 0.0) along with a non-zero return value, but are otherwise ignored; _matherr is not called. Other errors should not occur.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sincos2,   VF_sincosrpi,   sin,   cos

 

VF_sincos2VD_sincos2VE_sincos2
VFx_sincos2VDx_sincos2VEx_sinco2
VFr_sincos2VDr_sincos2VEr_sincos2
VFrx_sincos2VDrx_sincos2VErx_sinco2
FunctionSquare of the sine and of the cosine simultaneously
Syntax C/C++#include <VFmath.h>
int VF_sincos2( fVector YSin2, fVector YCos2, fVector X, ui size );
int VFx_sincos2( fVector YSin2, fVector YCos2, fVector X, ui size, float A, float B, float C );
int VFr_sincos2( fVector YSin, fVector YCos, fVector X, ui size );
int VFrx_sincos2(fVector YSin, fVector YCos, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sincos2( vector<T> YCos2, const vector<T>& X );
int vector<T>::x_sincos2( vector<T> YCos2, const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::r_sincos2( vector<T> YCos, const vector<T>& X );
int vector<T>::rx_sincos2( vector<T> YCos, const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sincos2( Sin, Cos, X:fVector; size:UInt ): IntBool;
function VFx_sincos2( Sin, Cos, X:fVector; size:UInt; A, B, C:Single ): IntBool;
function VFr_sincos2( Sin, Cos, X:fVector; size:UInt ): IntBool;
function VFrx_sincos2(Sin, Cos, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions:
YSin2i = sin2( Xi )
YCos2i = cos2( Xi )
expanded versions:
YSin2i = C * sin2( A*Xi+B )
YCos2i = C * cos2( A*Xi+B )
The squared sine and the squared cosine are calculated simultaneously, which is far more efficient than calculating them separately, if both of them are needed.
The reduced-range versions with the prefixes VFr_ and VFrx_ are for situations in which one can be sure that all input values lie in the range -2p <= Xi <= +2p.
Error handlingPrecision errors lead to a result of 0.0 for the sin2 and of 1.0 for the cos2 (as if the input were 0.0) along with a non-zero return value, but are otherwise ignored; _matherr is not called. Other errors should not occur.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sincos,   sin,   cos

 

VF_sincosrpiVD_sincosrpiVE_sincosrpi
VF_sincosrpi2VD_sincosrpi2VE_sincosrpi2
VF_sincosrpi3VD_sincosrpi3VE_sincosrpi3
FunctionSine and cosine of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_sincosrpi( fVector YSin, fVector YCos, iVector P, ui size, int q );
int VF_sincosrpi2( fVector YSin, fVector YCos, iVector P, ui size, int q );
int VF_sincosrpi3( fVector YSin, fVector YCos, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::sincosrpi( vector<T> YCos, const vector<int>& P, int q );
int vector<T>::sincosrpi2( vector<T> YCos, const vector<int>& P, int q );
int vector<T>::sincosrpi3( vector<T> YCos, const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_sincosrpi( Sin, Cos:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_sincosrpi2( Sin, Cos:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_sincosrpi3( Sin, Cos:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYSini = sin( (Pi / q) * p )
YCosi = cos( (Pi / q) * p )
The sine and the cosine of fractional multiples of p are calculated. There are three versions: VF_sincosrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_sincosrpi2 should be used which is a highly optimized version reading the results from a table named VF_sintab2, if possible. If q is a multiple of 3, VF_sincosrpi3 should be used which utilizes a table named VF_sintab3. The use of VF_sincosrpi3 is a convenient way to use degrees instead of radians; if, for example, q is 180, then the unit of the elements of P is "degree". VF_sincosrpi2 and VF_sincosrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the (then useless) tables.
Error handlingThese functions should be error-proof, as long as q!=0.
Return valuealways FALSE (0)
See alsoVF_sincos,   sin,   cos

 

VF_sinhVD_sinhVE_sinh
VCF_sinhVCD_sinhVCE_sinh
VFx_sinhVDx_sinhVEx_sinh
VCFx_sinhVCDx_sinhVCEx_sinh
FunctionHyperbolic sine function
Syntax C/C++#include <VFmath.h>
int VF_sinh( fVector Y, fVector X, ui size );
int VFx_sinh( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sinh( const vector<T>& X );
int vector<T>::x_sinh( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sinh( Y, X:fVector; size:UInt ): IntBool;
function VFx_sinh( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sinh( Xi )
expanded versions: Yi = C * sinh ( A*Xi+B )
Error handlingOVERFLOW errors lead to a default result of ±HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_cosh,   VF_exp,   sinh

 

VF_sinrpiVD_sinrpiVE_sinrpi
VF_sinrpi2VD_sinrpi2VE_sinrpi2
VF_sinrpi3VD_sinrpi3VE_sinrpi3
FunctionSine function of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_sinrpi( fVector Y, iVector P, ui size, int q );
int VF_sinrpi2( fVector Y, iVector P, ui size, int q );
int VF_sinrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::sinrpi( const vector<int>& P, int q );
int vector<T>::sinrpi2( const vector<int>& P, int q );
int vector<T>::sinrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_sinrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_sinrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_sinrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = sin( (Pi / q) * p )
The sine of fractional multiples of p is calculated. There are three versions: VF_sinrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_sinrpi2 should be used which is a highly optimized version reading the results from a look-up table, if possible. If q is a multiple of 3, VF_sinrpi3 should be used. VF_sinrpi3 offers a convenient way to use degrees instead of radians; if, for example, q is 180, then the unit of the elements of P is "degree". VF_sinrpi2 and VF_sinrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the tables.
Error handlingThese functions should be error-proof, as long as q!=0.
Return valuealways FALSE (0)
See alsoVF_sin,   sin

 

VF_sintab2VD_sintab2VE_sintab2
VF_sintab3VD_sintab3VE_sintab3
 Table of sine values for arguments between 0 and p/2
Syntax C/C++#include <xmath.h>
extern float    VF_sintab2[ VF_tabsz2+1 ];
extern double   VD_sintab2[ VD_tabsz2+1 ];
extern extended VE_sintab2[ VE_tabsz2+1 ];
extern float    VF_sintab3[ VF_tabsz3+1 ];
extern double   VD_sintab3[ VD_tabsz3+1 ];
extern extended VE_sintab3[ VE_tabsz3+1 ];

Pascal/Delphiuses FSINTAB2, DSINTAB2, ESINTAB2, FSINTAB3, DSINTAB3, ESINTAB3;
VF_sintab2: array[0..VF_tabsz2] of Single;
VD_sintab2: array[0..VD_tabsz2] of Double;
VE_sintab2: array[0..VE_tabsz2] of Extended;
VF_sintab3: array[0..VF_tabsz3] of Single;
VD_sintab3: array[0..VD_tabsz3] of Double;
VE_sintab3: array[0..VE_tabsz3] of Extended;

DescriptionVF_sintab2[ i ] = sin( i/(2*VF_tabsz2) * p ),     i=0,...,VF_tabsz2
VF_sintab3[ i ] = sin( i/(2*VF_tabsz3) * p ),     i=0,...,VF_tabsz3
These look-up tables of sine values for arguments between 0 and p/2 are used by VF_sinrpi2 and the other functions of that family and are also available for other purposes.
C/C++: The symbols VF_tabsz2 etc., denoting the size of the tables, are defined in <xmath.h>.
Pascal/Delphi: The symbols VF_tabsz2 etc. are defined in the same units as the tables themselves.
See alsoVF_sinrpi2,   VF_tantab2,   VF_cosectab2

 

VF_smoothVD_smoothVE_smooth
FunctionData smoothing
Syntax C/C++#include <VFstd.h>
void VF_smooth( fVector Y, fVector X, ui size, unsigned deg);
C++ VecObj#include <OptiVec.h>
void vector<T>::smooth( const vector<T>& X, unsigned deg );
Pascal/Delphiuses VFstd;
procedure VF_smooth( Y,X:fVector; size, deg: UInt );
DescriptionA primitive, but very fast low-frequency filtering of the vector X is performed. For each point, a weighted average of the point itself and its one or few nearest neighbours is calculated. The argument deg decides how many points are taken into accout. E.g., deg=3 means 3-point smoothing by the formula:
Yi = 0.25 * (2*Xi + Xi-1 + Xi+1)
Higher degrees (5, 7, 9...) of smoothing are achieved internally by repeated 3-point smoothing. deg = 0 or 1 means no smoothing at all; deg = 2 or 3 is interpreted as 3-point smoothing, deg = 4 or 5 as 5-point smoothing, and so on.
Error handlingnone
Return valuenone
See alsoVF_filter

 

VF_sortVD_sortVE_sort
VI_sortVBI_sortVSI_sortVLI_sortVQI_sort
VU_sortVUB_sortVUS_sortVUL_sortVUI_sort
FunctionSorting into ascending or descending order
Syntax C/C++#include <VFstd.h>
void VF_sort( fVector Y, fVector X, ui size, int dir );
C++ VecObj#include <OptiVec.h>
void vector<T>::sort( const vector<T>& X, int dir=1 );
Pascal/Delphiuses VFstd;
procedure VF_sort( Y, X:fVector; size:UInt; dir:Integer );
DescriptionThe vector is sorted in ascending order, if dir is positive; negative dir yields descending order. The present implementation uses the "Heapsort" algorithm.
Error handlingnone
Return valuenone
See alsoVF_sortind,   VF_rotate,   VF_rev,   qsort (C/C++ only)

 

VF_sortindVD_sortindVE_sortind
VI_sortindVBI_sortindVSI_sortindVLI_sortindVQI_sortind
VU_sortindVUB_sortindVUS_sortindVUL_sortindVUI_sortind
FunctionSort the index-array of a vector
Syntax C/C++#include <VFstd.h>
void VF_sortind( uiVector Ind, fVector X, ui size, int dir );
C++ VecObj#include <OptiVec.h>
void vector<ui>::sortind( const vector<T>& X, int dir=1 );
Pascal/Delphiuses VFstd;
procedure VF_sortind( Ind:uVector; X:fVector; size:UInt; dir:Integer );
DescriptionThe routine is similar to VF_sort, but this time it is the index-array of X rather than the vector X itself that is ordered. Ascending order is obtained by setting dir to any positive number. Here, ascending order means that Ind0 will contain the index of the smallest element of X, Ind1 the index of the second-smallest, and so on, up to Indsize-1, the index of the largest element in X. Descending order is obtained by setting dir negative. This routine is used if other vectors are correlated with X and the correlation of the individual elements has to be maintained. After sorting the index-array, use VF_indpick (VD_indpick,   VI_indpick, etc.) to actually perform the sorting of X and the other vectors correlated with X.
Error handlingnone
Return valuenone
See alsoVF_sort,   VF_indpick

 

VF_spectrumVD_spectrumVE_spectrum
FunctionPower-density spectrum
Syntax C/C++#include <VFstd.h>
float VF_spectrum( fVector Spc, ui specsiz, fVector X, ui xsiz, fVector Win );
C++ VecObj#include <OptiVec.h>
T vector<T>::spectrum( const vector<T>& X, const vector<T>& Win );
Pascal/Delphiuses VFstd;
function VF_spectrum( Spc:fVector; specsiz:UInt; X:fVector; xsiz:UInt; Win:fVector ): Single;
DescriptionThe data set X is analyzed for its power spectral density (PSD), i.e. the mean square amplitude. The result is stored in Spc. xsiz must be at least 2*specsiz, and specsiz has to be an integer power of 2. Internally, X is divided into xsiz*specsiz/2 segments and the average over the spectra of the individual segments is calculated. Each segment of length 2*specsiz yields the PSD for specsiz+1 frequencies (see VF_FFT). In order to keep specsiz an integer power of 2, there are only specsiz points stored in Spc and the last one, the PSD at the Nyquist frequency fNyquist = 0.5 / sampling_interval, is given as the return value of the function. It may either be neglected (by calling the function like a void function) or stored as the last element in Spc by calling the function as
Spc[specsiz] = VF_spectrum( Spc, specsiz, X, xsiz, Win );
in this case, Spc must have a length of specsiz+1.

Win is a window that is applied to the data segments. The size of the Win vector must be 2*specsiz. Within the VectorLib library, three functions are available that give suitable Windows: VF_Welch,   VF_Parzen, and VF_Hanning. A square window (i.e. no windowing at all) is achieved by setting all elements of Win to 1.0 using VF_equ1. Use of the square window is not recommended here, though.

You may wish to test the quality of the calculated spectrum by applying Parseval's theorem (provided you called VF_spectrum as in the above example and stored the PSD for the Nyquist frequency):
1.0/xsize * VF_ssq( X, xsize ) must be about equal to VF_sum( Spc, specsiz+1 ).
If the deviation between both results is large, the sampling interval in X probably is too large.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Example C/C++ (for DOS):#include <VFstd.h>
#include <VFmath.h>
#include <Vgraph.h>
#include <math.h>
#include <conio.h>
void main( void )
{
    fVector X, Spc, Win, Time, Freq;
    float deltat, fOscill, fNyquist;
    ui xsize=4096, specsiz=256;
    X = VF_vector( xsize );
    Spc = VF_vector( specsiz+1 );
    Win = VF_vector( 2*specsiz );
    Time = VF_vector( xsize );
    Freq = VF_vector( specsiz+1);
    deltat = 0.001;            /* sampling interval 1 millisecond */
    fNyquist = 0.5 / deltat;   /* Nyquist frequency = 500 Hz */
    fOscill = 100;             /* say we are sampling a 100 Hz oscillation */
    VF_ramp( Time, xsize, 0, deltat );
    VF_ramp( Freq, specsiz+1, 0, fNyquist / specsiz );
    VFx_sin( X, Time, xsize, 2*M_PI*fOscill, 0, 1 );
           /* sine wave (omega*t) */
    VF_cmpC( X, X, xsize, 0.7 );
                  /* convert into asymmetric square wave */
    VF_Welch( Win, 2*specsiz ); /* or another window */
    Spc[specsiz] = VF_spectrum( Spc, specsiz, X, xsize, Win );
    V_initGraph( "\\BorlandC\\BGI\\" );
                       /* give the correct BGI path! */
    VF_xyAutoPlot( Freq, Spc, specsiz+1,
                   PS_SOLID | SY_CROSS, GREEN );
    getch(); /* hit any key when you have seen enough */
    closegraph();
    V_nfree( 5, Freq, Time, Win, Spc, X );
}
Example Pascal/Delphi: uses VFstd, VFmath, Vgraph,...;
const
    xsize=4096; specsiz=256;
var
    X, Spc, Win, Time, Freq: fVector;
    deltat, fOscill, fNyquist: Single;
begin
    X := VF_vector( xsize );
    Spc := VF_vector( specsiz+1 );
    Win := VF_vector( 2*specsiz );
    Time := VF_vector( xsize );
    Freq := VF_vector( specsiz+1);
    deltat := 0.001;           (* sampling interval 1 millisecond *)
    fNyquist := 0.5 / deltat;  (* Nyquist frequency = 500 Hz *)
    fOscill := 100;            (* say we are sampling a 100 Hz oscillation *)
    VF_ramp( Time, xsize, 0, deltat );
    VF_ramp( Freq, specsiz+1, 0, fNyquist / specsiz );
    VFx_sin( X, Time, xsize, 2*PI*fOscill, 0, 1 );
             (* sine wave (omega*t) *)
    VF_cmpC( X, X, xsize, 0.7 );
          (* convert into an asymmetric square wave *)
    VF_Welch( Win, 2*specsiz ); (* or another window *)
    VF_Pelement( Spc,specsiz )^ :=
            VF_spectrum( Spc, specsiz, X, xsize, Win );
    VF_xyAutoPlot( Freq, Spc, specsiz+1,
                   PS_SOLID + SY_CROSS, GREEN );
    V_free( Freq ); V_free( Time ); V_free( Win );
    V_free( Spc ); V_free( X );
end;

(* It is assumed that the graphics routines have already been initialized (DOS), or that the above example stands within a Paint (Pascal for Windows) or a ShowView (Delphi) routine. *)

Error handlingIf size is not a power of 2, VF_FFT (on which VF_spectrum is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuePSD at the Nyquist frequency
See alsoVF_FFT,   VF_convolve,   VF_autocorr,   VF_xcorr,   VF_filter

 

VF_splinederiv2VD_splinederiv2VE_splinederiv2
FunctionGenerate a second-derivative table from an X-Y-table to be used for cubic-spline interpolation.
Syntax C/C++#include <VFstd.h>
void VF_splinederiv2( fVector Y2, fVector XTab, fVector YTab, ui size, int specify, float Yp0, float Ypn );
C++ VecObj#include <OptiVec.h>
void vector<T>::splinederiv2( const vector<T>& XTab, const vector<T>& YTab, int specify, T Yp0, T Ypn );
Pascal/Delphiuses VFstd;
procedure VF_splinederiv2( Y2, XTab, YTab:fVector; size:UInt; specify:IntBool; Yp0, Ypn:Single );
DescriptionA table of second derivatives of YTab is generated to be used for cubic-spline interpolation with VF_splineinterpol. In order to get a unique solution, two additional conditions have to be specified. Setting specify to FALSE (0) yields the "natural cubic spline" with Y2 being set to zero at both end-points; in this case, Yp0 and Ypn have no influence. Setting specify to TRUE (1) yields Y2 calculated in such a way that the first(!) derivative at the zero'th and at the last position equals Yp0 and Ypn, resp.
Error handlingnone
Return valuenone
See alsoVF_splineinterpol

 

VF_splineinterpolVD_splineinterpolVE_splineinterpol
FunctionCubic-spline interpolation of X-Y-table values
Syntax C/C++#include <VFstd.h>
void VF_splineinterpol( fVector Y, fVector X, ui sizex, fVector XTab, fVector YTab, fVector Y2Tab, ui sizetab );
C++ VecObj#include <OptiVec.h>
void vector<T>::splineinterpol( const vector<T>& X, const vector<T>& XTab, const vector<T>& YTab, const vector<T>& Y2Tab );
Pascal/Delphiuses VFstd;
procedure VF_splineinterpol( Y, X:fVector; sizex:UInt; XTab, YTab, Y2Tab:fVector; sizetab:UInt );
DescriptionFor each of the sizex elements of X, the corresponding element of Y is interpolated from the XTab-YTab value pairs. A table of second derivatives of YTab is needed that has to be generated by a call to VF_splinederiv2 prior to calling VF_splineinterpol. XTab must be ordered (either ascending or descending). All values of XTab must be distinct; otherwise a division by zero may occur and lead to a program abort. sizetab must be greater than or equal to 3.
Error handlingnone (you have to take care yourself that the XTab values are distinct and that the YTab values are not near the limit of overflowing).
Return valuenone
See alsoVF_splinederiv2,   VF_ratinterpol,   VF_polyinterpol

 

VF_squareVD_squareVE_square
VFx_squareVDx_squareVEx_square
VFu_squareVDu_squareVEu_square
VFux_squareVDux_squareVEux_square
VCF_squareVCD_squareVCE_square
VCFx_squareVCDx_squareVCEx_square
VCFu_squareVCDu_squareVCEu_square
VCFux_squareVCDux_squareVCEux_square
VPF_squareVPD_squareVPE_square
VPFu_squareVPDu_squareVPEu_square
FunctionSquare
Syntax C/C++#include <VFmath.h>
int VF_square( fVector Y, fVector X, ui size );
int VFx_square( fVector Y, fVector X, ui size, float A, float B );
int VFu_square( fVector Y, fVector X, ui size );
int VFux_square( fVector Y, fVector X, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::square( const vector<T>& X );
int vector<T>::x_square( const vector<T>& X, const T& A, const T& B );
int vector<T>::u_square( const vector<T>& X );
int vector<T>::ux_square( const vector<T>& X, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_square( Y, X:fVector; size:UInt ): IntBool;
function VFx_square( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
function VFu_square( Y, X:fVector; size:UInt ): IntBool;
function VFux_square( Y, X:fVector; size:UInt; A, B:Single ): IntBool;
Descriptionnormal versions: Yi = Xi2
expanded versions: Yi = (A*Xi+B)2

The "unprotected" versions (prefix VFu_,   VFux_, etc.) do not perform any error handling, which makes them much faster (up to 50%), but riskier than the standard versions. The extended-precision complex (VCEu_ and VCEux_) versions do not take some of the security measures present in the standard version and might fail for results very near the overflow limit; results near the underflow limit might be rendered as 0.

Error handlingOVERFLOW errors lead to a default result of HUGE_VAL.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_cubic,   VF_sqrt,   VF_pow,   VF_ipow,   VF_poly

 

VF_sqrtVD_sqrtVE_sqrt
VFu_sqrtVDu_sqrtVEu_sqrt
VCF_sqrtVCD_sqrtVCE_sqrt
VFx_sqrtVDx_sqrtVEx_sqrt
VFux_sqrtVDux_sqrtVEux_sqrt
VCFx_sqrtVCDx_sqrtVCEx_sqrt
VPF_sqrtVPD_sqrtVPE_sqrt
FunctionSquare root
Syntax C/C++#include <VFmath.h>
int VF_sqrt( fVector Y, fVector X, ui size );
int VFx_sqrt( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sqrt( const vector<T>& X );
int vector<T>::x_sqrt( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sqrt( Y, X:fVector; size:UInt ): IntBool;
function VFx_sqrt( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = sqrt( Xi )
expanded versions: Yi = C * sqrt( A*Xi+B )

The "unprotected" versions (prefix VFu_,   VFux_, etc.) do not perform any error handling, which makes them much faster (up to 350% for VFux_sqrt on Pentium III or IV) than the standard versions. On the other hand, any negative input number may lead to an uncontrolled programme crash. Input numbers near the underflow limit may lead to a result of 0. Apart from allowing no negative input numbers, the "unprotected" expanded version (prefix VFux_) also requires that neither the product A*Xi nor the sum A*Xi+B may overflow.

Error handlingDOMAIN errors occur if, in the real-number versions, the square root of a negative numbers is requested; NAN ("not-a-number") is the default result in this case.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_square,   VF_pow,   VF_ipow,   VF_poly

 

VF_ssqVD_ssqVE_ssq
FunctionSum-of-squares
Syntax C/C++#include <VFstd.h>
float VF_ssq( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::ssq();
Pascal/Delphiuses VFstd;
function VF_ssq( X:fVector; size:UInt ): Single;
Descriptionssq = sum( Xi2 )
Error handlingnone (but be careful: this function may lead to an overflow!)
Return valuesum of the squares of the vector elements.
See alsoVF_sum,   VF_rms,   VF_ssqdevC,   VF_scalprod,   VF_Euclid

 

VF_ssqdevCVD_ssqdevCVE_ssqdevC
FunctionSum of the squares of the deviations from a preset value.
Syntax C/C++#include <VFstd.h>
float VF_ssqdevC( fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
T vector<T>::ssqdevC( const T& C );
Pascal/Delphiuses VFstd;
function VF_ssqdevC( X:fVector; size:UInt; C:Single ): Single;
DescriptionssqdevC = sum( (Xi - C)2 )
Error handlingnone
Return valuesum of the squares of the deviations.
See alsoVF_ssq,   VF_ssqdevV,   VF_avdevC,   VF_sumdevC,   VF_chi2

 

VF_ssqdevVVD_ssqdevVVE_ssqdevV
FunctionSum of the squares of the deviations of the elements of one vector from the corresponding elements of another
Syntax C/C++#include <VFstd.h>
float VF_ssqdevV( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::ssqdevV( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_ssqdevV( X, Y:fVector; size:UInt ): Single;
DescriptionssqdevV = sum( (Xi - Yi)2 )
The deviation of each element of X from the corresponding element of Y is calculated and the squares of the deviations summed up and returned.
Error handlingnone
Return valuesum of the squares of the deviations.
See alsoVF_ssq,   VF_ssqdevC,   VF_avdevV,   VF_sumdevV,   VF_chi2

 

VF_storeVD_storeVE_store
VCF_storeVCD_storeVCE_store
VPF_storeVPD_storeVPE_store
VI_storeVBI_storeVSI_storeVLI_storeVQI_store
VU_storeVUB_storeVUS_storeVUL_storeVUI_store
FunctionStore a vector in binary format into a stream
Syntax C/C++#include <VFstd.h>
VF_store( FILE *stream, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::store( FILE *stream );
Pascal/Delphiuses VFstd;
procedure VF_store( var Stream:FILE; X:fVector; size:UInt );
Descriptionsize elements of X are written to stream in binary format. The stream must be already open for binary write operations.
The VecObj version stores not only the vector elements, but the whole vector object by first storing size. Please note that VF_recall etc. can only read vectors stored with VF_store etc., whereas the VecObj function recall is used to retrieve vector objects stored with the VecObj function store. You can, however, employ the calling sequence
VUI_store( stream, &size, 1 );
VF_store( stream, X, size );   /* C/C++ */

or
VU_store( stream, @size, 1 );
VF_store( stream, X, size );   (* Pascal/Delphi *)

to make the stored vector X readable as a vector object later.
Error handlingnone
Return valuenone
See alsoVF_recall,   VF_write,   VF_cprint,   VF_print

 

VF_subCVD_subCVE_subC
VCF_subCVCD_subCVCE_subC
VCF_subReCVCD_subReCVCE_subReC
VI_subCVBI_subCVSI_subCVLI_subCVQI_subC
VU_subCVUB_subCVUS_subCVUL_subCVUI_subC
FunctionSubtract a constant from each vector element
Syntax C/C++#include <VFmath.h>
void VF_subC( fVector Y, fVector X, ui size, float C );
void VCF_subC( cfVector Y, cfVector X, ui size, fComplex C );
void VCF_subReC( cfVector Y, cfVector X, ui size, float CRe );
C++ VecObj#include <OptiVec.h>
void vector<T>::subC( const vector<T>& X, const T& C );
void vector<complex<T>>::subC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::subReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_subC( Y, X:fVector; size:UInt; C:Single );
procedure VCF_subC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCF_subReC( Y, X:cfVector; size:UInt; CRe:Single );
DescriptionYi = Xi - C
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe subtracted from the complex vector.
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_subV,   VF_subrC,   VF_addC,   VF_mulC,   VF_divC

 

VF_subrCVD_subrCVE_subrC
VCF_subrCVCD_subrCVCE_subrC
VCF_subrReCVCD_subrReCVCE_subrReC
VI_subrCVBI_subrCVSI_subrCVLI_subrCVQI_subrC
VU_subrCVUB_subrCVUS_subrCVUL_subrCVUI_subrC
FunctionReverse subtraction: subtract a vector from a constant
Syntax C/C++#include <VFmath.h>
void VF_subrC( fVector Y, fVector X, ui size, float C );
void VCF_subrC( cfVector Y, cfVector X, ui size, fComplex C );
void VCF_subrReC( cfVector Y, cfVector X, ui size, float CRe );
C++ VecObj#include <OptiVec.h>
void vector<T>::subrC( const vector<T>& X, const T& C );
void vector<complex<T>>::subrC( const vector<complex<T>>& X, complex<T> C );
void vector<complex<T>>::subrReC( const vector<complex<T>>& X, const T& CRe );
Pascal/Delphiuses VFmath;
procedure VF_subrC( Y, X:fVector; size:UInt; C:Single );
procedure VCF_subrC( Y, X:cfVector; size:UInt; C:fComplex );
procedure VCF_subrReC( Y, X:cfVector; size:UInt; CRe:Single );
DescriptionYi = C - Xi
The complex floating-point versions exist in two variants, one for complex constants C, the other for real-valued constants CRe from which the complex vector is subtracted.
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_addV,   VF_subC,   VF_mulC,   VF_divC,   VF_visC,   VF_redC

 

VF_subrVVD_subrVVE_subrV
VCF_subrVVCD_subrVVCE_subrV
VCF_subrReVVCD_subrReVVCE_subrReV
VFx_subrVVDx_subrVVEx_subrV
VCFx_subrVVCDx_subrVVCEx_subrV
VCFx_subrReVVCDx_subrReVVCEx_subrReV
VI_subrVVBI_subrVVSI_subrVVLI_subrVVQI_subrV
VU_subrVVUB_subrVVUS_subrVVUL_subrVVUI_subrV
FunctionSubtraction in reverse order
Syntax C/C++#include <VFmath.h>
void VF_subrV( fVector Z, fVector X, fVector Y, ui size );
void VFx_subrV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
void VCF_subrV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_subrReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCFx_subrV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_subrReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );
C++ VecObj#include <OptiVec.h>
void vector<T>::subrV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_subrV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::subrV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::subrReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::x_subrV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_subrReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_subrV( Z, X, Y:fVector; size:UInt );
procedure VFx_subrV( Z, X, Y:fVector; size:UInt; A, B:Single);
procedure VCF_subrV( Z, X, Y:cfVector; size:UInt );
procedure VCF_subrReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCFx_subrV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_subrReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );
Descriptionnormal versions: Zi = Yi - Xi
expanded versions: Zi = Yi - (A*Xi+B)
The complex floating-point versions exist in two variants: in the first variant (e.g., VCF_subrV,   VCFx_subrV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g., VCF_subrReV - "reverse subtraction of a real vector", i.e., subtraction of a complex vector from a real vector).
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_subrC,   VF_addV,   VF_mulV,   VF_divV,   VF_subV,   VF_subrVI

 

VF_subrVIVD_subrVIVE_subrVI
VF_subrVBIVD_subrVBIVE_subrVBI
VF_subrVSIVD_subrVSIVE_subrVSI
VF_subrVLIVD_subrVLIVE_subrVLI
VF_subrVQIVD_subrVQIVE_subrVQI
VF_subrVUVD_subrVUVE_subrVU
VF_subrVUBVD_subrVUBVE_subrVUB
VF_subrVUSVD_subrVUSVE_subrVUS
VF_subrVULVD_subrVULVE_subrVUL
VF_subrVUIVD_subrVUIVE_subrVUI
FunctionReverse subtraction: subtract a floating-point vector from an integer vector
Syntax C/C++#include <VFmath.h>
void VF_subrVI( fVector Z, fVector X, iVector Y,ui size );
void VF_subrVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::subrVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::subrVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_subrVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_subrVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Yi - Xi
Error handlingnone
Return valuenone
See alsoVF_subrV,   VF_subVI,   VF_addVI

 

VF_subVVD_subVVE_subV
VCF_subVVCD_subVVCE_subV
VCF_subReVVCD_subReVVCE_subReV
VFs_subVVDs_subVVEs_subV
VFx_subVVDx_subVVEx_subV
VCFx_subVVCDx_subVVCEx_subV
VCFx_subReVVCDx_subReVVCEx_subReV
VI_subVVBI_subVVSI_subVVLI_subVVQI_subV
VU_subVVUB_subVVUS_subVVUL_subVVUI_subV
FunctionSubtract two vectors
Syntax C/C++#include <VFmath.h>
void VF_subV( fVector Z, fVector X, fVector Y, ui size );
void VFs_subV( fVector Z, fVector X, fVector Y, ui size, float C );
void VFx_subV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
void VCF_subV( cfVector Z, cfVector X, cfVector Y, ui size );
void VCF_subReV( cfVector Z, cfVector X, fVector Y, ui size );
void VCFx_subV( cfVector Z, cfVector X, cfVector Y, ui size, fComplex A, fComplex B );
void VCFx_subReV( cfVector Z, cfVector X, fVector Y, ui size, fComplex A, fComplex B );
C++ VecObj#include <OptiVec.h>
void vector<T>::subV( const vector<T>& X, const vector<T>& Y );
void vector<T>::s_subV( const vector<T>& X, const vector<T>& Y, const T& C );
void vector<T>::x_subV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
void vector<complex<T>>::subV( const vector<complex<T>>& X, const vector<complex<T>>& Y );
void vector<complex<T>>::subReV( const vector<complex<T>>& X, const vector<T>& Y );
void vector<complex<T>>::x_subV( const vector<complex<T>>& X, const vector<complex<T>>& Y, complex<T> A, complex<T> B );
void vector<complex<T>>::x_subReV( const vector<complex<T>>& X, const vector<T>& Y, complex<T> A, complex<T> B );
Pascal/Delphiuses VFmath;
procedure VF_subV( Z, X, Y:fVector; size:UInt );
procedure VFx_subV( Z, X, Y:fVector; size:UInt; A, B:Single);
procedure VCF_subV( Z, X, Y:cfVector; size:UInt );
procedure VCF_subReV( Z, X:cfVector; Y:fVector; size:UInt );
procedure VCFx_subV( Z, X, Y:cfVector; size:UInt; A, B:fComplex );
procedure VCFx_subrReV( Z, X:cfVector; Y:fVector; size:UInt; A, B:fComplex );
Descriptionnormal versions: Zi = Xi - Yi
scaled versions: Zi = C * (Xi - Yi)
expanded versions: Zi = (A*Xi+B) - Yi
The complex floating-point versions exist in two variants: in the first variant (e.g., VCF_subV,   VCFx_subV), X, Y, and Z are all complex; in the second variant, Y is real-valued (e.g., VCF_subReV - "subtract a real vector").
Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_subC,   VF_addV,   VF_mulV,   VF_divV,   VF_subVI

 

VF_subVIVD_subVIVE_subVI
VF_subVBIVD_subVBIVE_subVBI
VF_subVSIVD_subVSIVE_subVSI
VF_subVLIVD_subVLIVE_subVLI
VF_subVQIVD_subVQIVE_subVQI
VF_subVUVD_subVUVE_subVU
VF_subVUBVD_subVUBVE_subVUB
VF_subVUSVD_subVUSVE_subVUS
VF_subVULVD_subVULVE_subVUL
VF_subVUIVD_subVUIVE_subVUI
FunctionSubtract an integer vector from a floating-point vector
Syntax C/C++#include <VFmath.h>
void VF_subVI( fVector Z, fVector X, iVector Y,ui size );
void VF_subVUB( fVector Z, fVector X, ubVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::subVI( const vector<T>& X, const vector<int>& Y );
void vector<T>::subVUS( const vector<T>& X, const vector<unsigned short>& Y, );
Pascal/Delphiuses VFmath;
procedure VF_subVI( Z, X:fVector; Y:iVector; size:UInt );
procedure VF_subVUL( Z, X:fVector; Y:ulVector; size:UInt );
DescriptionZi = Xi - Yi
Error handlingnone
Return valuenone
See alsoVF_subV,   VF_subrVI,   VF_addVI

 

VF_sub2VVD_sub2VVE_sub2V
FunctionSubtract two vectors simultaneously from one vector
Syntax C/C++#include <VFmath.h>
void VF_sub2V( fVector Z, fVector X, fVector Y1, fVector Y2, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::sub2V( const vector<T>& X, const vector<T>& Y1, const vector<T>& Y2 );
Pascal/Delphiuses VFmath;
procedure VF_sub2V( Z, X, Y1, Y2:fVector; size:UInt );
DescriptionZi = Xi - Y1i - Y2i
Error handlingnone
Return valuenone
See alsoVF_subV,   VF_add2V

 

VF_subvectorVD_subvectorVE_subvector
VCF_subvectorVCD_subvectorVCE_subvector
VPF_subvectorVPD_subvectorVPE_subvector
VI_subvectorVBI_subvectorVSI_subvector
VLI_subvectorVQI_subvector
VU_subvectorVUB_subvectorVUS_subvector
VUL_subvectorVUI_subvector
FunctionExtract a sub-vector from the input vector
Syntax C/C++#include <VFstd.h>
void VF_subvector( fVector Y, ui subsize, fVector X, int samp );
C++ VecObj#include <OptiVec.h>
void vector<T>::subvector( const vector<T>& X, int samp, ui start=0 );
Pascal/Delphiuses VFstd;
procedure VF_subvector( Y:fVector; sizey:UInt; X:fVector; samp:Integer );
DescriptionYi = Xi*samp
A sub-vector Y is extracted from X with a sampling interval samp. This means that every samp'th element is taken, up to a total of subsize elements, starting with the zero'th element of X. Since X may be an expression like XX+1000 (C/C++) or VF_Pelement( XX, 1000 ) (Pascal/Delphi), samp does not always need to be positive, but may also take on negative values (or the trivial value of 0). X and Y have to be distinct. Instead of using a samp of 0, 1, or -1, one should use VF_equC,   VF_equV, or VF_rev, respectively.
The VecObj version is called with an additional argument start, denoting the element of X to start with. This is necessary to avoid input expressions like XX+1000, which are possible only with pointers, but would be mis-interpreted as the operator + in the class-based object-oriented interface.
Error handlingnone
Return valuenone
See alsoVF_indpick,   VF_CtoRe

 

VF_subvector_...VD_subvector_...VE_subvector_...
VCF_subvector_...VCD_subvector_...VCE_subvector_...
VPF_subvector_...VPD_subvector_...VPE_subvector_...
 ..._addC..._addV
 ..._divC..._divV
 ..._divrC..._divrV
 ..._mulC..._mulV
 ..._subC..._subV
 ..._subrC..._subrV
FunctionArithmetic functions working on a sub-set of elements within a vector of one of the floating-point data types.
Syntax C/C++#include <VFmath.h>
void VF_subvector_addC( fVector Y, ui subsize, unsigned samp, float C );
void VF_subvector_addV( fVector Y, ui subsize, unsigned samp, fVector X );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::subvector_addC( unsigned samp, const T& C );
void vector<T>::subvector_addV( unsigned samp, const vector<T>& X );
Pascal/Delphiuses VFmath;
procedure VF_subvector_addC( Y:fVector; subsiz:UInt; samp:UInt; C:Single );
procedure VF_subvector_addV( Y:fVector; subsiz:UInt; samp:UInt; X:fVector );

    (similarly all other functions of this family)
Description
..._addC:Yi*samp += C,i=0,...subsize-1
..._addV:Yi*samp += Xi,i=0,...subsize-1
..._subC:Yi*samp -= C,i=0,...subsize-1
..._subV:Yi*samp -= Xi,i=0,...subsize-1
..._subrC:Yi*samp = C - Yi*samp,i=0,...subsize-1
..._subrV:  Yi*samp = Xi- Yi*samp,  i=0,...subsize-1
..._mulC:Yi*samp *= C,i=0,...subsize-1
..._mulV:Yi*samp *= Xi,i=0,...subsize-1
..._divC:Yi*samp /= C,i=0,...subsize-1
..._divV:Yi*samp /= Xi,i=0,...subsize-1
..._divrC:Yi*samp = C / Yi*samp,i=0,...subsize-1
..._divrV:Yi*samp = Xi / Yi*samp,i=0,...subsize-1
 
Polar complex versions:
only multiplication and division are present: ...mulC,  ...mulV,  ...divC,  ...divV,  ...divrC, and ...divrV.

The operation indicated in the suffix of the function name is perfomed on a sub-set of the elements of a vector. The sampling interval is denoted by samp: every samp'th element is taken, up to a total of subsize, starting with the zero'th one (that means, subsize is not the total size of the vector, but rather the size of the sub-set, i.e. the number of elements for which the function is performed). Note that all operations are performed in place, i.e., the input vector itself is changed.
For similar functions not included in the above list, the necessary sequence of calls is similar to the following example (which shows how to calculate the sinc function of the zero'th and then every tenth element of X, assuming that size is an integer multiple of 10):
VF_subvector( Y, size/10, 10, X );
VF_sinc( Y, Y, size/10 );
VF_subvector_equV( X, size/10, 10, Y );

(However, in such cases, you would sometimes prefer the classic style of a loop with the loop-increment set to 10. Only if the desired function is not available in the math library of your compiler, the effort of copying back and forth into the dummy vector Y will pay off.)

Error handlingnone
Return valuenone
See alsoVF_subvector,   VF_subvector_equC,   VF_subvector_equV,   VF_addC

 

VF_subvector_...VD_subvector_...VE_subvector_...
VCF_subvector_...VCD_subvector_...VCE_subvector_...
VPF_subvector_...VPD_subvector_...VPE_subvector_...
VI_subvector_...VBI_subvector_...VSI_subvector_...
VLI_subvector_...VQI_subvector_...
VU_subvector_...VUB_subvector_...VUS_subvector_...
VUL_subvector_...VUI_subvector_...
 ..._equC..._equV
FunctionInitialize a sub-set of elements within a vector either with a constant value or with values stored as the elements of another vector.
Syntax C/C++#include <VFstd.h>
void VF_subvector_equC( fVector Y, ui subsize, unsigned samp, float C );
void VF_subvector_equV( fVector Y, ui subsize, unsigned samp, fVector X );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::subvector_equC( unsigned samp, const T& C );
void vector<T>::subvector_equV( unsigned samp, const vector<T>& X );
Pascal/Delphiuses VFstd;
procedure VF_subvector_equC( Y:fVector; subsz:UInt; samp:UInt; C:Single );
procedure VF_subvector_equV( Y:fVector; subsz:UInt; samp:UInt; X:fVector );

    (similarly all other functions of this family)
Description
..._equC:  Yi*samp = C,i=0,...subsize-1
..._equV:Yi*samp = Xi,  i=0,...subsize-1
 
A sub-set of the elements of a vector is overwritten according to the sampling interval samp: every samp'th element is initialized either with the constant C, or with the value specified as an element of the vector X. A total of subsize elements is initialized, starting with the zeroth one (that means, subsize is not the total size of the vector, but rather the size of the sub-set). VF_subvector_equV is the exact reverse of VF_subvector.
Error handlingnone
Return valuenone
See alsoVF_subvector,   VF_equC,   VF_equV,   VF_subvector_addC

 

VF_sumVD_sumVE_sum
VCF_sumVCD_sumVCE_sum
VI_sumVBI_sumVSI_sumVLI_sumVQI_sum
VU_sumVUB_sumVUS_sumVUL_sumVUI_sum
FunctionSum up all the elements of a vector.
Syntax C/C++#include <VFstd.h>
float VF_sum( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::sum();
Pascal/Delphiuses VFstd;
function VF_sum( X:fVector; size:UInt ): Single;
procedure VCF_sum( var Sum:fComplex; X:cfVector; size:UInt);
Descriptionsum = sum( Xi )
The sum over all elements of a vector is calculated.
Error handlingnone (but be careful: this function may easily overflow!)
Return valuesum of the vector elements (except complex versions in Pascal/Delphi).
See alsoVF_runsum,   VI_fsum,   VF_prod,   VF_ssq,   VF_ssqdevC,   VF_mean

 

VF_sumabsVD_sumabsVE_sumabs
FunctionSum up the absolute values of all the elements of a vector.
Syntax C/C++#include <VFstd.h>
float VF_sumabs( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::sumabs();
Pascal/Delphiuses VFstd;
function VF_sumabs( X:fVector; size:UInt ): Single;
Descriptionsumabs = sum(| Xi |)
Error handlingnone (but be careful: this function may easily overflow!)
Return valuesum of the absolute values of all vector elements.
See alsoVF_sum,   VF_meanabs

 

VF_sumdevCVD_sumdevCVE_sumdevC
FunctionSum of the absolute deviations from a preset value.
Syntax C/C++#include <VFstd.h>
float VF_sumdevC( fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
T vector<T>::sumdevC( const T& C );
Pascal/Delphiuses VFstd;
function VF_sumdevC( X:fVector; size:UInt; C:Single ): Single;
DescriptionsumdevC = sum( |Xi - C| )
Error handlingnone
Return valuesum of the absolute deviations.
See alsoVF_ssqdevC,   VF_sumdevV,   VF_avdevC

 

VF_sumdevVVD_sumdevVVE_sumdevV
FunctionSum of the absolute deviations of the elements of one vector from the corresponding elements of another
Syntax C/C++#include <VFstd.h>
float VF_sumdevV( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::sumdevV( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_sumdevV( X, Y:fVector; size:UInt ): Single;
DescriptionsumdevV = sum( |Xi - Yi| )
Error handlingnone
Return valuesum of the absolute deviations.
See alsoVF_sum,   VF_sumdevC,   VF_avdevV,   VF_ssqdevV

 

VF_tanVD_tanVE_tan
VCF_tanVCD_tanVCE_tan
VFx_tanVDx_tanVEx_tan
VCFx_tanVCDx_tanVCEx_tan
FunctionTangent function
Syntax C/C++#include <VFmath.h>
int VF_tan( fVector Y, fVector X, ui size );
int VFx_tan( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::tan( const vector<T>& X );
int vector<T>::x_tan( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_tan( Y, X:fVector; size:UInt ): IntBool;
function VFx_tan( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = tan ( Xi )
expanded versions: Yi = C * tan( A*Xi+B )
For large values of Xi, round-off error becomes appreciable; if the Xi values are representable as rational multiples of p, it is better to use VF_tanrpi than VF_tan.
Error handlingSING and OVERFLOW errors (for arguments very close to p/2) lead to a default result of ±HUGE_VAL. Precision errors lead to a default result of 0.0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_tan2,   VF_tanrpi,   VF_sin,   VF_tanh,   VF_atan,   VF_atan2,   tan

 

VF_tan2VD_tan2VE_tan2
VFx_tan2VDx_tan2VEx_tan2
FunctionSquare of the tangent function
Syntax C/C++#include <VFmath.h>
int VF_tan2( fVector Y, fVector X, ui size );
int VFx_tan2( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::tan2( const vector<T>& X );
int vector<T>::x_tan2( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_tan2( Y, X:fVector; size:UInt ): IntBool;
function VFx_tan2( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions: Yi = tan2( Xi )
expanded versions: Yi = C * tan2( A*Xi+B )
Calculating the squared trigonometric functions directly is faster and sometimes more accurate than first calculating the trigonometric function itself and squaring it afterwards.
Error handlingSING and OVERFLOW errors (for arguments close to p/2) lead to a default result of ±HUGE_VAL. Precision errors lead to a default result of 0.0.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_tan,   VF_tanrpi

 

VF_tanhVD_tanhVE_tanh
VCF_tanhVCD_tanhVCE_tanh
VFx_tanhVDx_tanhVEx_tanh
VCFx_tanhVCDx_tanhVCEx_tanh
FunctionHyperbolic tangent function
Syntax C/C++#include <VFmath.h>
int VF_tanh( fVector Y, fVector X, ui size );
int VFx_tanh( fVector Y, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::tanh( const vector<T>& X );
int vector<T>::x_tanh( const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_tanh( Y, X:fVector; size:UInt ): IntBool;
function VFx_tanh( Y, X:fVector; size:UInt; A, B, C:Single ): IntBool;
Descriptionnormal versions:
Yi =  tanh( Xi )
     =  exp( Xi ) - exp( -Xi )
exp( Xi ) + exp( -Xi )
 
expanded versions:
Yi = C * tanh( A*Xi+B )
Error handlingThese functions should be error-proof.
Return valuealways FALSE (0).
See alsoVF_sinh,   VF_exp,   tanh

 

VF_tanrpiVD_tanrpiVE_tanrpi
VF_tanrpi2VD_tanrpi2VE_tanrpi2
VF_tanrpi3VD_tanrpi3VE_tanrpi3
FunctionTangent function of fractional multiples of p
Syntax C/C++#include <VFmath.h>
int VF_tanrpi( fVector Y, iVector P, ui size, int q );
int VF_tanrpi2( fVector Y, iVector P, ui size, int q );
int VF_tanrpi3( fVector Y, iVector P, ui size, int q );
C++ VecObj#include <OptiVec.h>
int vector<T>::tanrpi( const vector<int>& P, int q );
int vector<T>::tanrpi2( const vector<int>& P, int q );
int vector<T>::tanrpi3( const vector<int>& P, int q );
Pascal/Delphiuses VFmath;
function VF_tanrpi( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_tanrpi2( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
function VF_tanrpi3( Y:fVector; P:iVector; size:UInt; q:Integer ): IntBool;
DescriptionYi = tan( (Pi / q) * p )
The tangent of fractional multiples of p is calculated. There are three versions: VF_tanrpi is for general use with any arbitrary denominator q. If q is a power of 2, VF_tanrpi2 should be used which is a highly optimized version using a look-up table. If q is a multiple of 3, VF_tanrpi3 should be used. VF_tanrpi2 and VF_tanrpi3 work also with q values they are not optimized for; in this case, however, memory space is wasted for the then useless tables.
Error handlingSING errors occur if Pi / q is an odd multiple of 1/2; the default result is 0.0 (which is the mean of +HUGE_VAL and -HUGE_VAL).
q must be non-zero; this is, however, not tested for.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_tan,   tan

 

VF_tantab2VD_tantab2VE_tantab2
VF_tantab3VD_tantab3VE_tantab3
 Table of tangent values for arguments between 0 and p/2.
Syntax C/C++#include <xmath.h>
extern float    VF_tantab2[ VF_tabsz2+1 ];
extern double   VD_tantab2[ VD_tabsz2+1 ];
extern extended VE_tantab2[ VE_tabsz2+1 ];
extern float    VF_tantab3[ VF_tabsz3+1 ];
extern double   VD_tantab3[ VD_tabsz3+1 ];
extern extended VE_tantab3[ VE_tabsz3+1 ];
Pascal/Delphiuses FTANTAB2, DTANTAB2, ETANTAB2, FTANTAB3, DTANTAB3, ETANTAB3;
VF_tantab2: array[0..VF_tabsz2] of Single;
VD_tantab2: array[0..VD_tabsz2] of Double;
VE_tantab2: array[0..VE_tabsz2] of Extended;
VF_tantab3: array[0..VF_tabsz3] of Single;
VD_tantab3: array[0..VD_tabsz3] of Double;
VE_tantab3: array[0..VE_tabsz3] of Extended;
DescriptionVF_tantab2[ i ] = tan( i/(2*VF_tabsz2) * p ),    i=0,...,VF_tabsz2-1
VF_tantab3[ i ] = tan( i/(2*VF_tabsz3) * p ),    i=0,...,VF_tabsz3-1
VF_tantab2[ VF_tabsz2 ] = VF_tantab3[ VF_tabsz3 ] = 0;

These look-up tables of tangent values for arguments between 0 and p/2 are used by VF_tanrpi2 and the other functions of that family and are also available for other purposes. Since the tangent of p/2 is not defined, zero is stored at its place.
C/C++: The symbols VF_tabsz2 etc., denoting the size of the tables, are defined in <xmath.h>.
Pascal/Delphi: The symbols VF_tabsz2 etc. are defined in the same units as the tables themselves.

See alsoVF_tanrpi2,   VF_sintab2,   VF_cosectab2

 

VF_truncVD_truncVE_trunc
VF_trunctoIVD_trunctoIVE_trunctoI
VF_trunctoBIVD_trunctoBIVE_trunctoBI
VF_trunctoSIVD_trunctoSIVE_trunctoSI
VF_trunctoLIVD_trunctoLIVE_trunctoLI
VF_trunctoQIVD_trunctoQIVE_trunctoQI
VF_trunctoUVD_trunctoUVE_trunctoU
VF_trunctoUBVD_trunctoUBVE_trunctoUB
VF_trunctoUSVD_trunctoUSVE_trunctoUS
VF_trunctoULVD_trunctoULVE_trunctoUL
VF_trunctoUIVD_trunctoUIVE_trunctoUI
FunctionRounding by "truncating" toward zero.
Syntax C/C++#include <VFmath.h>
int VF_trunc( fVector Y, fVector X, ui size );
int VF_trunctoI( iVector Y, fVector X, ui size );
int VF_trunctoU( uVector Y, fVector X, ui size );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
int vector<T>::trunc( const vector<T>& X );
int vector<int>::trunctoI( const vector<T>& X );
int vector<unsigned>::trunctoU( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_trunc( Y, X:fVector; size:UInt ):IntBool;
function VF_trunctoI( Y:iVector; X:fVector; size:UInt ):IntBool;
function VF_trunctoLI( Y:liVector; X:fVector; size:UInt ):IntBool;

    (similarly all other functions of this family)
DescriptionThese functions are identical to those of the VF_chop family. They have been defined in order to maintain consistency with the Pascal/Delphi function trunc. For details, see VF_chop.

 

V_UtoFV_UtoDV_UtoE
V_UBtoFV_UBtoDV_UBtoE
V_UStoFV_UStoDV_UStoE
V_ULtoFV_ULtoDV_ULtoE
V_UItoFV_UItoDV_UItoE
FunctionData type interconversions. See V_ItoF!

 

VF_varianceCVD_varianceCVE_varianceC
FunctionVariance of a one-dimensional distribution with respect to a pre-set value
Syntax C/C++#include <VFstd.h>
float VF_varianceC( fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
T vector<T>::varianceC( const T& C );
Pascal/Delphiuses VFstd;
function VF_varianceC( X:fVector; size:UInt; C:Single ): Single;
Descriptionvar = (1 / size) * sum( (Xi - C)2 )
Error handlingnone
Return valueThe variance is returned.
See alsoVF_mean,   VF_varianceV,   VF_ssq,   VF_ssqdevC,   VF_linregress

 

VF_varianceCwWVD_varianceCwWVE_varianceCwW
Function"Variance with weights" of a one-dimensional distribution with respect to a pre-set value.
Syntax C/C++#include <VFstd.h>
float VF_varianceCwW( fVector X, fVector Wt, ui size, float C );
C++ VecObj#include <OptiVec.h>
T vector<T>::varianceCwW( const vector<T>& Wt, const T& C );
Pascal/Delphiuses VFstd;
function VF_varianceCwW( X, Wt:fVector; size:UInt; C:Single ): Single;
Descriptionvar = (1 / sum( Wti )) * sum( Wti * (Xi - C)2 )
The weights need not be normalized.
Error handlingnone
Return valuevariance of the distribution.
See alsoVF_meanwW,   VF_varianceC,   VF_varianceVwW,   VF_linregress

 

VF_varianceVVD_varianceVVE_varianceV
FunctionVariance between two one-dimensional distributions.
Syntax C/C++#include <VFstd.h>
float VF_varianceV( fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::varianceV( const vector<T>& Y );
Pascal/Delphiuses VFstd;
function VF_varianceV( X, Y:fVector; size:UInt ): Single;
Descriptionvar = (1 / size) * sum( (Xi - Yi)2 )
Error handlingnone
Return valueThe variance is returned.
See alsoVF_mean,   VF_varianceC,   VF_ssq,   VF_ssqdevV,   VF_linregress

 

VF_varianceVwWVD_varianceVwWVE_varianceVwW
Function"Variance with weights" between two one-dimensional distributions.
Syntax C/C++#include <VFstd.h>
float VF_varianceVwW( fVector X, fVector Y, fVector Wt, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::varianceVwW( const vector<T>& Y, const vector<T>& Wt );
Pascal/Delphiuses VFstd;
function VF_varianceVwW( X, Y, Wt:fVector; size:UInt ):
Descriptionvar = (1 / sum(Wti)) * sum( Wti * (Xi - Yi)2 )
The weights need not be normalized.
Error handlingnone
Return valueweighted variance
See alsoVF_meanwW,   VF_chi2,   VF_varianceV,   VF_varianceCwW,   VF_linregress

 

VF_vectorVD_vectorVE_vector
VCF_vectorVCD_vectorVCE_vector
VPF_vectorVPD_vectorVPE_vector
VI_vectorVBI_vectorVSI_vectorVLI_vectorVQI_vector
VU_vectorVUB_vectorVUS_vectorVUL_vectorVUI_vector
FunctionMemory allocation for a vector
Syntax C/C++#include <VFstd.h>
fVector VF_vector( ui size );
Pascal/Delphiuses VecLib;
function VF_vector( size:UInt ): fVector;
DescriptionBased on memory model and environment, the most appropriate allocation procedure is chosen by these functions. Failure to allocate memory always leads to an error message and a subsequent program abort (similar to the error handling of the "new" operator). To release the memory thus allocated, V_free,   V_freeAll, or V_nfree should be used (the latter only in C/C++).
Note: the declaration of a vector (e.g., as fVector) reserves only a name, but no memory!
See chapter 4.1 if you are interested in details of the implementation.
Do not use this function in connection with the object-oriented interface VecObj. It has its own automated memory allocation procedure incorporated into the constructors, see chapter 3.
Error handlingIf there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted.
16-bit models (except HUGE):
If more than 64 kB of memory are requested, an error message "Vector > 64 kB not possible" is displayed and the program aborted.
32-bit:
If more than 4 GB of memory are requested, an error message "Vector > 4 GB not possible" is displayed and the program aborted.
Return valuePointer to the allocated memory
See alsomalloc,   calloc

 

VF_vector0VD_vector0VE_vector0
VCF_vector0VCD_vector0VCE_vector0
VPF_vector0VPD_vector0VPE_vector0
VI_vector0VBI_vector0VSI_vector0VLI_vector0VQI_vector0
VU_vector0VUB_vector0VUS_vector0VUL_vector0VUI_vector0
FunctionMemory allocation for a vector and initialization of all elements with 0
Syntax C/C++#include <VFstd.h>
fVector VF_vector0( ui size );
Pascal/Delphiuses VecLib;
function VF_vector0( size:UInt ): fVector;
DescriptionThe functions of this family are almost identical to those of the VF_vector family; in addition to allocating memory, they initialize all elements with 0. (Calls to VF_vector and VF_vector0 may be mixed; they use the same tables to keep track of the handles and pointers). For further information, see VF_vector.
Do not use this function in connection with the object-oriented interface. It has its own automated memory allocation procedure incorporated into the constructors, see chapter 3.
Error handlingIf there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted.
16-bit models (except HUGE):
If more than 64 kB of memory are requested, an error message "Vector > 64 kB not possible" is displayed and the program aborted.
32-bit:
If more than 4 GB of memory are requested, an error message "Vector > 4 GB not possible" is displayed and the program aborted.
Return valueA pointer to the allocated memory is returned.
See alsomalloc,   calloc

 

VF_visCVD_visCVE_visC
FunctionVisibility (or contrast) function of a vector with respect to a constant
Syntax C/C++#include <VFmath.h>
void VF_visC( fVector Y, fVector X, ui size, float C );
C++ VecObj#include <OptiVec.h>
void vector<T>::visC( const vector<T>& X, const T& C );
Pascal/Delphiuses VFmath;
procedure VF_visC( Y, X:fVector; size:UInt; C:Single );
DescriptionYi = vis( Xi, C ) = (Xi - C) / (Xi + C)
These functions are generalizations of the "visibility" or "contrast" function used in optics, where the contrast between two intensities is defined as their difference divided by their sum.
For Xi=C, the visibility is defined as 0, even in the case of Xi=C=0.
Error handlingnone
Return valuenone
See alsoVF_redV,   VF_addC,   VF_subC,   VF_divC,   VF_visV

 

VF_visVVD_visVVE_visV
VFx_visVVDx_visVVEx_visV
FunctionVisibility function of one vector with respect to another
Syntax C/C++#include <VFmath.h>
void VF_visV( fVector Z, fVector X, fVector Y, ui size );
void VFx_visV( fVector Z, fVector X, fVector Y, ui size, float A, float B );
C++ VecObj#include <OptiVec.h>
void vector<T>::visV( const vector<T>& X, const vector<T>& Y );
void vector<T>::x_visV( const vector<T>& X, const vector<T>& Y, const T& A, const T& B );
Pascal/Delphiuses VFmath;
procedure VF_visV( Z, X, Y:fVector; size:UInt );
procedure VFx_visV( Z, X, Y:fVector; size:UInt; A, B:Single );
Descriptionnormal versions:
Zi = vis( Xi, Yi )
    = (Xi - Yi) / (Xi + Yi)
expanded versions:
Zi = vis( A*Xi+B, Yi )
For Xi=Yi, the visibility is defined as 0, even in the case of Xi=Yi=0.
Error handlingnone
Return valuenone
See alsoVF_visC,   VF_addV,   VF_subV,   VF_divV,   VF_redV

 

VF_WelchVD_WelchVE_Welch
Function"Welch" window for use in spectral analysis
Syntax C/C++#include <VFstd.h>
void VF_Welch( fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::Welch();
Pascal/Delphiuses VFstd;
procedure VF_Welch( X:fVector; size:UInt );
DescriptionXi = 1 - ( (i - 0.5*(size - 1)) / (0.5*(size + 1)) )2
Error handlingnone
Return valuenone
See alsoVF_Parzen,   VF_Hanning,   VF_spectrum

 

VF_writeVD_writeVE_write
VCF_writeVCD_writeVCE_write
VPF_writeVPD_writeVPE_write
VI_writeVBI_writeVSI_writeVLI_writeVQI_write
VU_writeVUB_writeVUS_writeVUL_writeVUI_write
FunctionWrite a vector in ASCII format to a stream.
Syntax C/C++#include <VFstd.h>
void VF_write( FILE *stream, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::write( FILE *stream );
Pascal/Delphiuses VFstd;
procedure VF_write( var Stream:Text; X:fVector; size:UInt );
Descriptionsize elements of X are written to stream in ASCII format. By default, one element is written per line. To use these functions, stream must already be open for write operations in text format.

The number format and the separation of consecutive elements may be specified using VF_setWriteFormat (C/C++ only) and VF_setWriteSeparate, respectively. See these functions for details.

Storing data in ASCII format is useful if the data have to be readable by human eyes, or if they are to be exported into other programs which are not able to read machine-format numbers. If avoidable, these functions should not be used for the storage of intermediate results that later have again to be read in. Instead, the function pairs of the VF_store / VF_recall family are recommended for the following reasons: conversion into ASCII format is slow, may lead to round-off errors, and requires much more disk memory than storage in machine format.

Error handlingnone
Return valuenone
See alsoVF_setWriteFormat,   VF_setWriteSeparate,   VF_nwrite,   VF_read,   VF_store,   VF_cprint,   VF_print,   fprintf

 

VF_xcorrVD_xcorrVE_xcorr
FunctionCross-correlation function of two vectors.
Syntax C/C++#include <VFstd.h>
void VF_xcorr( fVector Z, fVector X, fVector Y, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::xcorr( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_xcorr( Z, X, Y:fVector; size:UInt );
DescriptionThe cross-correlation function (CCF) of X and Y is calculated and stored in Z in wrap-around order: Z0 to Zsize/2-1 contain the CCF for zero and positive lags. Beginning with the most negative lag in Zsize/2+1, the elements up to Zsize-1 contain the CCF for negative lags. Since this function assumes X to be periodic, the CCF for the most positive lag is identical to the CCF for the most negative lag. This element is stored as Zsize/2.
To get the CCF into normal order, you may call
VF_rotate( Z, Z, size, size/2 );
After that, the zero point is at the position size/2.

In case X is non-periodic, end effects should be avoided by the methods described in connection with VF_convolve.

About special versions with the prefixes VFp_,  VFs_ and VFl_, consult chapter 4.8.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_xcorr is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuenone
See alsoVF_FFT,   VF_convolve,   VF_autocorr,   VF_spectrum

 

VI_xorVBI_xorVSI_xorVLI_xorVQI_xor
VU_xorVUB_xorVUS_xorVUL_xorVUI_xor
FunctionBit-wise "XOR" operation.
Syntax C/C++#include <VImath.h>
void VI_xor( iVector Y, iVector X, ui size, int C );
void VUL_xor( ulVector Y, ulVector X, ui size, unsigned long C );
C++ VecObj#include <OptiVec.h>
void vector<T>::xor( const vector<T>& X, const T& C );
Pascal/Delphiuses VImath;
procedure VI_xor( Y, X:iVector; size:UInt; C:Integer );
procedure VUL_xor( Y, X:ulVector; size:UInt; C:ULong );
DescriptionYi = (Xi) ^ C
The bit-wise "exclusive OR" operation is performed on each element Xi with the bit-mask given by C (i.e., a bit is 0 in Yi, if it was either 0 or 1 both in Xi and C simultaneously. It is 1 if Xi and C differed in this bit position).
Error handlingnone
Return valuenone
See alsoVI_not,   VI_and,   VI_or

 

VF_xprodVD_xprodVE_xprod
FunctionCross-product of two vectors.
Syntax C/C++#include <VFstd.h>
void VF_xprod( fVector Z, fVector X, fVector Y );
C++ VecObj#include <OptiVec.h>
void vector<T>::xprod( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses VFstd;
procedure VF_xprod( Z, X, Y:fVector );
DescriptionZ = X x Y
The cross-product of X and Y is calculated. Since this operation is defined specifically for vectors representing three dimensions in the geometrical sense, there is no parameter "size" for this function. The number of elements is 3 for each of the participating vectors, implicitly.
Error handlingnone
Return valuenone
See alsoVF_scalprod,   VF_Euclid

 

VF_xyAutoPlotVD_xyAutoPlotVE_xyAutoPlot
VI_xyAutoPlotVBI_xyAutoPlotVSI_xyAutoPlot
VLI_xyAutoPlotVQI_xyAutoPlot
VU_xyAutoPlotVUB_xyAutoPlotVUS_xyAutoPlot
VUL_xyAutoPlotVUI_xyAutoPlot
FunctionDraws a Cartesian coordinate system and plots a Y-vector against an X-vector into it.
Syntax C/C++#include <Vgraph.h>
void VF_xyAutoPlot( fVector X, fVector Y, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<T>::xyAutoPlot( const vector<T>& X, unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VF_xyAutoPlot( X, Y:fVector; size:UInt; form:UInt; color:COLORREF );
DescriptionA Cartesian coordinate system is drawn with automatic scaling of the axes and the vector Y is plotted against the vector X. Prior to calling VF_xyAutoPlot, the plotting routines have to be initialized by V_initGraph (for DOS programs) or V_initPlot (DOS or Windows programs).
The VecObj version of this function has to be called as a member function of Y (rather than of X).

The font of the axis tick labels is the actual text font. In DOS programs (Borland C++ or Pascal), it may be changed by calling settextstyle before calling VF_xyAutoPlot. In Windows programs (both 16-bit and 32-bit), the font of the current device context is used.

The style of the plot is determined by the parameter "form" which should be constructed using the symbolic constants defined in <Vgraph.h> (C/C++) or in the unit Vgraph (Pascal/Delphi).
For the line styles, either Borland's BGI notation or the Windows notation may be used both in DOS and Windows programs; the necessary macros for the translation are included in <Vgraph.h> and in the unit Vgraph.

1. Style of lines connecting adjacent data points:
 
Windows styleBGI C/C++BGI Pascalappearance
PS_SOLIDSOLID_LINESolidLn–––– (default)
PS_DOTDOTTED_LINEDottedLn·········
PS_DASHDASHED_LINEDashedLn- - - -
PS_DASHDOTCENTER_LINECenterLn- · - · -
PS_DASHDOTDOT  - · · - · ·
PS_NULLNULL_LINENullLn(no line at all)

2. Symbols used to mark data points:
 
SY_NULL(no symbol at all)   (default)
SY_CROSS x
SY_PLUS+
SY_STAR*
SY_CIRCLEo
SY_BOX
SY_DIAMOND à
SY_TRIANGLEUP D
SY_TRIANGLEDOWN Ñ

3. Fill-style of the symbols:
 
SY_HOLLOWno filling  (default)
SY_FILLEDfilled
SY_DOTTEDhollow, with a dot at the exact position of the data point

The parameter form has to be constructed by adding the appropriate line style, the symbol and its fill-style, e.g. (SOLID_LINE + SY_TRIANGLEUP). Alternatively, the bit-wise "OR" operation may be used, e.g. (PS_SOLID | SY_CIRCLE | SY_DOTTED ).
In Pascal terms, these examples read:
(SolidLn + SY_TRIANGLEUP), and (PS_SOLID or SY_CIRCLE or SY_DOTTED).

If any of the line styles except NULL_LINE (or PS_NULL) is chosen, each data point will be represented by at least one pixel in DOS programs. Therefore, dotted or broken lines should be specified only if there are not too many data points. Otherwise, all line styles will eventually look like SOLID_LINE. In Windows programs, these line styles will always be plotted correctly and points will be left out if necessary.

Note that NULL_LINE or PS_NULL has to be explicitly specified, if the data points are not to be connected by lines. Just writing, e.g. (SY_BOX | SY_HOLLOW) would be interpreted as using the default line style, which is SOLID_LINE.

SY_NULL and SY_HOLLOW need not be specified, since these are the default symbol and fill-style, resp. For SY_NULL, SY_CROSS, SY_PLUS, and SY_STAR, the choice of fill-style has no effect.

The parameter "color" denotes the color that is to be used for the plot (the data type COLORREF is unsigned for DOS programs and unsigned long for Windows programs). See the Borland C++ or TurboPascal function setcolor for a description of the colors available in the various graphics modes under DOS. For Windows, the colors BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, and WHITE are defined in <Vgraph.h> (or the unit Vgraph) by analogy with the COLORS defined in <graphics.h> (or the unit Graph) for the BGI routines, i.e. for DOS programs. Thereby, portability between DOS and Windows programs is improved. For programs designed to run exclusively under Windows, it is nevertheless recommended to use fine-tuned colors defined by the RGB macro, instead of the predefined colors.

The size of the symbols may be modified with the function V_setSymbolSize. The thickness of the lines may be modified using V_setLineThickness.

Example of a C/C++ DOS program #include <VFstd.h>
#include <VFmath.h>
#include <Vgraph.h>
#include <conio.h>
void main( void )
{
     ui size=101;
     fVector X, Y1, Y2;
     V_initGraph( "C:\\BorlandC\\BGI\\" );
            /* Be sure the path is correct! */
     X = VF_vector( size );
     Y1 = VF_vector( size );
     Y2 = VF_vector( size );
     VF_ramp( X, size, -1.0, 2.0/100 );
     VFx_sincos( Y1, Y2, X, size, 3.1415927, 0.0, 1.0 );
     VF_xyAutoPlot( X, Y1, size,
                    PS_SOLID | SY_CROSS,
                    LIGHTGREEN );
     VF_xyDataPlot( X, Y2, size,
                    PS_SOLID | SY_CIRCLE | SY_DOTTED,
                    LIGHTRED );
     getch(); /* interrupt execution while watching;
                      then press any key */
     closegraph();
     V_nfree( 3, Y2, Y1, X );
}

For a Pascal demo program, see VDEMO.PAS.
Under Windows, call V_initPlot instead of V_initGraph, before performing plotting operations.

Error handlingnone
Return valuenone
See alsoVF_xyDataPlot,   VF_yAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes,   V_setSymbolSize,  chapter 4.12

 

VF_xy2AutoPlotVD_xy2AutoPlotVE_xy2AutoPlot
VI_xy2AutoPlotVBI_xy2AutoPlotVSI_xy2AutoPlot
VLI_xy2AutoPlotVQI_xy2AutoPlot
VU_xy2AutoPlotVUB_xy2AutoPlotVUS_xy2AutoPlot
VUL_xy2AutoPlotVUI_xy2AutoPlot
FunctionDraws a Cartesian coordinate system and plots two X-Y vector pairs into it.
Syntax C/C++#include <Vgraph.h>
void VF_xy2AutoPlot( fVector X1, fVector Y1, ui size1, unsigned form1, COLORREF color1, fVector X2, fVector Y2, ui size2, unsigned form2, COLORREF color2 );
C++ VecObj#include <OptiVec.h>
void vector<T>::xy2AutoPlot( const vector<T>& X1, unsigned form1, COLORREF color1, const vector<T>& X2, const vector<T>& Y2, unsigned form2, COLORREF color2 );
Pascal/Delphiuses Vgraph;
procedure VF_xy2AutoPlot( X1, Y1:fVector; size1:UInt; form1:UInt; color1:COLORREF; X2, Y2:fVector; size2:UInt; form2:UInt; color2:COLORREF );
DescriptionThe vector Y1 is plotted against the vector X1 and Y2 against X2 after automatically drawing a Cartesian coordinate system. For a description of the parameters form1, form2, and color1, color2, see VF_xyAutoPlot. Prior to calling VF_xy2AutoPlot, the plotting routines have to be initialized by V_initGraph or V_initPlot.
The VecObj version of this function has to be called as a member function of Y1 (rather than of X1).
Error handlingnone
Return valuenone
See alsoVF_xyAutoPlot,   VF_yAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes

 

VF_xyDataPlotVD_xyDataPlotVE_xyDataPlot
VI_xyDataPlotVBI_xyDataPlotVSI_xyDataPlot
VLI_xyDataPlotVQI_xyDataPlot
VU_xyDataPlotVUB_xyDataPlotVUS_xyDataPlot
VUL_xyDataPlotVUI_xyDataPlot
FunctionX-Y-plot into an existing Cartesian coordinate system.
Syntax C/C++#include <Vgraph.h>
void VF_xyDataPlot( fVector X, fVector Y, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<T>::xyDataPlot( const vector<T>& X, unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VF_xyDataPlot( X, Y:fVector; size:UInt; form:UInt; color:COLORREF );
DescriptionThe vector Y is plotted against the vector X into a Cartesian coordinate system drawn by a prior call to one of the AutoPlot functions or to V_drawAxes. For a description of the parameters form and color, see VF_xyAutoPlot.
The VecObj version of this function has to be called as a member function of Y (rather than of X).
Error handlingnone
Return valuenone
See alsoVF_xyAutoPlot,   VF_yAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes

 

VF_yAutoPlotVD_yAutoPlotVE_yAutoPlot
VI_yAutoPlotVBI_yAutoPlotVSI_yAutoPlot
VLI_yAutoPlotVQI_yAutoPlot
VU_yAutoPlotVUB_yAutoPlotVUS_yAutoPlot
VUL_yAutoPlotVUI_yAutoPlot
FunctionDraws a Cartesian coordinate system and plots each element of a Y-vector against its index.
Syntax C/C++#include <Vgraph.h>.
void VF_yAutoPlot( fVector Y, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<T>::yAutoPlot( unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VF_yAutoPlot( Y:fVector; size:UInt; form:UInt; color:COLORREF );
DescriptionA Cartesian coordinate system is automatically scaled and drawn. Each element of the vector Y is plotted against its index into this coordinate system. For a description of the parameters form and color, see VF_xyAutoPlot. The plotting routines have to be initialized by V_initGraph or V_initPlot prior to calling VF_yAutoPlot.
Error handlingnone
Return valuenone
See alsoVF_yDataPlot,   VF_y2AutoPlot,   VF_xyAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes,  chapter 4.12

 

VF_y2AutoPlotVD_y2AutoPlotVE_y2AutoPlot
VI_y2AutoPlotVBI_y2AutoPlotVSI_y2AutoPlot
VLI_y2AutoPlotVQI_y2AutoPlot
VU_y2AutoPlotVUB_y2AutoPlotVUS_y2AutoPlot
VUL_y2AutoPlotVUI_y2AutoPlot
FunctionDraws a Cartesian coordinate system and plots two Y-vectors, taking the index as the X-axis.
Syntax C/C++#include <Vgraph.h>
void VF_y2AutoPlot( fVector Y1, ui size1, unsigned form1, COLORREF color1, fVector Y2, ui size2, unsigned form2, COLORREF color2 );
C++ VecObj#include <OptiVec.h>
void vector<T>::y2AutoPlot( unsigned form1, COLORREF color1, const vector<T>& Y2, unsigned form2, COLORREF color2 );
Pascal/Delphiuses Vgraph;
procedure VF_y2AutoPlot( Y1:fVector; size1:UInt; form1:UInt; color1:COLORREF; Y2:fVector; size2:UInt; form2:UInt; color2:COLORREF );
DescriptionA Cartesian coordinate system is automatically scaled and drawn. Each element of the vectors Y1 and Y2 is plotted at the X-position given by its index. For a description of the parameters form1, form2, and color1, color2, see VF_xyAutoPlot. The plotting routines have to be initialized by V_initGraph or V_initPlot prior to calling VF_yAutoPlot.
The VecObj version of this function has to be called as a member function of Y1.
Error handlingnone
Return valuenone
See alsoVF_yDataPlot,   VF_y2AutoPlot,   VF_xyAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes,  chapter 4.12

 

VF_yDataPlotVD_yDataPlotVE_yDataPlot
VI_yDataPlotVBI_yDataPlotVSI_yDataPlot
VLI_yDataPlotVQI_yDataPlot
VU_yDataPlotVUB_yDataPlotVUS_yDataPlot
VUL_yDataPlotVUI_yDataPlot
FunctionPlots a Y-vector into an existing Cartesian coordinate system, taking the index as the X-axis.
Syntax C/C++#include <Vgraph.h>
void VF_yDataPlot( fVector Y, ui size, unsigned form, COLORREF color );
C++ VecObj#include <OptiVec.h>
void vector<T>::yDataPlot( unsigned form, COLORREF color );
Pascal/Delphiuses Vgraph;
procedure VF_yDataPlot( Y:fVector; size:UInt; form:UInt; color:COLORREF );
DescriptionEach element of the vector Y is plotted into a Cartesian coordinate system that has to be already drawn by a prior call to one of the DataPlot functions or to V_drawAxes. The X-position is given by the index of the Y-element to be plotted. For a description of the parameters form and color, see VF_xyAutoPlot.
Error handlingnone
Return valuenone
See alsoVF_yAutoPlot,   VF_y2AutoPlot,   VF_xyAutoPlot,   VCF_autoPlot,   V_drawAxes,   V_findAxes,  chapter 4.12
 


9. Scalar (non-vectorized) Functions

There are a few non-vectorized functions, stemming from CMATH and XMATH, which are necessary to use VectorLib. They are described here:

 

fcplxdcplxecplx
FunctionInitialization of cartesian-complex numbers
Syntax C/C++#include <VecLib.h>
fComplex fcplx( float ReVal, float ImVal );

    (similarly dcplx,   ecplx)
Pascal/Delphiuses VecLib;
procedure fcplx( var zy:fComplex; xRe, xIm: Single );

    (similarly dcplx,   ecplx)
DescriptionThese functions allow to generate complex numbers of the three cartesian data types fComplex, dComplex, and eComplex. CMATH offers overloaded versions of these functions for C++. See CMATH.HTM, chapter 2.1 for details.
In C/C++, fcplx should be used whenever temporary complex variables are needed as arguments for functions. In this case, fcplx replaces the less elegant direct assignment of the real and imaginary parts, e.g.:
  z.Re = 3.0; z.Im = 4.0;
  VCF_equC( X, size, z ); /* less convenient */
  VCF_equC( Y, size, fcplx( 3.0, 4.0 )); /* easier */

In Pascal/Delphi, writing
  fcplx( z, 3.0, 4.0 );
is just equivalent to
  z.Re = 3.0; z.Im = 4.0;
Error handlingnone
Return valuethe generated complex number (C/C++)
See alsofpolr

 

isintisintlisintd
Functiontests if a number is a whole number
Syntax C/C++#include <xmath.h>
int isint( double x );
int isintl( long double x );
Pascal/Delphiuses xmath;
function isint( x:Extended ): IntBool;
function isintd( x:Double ): IntBool;
DescriptionReturns TRUE (a value different from 0), if x is an integer number. FALSE (0) is returned, if x contains a non-zero fractional part.
Error handlingnone
Return valuesee above

 

isipow2sisipow2lisipow2
Functiontests if an unsigned integer is an integer power of 2
Syntax C/C++#include <xmath.h>
int isipow2( unsigned x );
int sisipow2( unsigned short x );
int lisipow2( unsigned long x );
Pascal/Delphiuses xmath;
function isipow2( x:UInt ): IntBool;
function sisipow2( x:USmall ): IntBool;
function lisipow2( x:ULong ): IntBool;
DescriptionReturns TRUE (non-zero), if x is an integer power of 2:
x = 2n,   n=1,2,3,...
Otherwise, FALSE (0) is returned.
Error handlingnone
Return valuesee above

 

loglogd
FunctionNatural logarithm: Pascal/Delphi only!
Syntaxuses xmath;
function log( x:Extended x ): Extended;
function logd( x:double x ): Double;
DescriptionThe logarithm of the argument to the basis e is calculated and the result returned. The "extended" version of this function is almost identical to the built-in Pascal function Ln. Only the error handling occurs via the same handler as for the other OptiVec functions, rather than via the built-in handler of Pascal. The "double"-version, logd, is slightly faster.
Error handlingA DOMAIN error with NAN ("not-a-number") as return value results from x < 0 (including -0). A SING error with -HUGE_VAL as return value results from x=0.
Return valueThe natural logarithm of the argument is returned.
See alsolog2,   log2d,   log10,   log10d,   VF_log

 

log2log2llog2d
FunctionBinary logarithm
Syntax C/C++#include <xmath.h>
double       log2( double x );
long double  log2l( long double x );
Pascal/Delphiuses xmath;
function log2( x:Extended ): Extended;
function log2d( x:Double ): Double;
DescriptionThe logarithm of the argument to the basis 2 is calculated and the result returned.
Error handlingA DOMAIN error with NAN ("not-a-number") as return value results from x < 0 (including -0). A SING error with -HUGE_VAL as return value results from x=0.
In C/C++, the handling of both errors can be modified via _matherr or _matherrl, resp.
Return valueThe binary logarithm of the argument is returned.
See alsolog,   log10,   VF_log2

 

log10log10d
FunctionDecadic logarithm: Pascal/Delphi only!
Syntaxuses xmath;
function log10( x:Extended x ): Extended;
function log10d( x:double x ): Double;
DescriptionThe logarithm of the argument to the basis 10 is calculated and the result returned.
Error handlingA DOMAIN error with NAN ("not-a-number") as return value results from x < 0 (including -0). A SING error with -HUGE_VAL as return value results from x=0.
Return valueThe decadic logarithm of the argument is returned.
See alsolog,   logd,   log2,   log2d,   VF_log10

 

fpolrdpolrepolr
FunctionInitialization of polar-complex numbers
Syntax C/C++#include <VecLib.h>
fPolar fpolr( float MagVal, float ArgVal );

    (similarly dpolr,   epolr)
Pascal/Delphiuses VecLib;
procedure fpolr( var py:fPolar; xMag, xArg: Single );

    (similarly dpolr,   epolr)
DescriptionThese functions allow to generate numbers of the three polar-complex data types fPolar, dPolar, and ePolar. CMATH offers overloaded versions of these functions for C++. See CMATH.HTM, chapter 2.1 for details.
In C/C++, fpolr should be used whenever temporary complex variables are needed as arguments for functions. In this case, fpolr replaces the less elegant direct assignment of the Mag and Arg parts, e.g.:
  p.Mag = 3.0; p.Arg = 1.5708;
  VPF_equC( X, size, p ); /* less convenient */
  VPF_equC( Y, size, fpolr( 3.0, 1.5708 )); /* easier */

In Pascal/Delphi, writing
  fpolr( p, 3.0, 1.5708 );
is just equivalent to
  p.Mag = 3.0; p.Arg = 1.5708;
Error handlingnone
Return valuethe generated polar-complex number (C/C++)
See alsofcplx

 

quadtod_quadtold
Functionconvert a quad into a double or long double: C/C++ only!
Syntax C/C++#include <VecLib.h>
double       quadtod( quad x );
long double _quadtold( quad x );
DescriptionThese functions, along with their counterpart, setquad, provide the necessary interface for the use of the data type quad with Borland C++ (where OptiVec still maintains compatibility with earlier versions that had no complete built-in support for 64-bit integers). If, e.g., the value of a quad (say, of x) has to be printed, this must be done by a function call like
printf( "% 20.0Lf", _quadtold( x ));
Error handlingnone
Return valuethe value of x is returned as a double or long double.

 

setquad
Functionconverts a long double into a quad: C/C++ only!
Syntax C/C++#include <VecLib.h>
quad setquad( long double x );
DescriptionThis function, along with its counterparts, quadtod and _quadtold, provides the necessary interface for the use of the data type quad with Borland C++ (where OptiVec still maintains compatibility with earlier versions that had no complete built-in support for 64-bit integers).
If, e.g., quad parameters are required by a function, they have to be passed either as existing variables of this data type, or else as in the following example:
VQI_addC( QI2, QI1,size, setquad( 53563369.L ));
Error handlingnone
Return valuethe value of x is returned as a quad.

E N D

Copyright for OptiVec software and documentation
© 1996-2004 OptiCode - Dr. Martin Sander Software Dev.
All rights reserved!