VF_distributionVD_distributionVE_distribution
VI_distributionVBI_distributionVSI_distributionVLI_distributionVQI_distribution 
VU_distributionVUB_distributionVUS_distributionVUL_distributionVUQ_distributionVUI_distribution
FunctionHistogram or Distribution 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:uiVector; Limits:fVector; bins:UIntSize; X:fVector; sizex:UIntSize; mode:Integer ):UIntSize;
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_distribution( ui *h_nOutside, uiVector d_Abund, fVector d_Limits, ui nbins, fVector d_X, ui sizex, int mode );
int cusdVF_distribution( ui *d_nOutside, uiVector d_Abund, fVector d_Limits, ui nbins, fVector d_X, ui sizex, int mode );
ui VFcu_distribution( uiVector h_Abund, fVector h_Limits, ui nbins, fVector h_X, ui sizex, int mode );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_distribution( var h_nOutside:UIntSize; d_Abund:uiVector; d_Limits:fVector; bins:UIntSize; d_X:fVector; sizex:UIntSize; mode:Integer ): IntBool;
function cusdVF_distribution( d_nOutside:PUIntSize; d_Abund:uiVector; d_Limits:fVector; bins:UIntSize; d_X:fVector; sizex:UIntSize; mode:Integer ): IntBool;
function VFcu_distribution( h_Abund:uiVector; h_Limits:fVector; bins:UIntSize; h_X:fVector; sizex:UIntSize; mode:Integer ): UIntSize;
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 );
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.

Batch processing of several vectors of equal size is possible using MF_Rows_distribution (preferred for C/C++) and MF_Cols_distribution (for Delphi).

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

VectorLib Table of Contents  OptiVec home