ocmath_frequency_count
Description
Function to calculate frequency count
Syntax
int ocmath_frequency_count( double * pSource, UINT nSourceSize, FreqCountOptions * fcoOptions, double * pBinCenters, UINT nBinCenterSize, double * pAbsoluteCounts, UINT nAbsoluteCountSize, double * pCumulativeCounts = NULL, UINT nCumulativeCountSize = 0, int nOption = FC_STEPSIZE, double * pBin = NULL, UINT nBinSize = 0 )
Parameters
- pSource
- [input] pointer to an array containing input data
- nSourceSize
- [input] size of an array containing input data
- fcoOptions
- [input] pointer to the sturcture that containing FromMin, ToMax, StepSize, IncludeLTMin, IncludeGEMax. Please see stats_types.h for more detail.
- pBinCenters
- [output] pointer to an array containing all Bin Centers
- nBinCenterSize
- [input] size of an array containing all Bin Centers
- pAbsoluteCounts
- [output] pinter to all absolute counts in each interval
- nAbsoluteCountSize
- [input] size of Absolute Count
- pCumulativeCounts
- [output] pointer to Cumulative Counts for each interval
- nCumulativeCountSize
- [input] size of Cumulative Counts for each interval
- nOption
- [input] Define for the Boundary type of frequency counts
- FC_STEPSIZE(default) uses step size to determine bins
- FC_NUMINTERVALS uses number of intervals to determine bins
- pBin
- [input] pointer to an array containing all input Bin
- nBinSize
- [input] size of an array containing all input Bin
Return
Returns STATS_NO_ERROR on successful exit and a non-zero STATS error code on failure.
Examples
EX1
void ocmath_frequency_count_ex1()
{
UINT nSourceSize = 5; //Set the DataSize to 5
vector vSource;
vSource.Data(1, nSourceSize, 1);
FreqCountOptions fcoOptions;
fcoOptions.FromMin = 0;
fcoOptions.ToMax = 7;
fcoOptions.StepSize = 7;
fcoOptions.IncludeLTMin = 0;
fcoOptions.IncludeGEMax = 0;
vector vBinCenters, vAbsoluteCounts, vCumulativeCounts, vBinCentersChk, vAbsoluteCountsChk, vCumulativeCountsChk;
UINT nBinCenterSize = fcoOptions.StepSize;
vBinCenters.SetSize(nBinCenterSize);
UINT nAbsoluteCountSize = fcoOptions.StepSize;
vAbsoluteCounts.SetSize(nAbsoluteCountSize);
UINT nCumulativeCountSize = fcoOptions.StepSize;
vCumulativeCounts.SetSize(nCumulativeCountSize);
int nRet;
int nOption = FC_NUMINTERVALS;
nRet = ocmath_frequency_count(vSource, nSourceSize, &fcoOptions, vBinCenters, nBinCenterSize, vAbsoluteCounts, nAbsoluteCountSize, vCumulativeCounts, nCumulativeCountSize, nOption);
}
Remark
See Also
header to Included
origin.h
Reference
|