ocmath_mean_increment
Description
Devides the array to multiple parts and get each part's mean increment, standard deviations.
Syntax
int ocmath_mean_increment( UINT nSize, const double * pData, double * pMeanInc, int nSegments = 1, double * pSD = NULL, int * pSegSize = NULL, UINT nPts = 0 )
Parameters
- nSize
- [input] size of input pData array.
- pData
- [input] pointer to input data array.
- pMeanInc
- [output] pointer to pData's mean increment of each parts, size should
- be equal to nSegments.
- nSegments
- [input] input array will be divided into nSegments parts, its default value is 1.
- pSD
- [output] if not NULL, pointer to standard deviations of each part's increment array
- and its size should be equal to nSegments. Its default value is NULL.
- pSegSize
- [output] if not NULL, pointer to pData each part's elements number and its size
- should be equal to nSegments. Its default value is NULL.
- nPts
- [input] number of input array's data to be used. it should be >= 0 and <= nSize.
- Its default value is 0, that is to say use all datas of array .
Return
Return OE_NOERROR if succeed, otherwise, non-zero error code is returned.
Examples
EX1
void ocmath_mean_increment_ex1()
{
vector vTest = {0.1, 0.3, 0.5, 0.55, 0.6, 1.1, 1.9};
double dMeanInc;
int nRet = ocmath_mean_increment(vTest.GetSize(), vTest, &dMeanInc, 1);
}
// At the end of example: dMeanInc = 0.3;
EX2
void ocmath_mean_increment_ex2()
{
vector vTest = {0.1, 0.3, 0.5, 0.55, 0.6, 1.1, 1.9};
int nSegments = 2;
vector vMeanInc(nSegments);
vector<int> vSegSize(nSegments);
int nRet = ocmath_mean_increment(vTest.GetSize(), vTest, vMeanInc, nSegments, NULL, vSegSize);
}
// At the end of example: vMeanInc = {0.2, 0.45}; vSegSize = {3, 4};
// vTest will be divided to two parts:{0.1, 0.3, 0.5} and {0.55, 0.6, 1.1 ,1.9}
Remark
This function devides array to nSegments parts and get each part's mean increment,
standard deviations (SD) of each part's increment array if pSD != NULL and each
part's elements number if pSegSize != NULL.
if nPts = 0, use all the data as specified by nSize, if nPts > 0, use
MIN(nSize, nPts) for the calculation.
nSegments can equal to 1, that is to say compute whole array's mean increment,
SD of increment array and SegSize.
See Also
header to Include
origin.h
Reference
|