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:uiVector; Limits:fVector; bins:UIntSize; 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 ); /* 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

VectorLib Table of Contents  OptiVec home