ocmath_d_get_vector_inc

 

Contents

Description

Check data monotonic increasing or decreasing with consistant increment or otherwise.

Syntax

int ocmath_d_get_vector_inc( UINT nPoints, const double * pData, double dTol, double * pBegin, double * pEnd, double * pInc )

Parameters

nPoints
[input] size of pData
pData
[input] contains data to be checked
dTol
[input] tolerance ratio used to estimate two data are same or not in calling the function same_values.
pBegin
[output] pointer to begin value, if pData is monotonic increasing or decreasing with consistant increment
pEnd
[output] pointer to end value, if pData is monotonic increasing or decreasing with consistant increment
pInc
[output] pointer to the consistent increment, if pData is monotonic increasing or decreasing with consistant increment

Return

return 1 if data monotonic increasing with consistent increment (per dTol)

return -1 of same but decreasing

return 0 if not monotonic at all, returns 2 or -2 if monotonic but not consistent increment

Examples

EX1

void ocmath_d_get_vector_inc_ex1()
{
    vector<int> vecData = {1,2,3,4,5,6,7,8,9,10};
    int nTol = 1;
    int begin, end, inc;
    int nRet = ocmath_i_get_vector_inc(vecData.GetSize(), vecData, nTol, &begin, &end, &inc);
}

Remark

check data monotonic increasing or decreasing with consistant increment or otherwise.

return 1 if data monotonic increasing with consistent increment (per dTol)

return -1 of same but decreasing

return 0 if not monotonic at all, returns 2 or -2 if monotonic but not consistent increment

Data types supported:

double: ocmath_d_get_vector_inc

int: ocmath_i_get_vector_inc

See Also

header to Include

origin.h

Reference