Calculate the vector's sum, minimum and maximum.
double ocmath_ui_sum( uint * pData, uint nSize, uint * pmin = NULL, uint * pmax = NULL, uint * pnmin = NULL, uint * pnmax = NULL )
Sum of all the elements of pData
EX1
void ocmath_ui_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:
ocmath_f_sum, ocmath_us_sum, ocmath_b_sum
origin.h