VF_median | VD_median | VE_median |
VI_median | VBI_median | VSI_median | VLI_median | VQI_median | |
VU_median | VUB_median | VUS_median | VUL_median | VUQ_median | VUI_median |
|
Function | Median of a one-dimensional distribution |
|
Syntax C/C++ | #include <VFmath.h>
float VF_median( fVector X, ui size );
double VD_median( dVector X, ui size );
float VBI_median( biVector X, ui size );
float VUB_median( ubVector X, ui size );
float VSI_median( siVector X, ui size );
float VUS_median( usVector X, ui size );
double VI_median( iVector X, ui size );
double VU_median( uVector X, ui size );
extended VQI_median( qiVector X, ui size );
extended VUQ_median( uqVector X, ui size );
For Windows (long = dword integer type):
double VLI_median( liVector X, ui size );
double VUL_median( ulVector X, ui size );
For Linux (long = qword integer type):
extended VLI_median( liVector X, ui size );
extended VUL_median( ulVector X, ui size );
|
C++ VecObj | #include <OptiVec.h>
T vector<T>::median(); // floating-point variants
float vector<T>::median(); // byte- and word-sized integer variants
double vector<T>::median(); // dword-sized integer variants
extended vector<T>::median(); // qword-sized integer variants
|
Pascal/Delphi | uses VFmath;
function VF_median( X:fVector; size:UIntSize ): Single;
function VD_median( X:dVector; size:UIntSize ): Double;
function VBI_median( X:biVector; size:UIntSize ): Single;
function VUB_median( X:ubVector; size:UIntSize ): Single;
function VSI_median( X:siVector; size:UIntSize ): Single;
function VUS_median( X:usVector; size:UIntSize ): Single;
function VI_median( X:iVector; size:UIntSize ): Double;
function VU_median( X:uVector; size:UIntSize ): Double;
function VQI_median( X:qiVector; size:UIntSize ): Extended;
function VUQ_median( X:uqVector; size:UIntSize ): Extended;
For Windows (LongInt = dword integer type):
function VLI_median( X:liVector; size:UIntSize ): Double;
function VUL_median( X:ulVector; size:UIntSize ): Double;
For Linux (LongInt = qword integer type):
function VLI_median( X:liVector; size:UIntSize ): Extended;
function VUL_median( X:ulVector; size:UIntSize ): Extended;
|
|
CUDA function C/C++ | #include <cudaVFstd.h>
int cudaVF_median( float *h_RetVal, fVector d_X, ui size );
int cusdVF_median( float *d_RetVal, fVector d_X, ui size );
float VFcu_median( fVector h_X, ui size );
int cudaVBI_median( float *h_RetVal, biVector d_X, ui size );
int cusdVBI_median( float *d_RetVal, biVector d_X, ui size );
float VBIcu_median( biVector h_X, ui size );
(similarly VUB_, VSI_, VUS_)
int cudaVI_median( double *h_RetVal, iVector d_X, ui size );
int cusdVI_median( double *d_RetVal, iVector d_X, ui size );
double VIcu_median( iVector h_X, ui size );
(similarly VU_, VLI_, VLU_, VQI_, VUQ_)
|
CUDA function Pascal/Delphi | uses VFstd;
function cudaVF_median( var h_RetVal:Single; d_X:fVector; size:UIntSize ): IntBool;
function cusdVF_median( d_RetVal:PSingle; d_X:fVector; size:UIntSize ): IntBool;
function VFcu_median( h_X:fVector; size:UIntSize ): Single;
function cudaVBI_median( var h_RetVal:Single; d_X:biVector; size:UIntSize ): IntBool;
function cusdVBI_median( d_RetVal:PSingle; d_X:biVector; size:UIntSize ): IntBool;
function VBIcu_median( h_X:biVector; size:UIntSize ): Single;
(similarly VUB_, VSI_, VUS_)
function cudaVI_median( var h_RetVal:Double; d_X:iVector; size:UIntSize ): IntBool;
function cusdVI_median( d_RetVal:PDouble; d_X:iVector; size:UIntSize ): IntBool;
function VIcu_median( h_X:iVector; size:UIntSize ): Double;
(similarly VU_, VLI_, VLU_, VQI_, VUQ_)
|
|
Description | The median of a distribution is defined as the value for which values above and below are equally probable. 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.
The return value of the integer versions is a floating-point number, as the median may be the value half-way between two vector elements and thus involve an addition of 0.5 to the next integer value. There is an inherent problem with 8-byte integer values (VQI_median and VUQ_median): 64-bit integers are representable as exact numbers in double-precision floating-point format only up to values of ±253. Even extended precision does not cover the full range, but only up to ±263. Therefore, the return value of VQI_median and VUQ_median will be exact only if it lies within these ranges. |
|
|
Return value | The median is returned. |
|
|