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:UIntSize ): IntBool;

    (similarly VD_,   VE_,   VSI_,   VI_,   VLI_,   VQI_)
function VCF_abs( Y:fVector; X:cfVector; size:UIntSize ): IntBool;
    (similarly VCD_,   VCE_,   VPF_,   VPD_,   VPE_)
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_abs( fVector d_Y, fVector d_X, ui size );
int VFcu_abs( fVector h_Y, fVector h_X, ui size );
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_abs( d_Y, d_X:fVector; size:UIntSize ): IntBool;
function VFcu_abs( h_Y, h_X:fVector; size:UIntSize ): IntBool;
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

VectorLib Table of Contents  OptiVec home