Calculate the vector's sum, minimum and maximum.
double ocmath_b_sum( BYTE * pData, uint nSize, BYTE * pmin = NULL, BYTE * pmax = NULL, uint * pnmin = NULL, uint * pnmax = NULL )
Sum of all the elements of pData
EX1
void ocmath_b_sum_ex1() { vector v={1,2,3,4,5,2,3,4,54,3,3,4,3,3}; uint nSize=14; double dMin, dMax; uint nMin,nMax,nCount; v[7]=NANUM; double dsum=ocmath_d_sum(v,nSize,&dMin,&dMax,&nMin,&nMax,&nCount); printf("%f %f %d %d %f %d", dMin, dMax, nMin, nMax, dsum, nCount); //dMin=1 dMax=54 nMin=0 nMax=8 dsum=90 nCount=13 }
calculate the vector's sum, minimum and maximum, ocmath_d_sum also count the vector size without missing value.
The function is overloaded to support type float, unsigned short, unsigned int and unsigned char.
Data types supported
double: ocmath_d_sum
float: ocmath_f_sum
unsigned short: ocmath_us_sum
unsigned int: ocmath_ui_sum
unsigned char: ocmath_b_sum
ocmath_f_sum, ocmath_ui_sum, ocmath_us_sum
origin.h