cmVectOpsRIHdr/Code.h: Added cmVoX_IsEqual() and cmVoX_IsClose().
This commit is contained in:
parent
cc7ac752af
commit
44c4ad31fe
@ -864,6 +864,28 @@ unsigned* VECT_OP_FUNC(MaxIndexM)( unsigned* dp, const VECT_OP_TYPE* sp, unsign
|
|||||||
return dp;
|
return dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VECT_OP_FUNC(IsEqual)( const VECT_OP_TYPE* s0p, const VECT_OP_TYPE* s1p, unsigned sn )
|
||||||
|
{
|
||||||
|
const VECT_OP_TYPE* ep = s0p + sn;
|
||||||
|
for(; s0p < ep; ++s0p,++s1p )
|
||||||
|
if( *s0p != *s1p )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VECT_OP_FUNC(IsClose)( const VECT_OP_TYPE* s0p, const VECT_OP_TYPE* s1p, unsigned sn, double pct )
|
||||||
|
{
|
||||||
|
const VECT_OP_TYPE* ep = s0p + sn;
|
||||||
|
for(; s0p < ep; ++s0p,++s1p )
|
||||||
|
{
|
||||||
|
double d = abs(*s1p - *s0p);
|
||||||
|
double s = cmMin(*s1p,*s0p);
|
||||||
|
if( d*100.0/s > pct )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VECT_OP_TYPE VECT_OP_FUNC(Mode)( const VECT_OP_TYPE* sp, unsigned sn )
|
VECT_OP_TYPE VECT_OP_FUNC(Mode)( const VECT_OP_TYPE* sp, unsigned sn )
|
||||||
{
|
{
|
||||||
|
@ -134,6 +134,11 @@ VECT_OP_TYPE* VECT_OP_FUNC(MaxVV)( VECT_OP_TYPE* dp, unsigned dn, const VECT_OP
|
|||||||
unsigned* VECT_OP_FUNC(MinIndexM)( unsigned* dp, const VECT_OP_TYPE* sp, unsigned srn, unsigned scn );
|
unsigned* VECT_OP_FUNC(MinIndexM)( unsigned* dp, const VECT_OP_TYPE* sp, unsigned srn, unsigned scn );
|
||||||
unsigned* VECT_OP_FUNC(MaxIndexM)( unsigned* dp, const VECT_OP_TYPE* sp, unsigned srn, unsigned scn );
|
unsigned* VECT_OP_FUNC(MaxIndexM)( unsigned* dp, const VECT_OP_TYPE* sp, unsigned srn, unsigned scn );
|
||||||
|
|
||||||
|
/// Return true if s0p[sn] is equal to s1p[sn]
|
||||||
|
bool VECT_OP_FUNC(IsEqual)( const VECT_OP_TYPE* s0p, const VECT_OP_TYPE* s1p, unsigned sn );
|
||||||
|
|
||||||
|
/// Return true if all elements of s0p[sn] are within 'pct' percent of s1p[sn].
|
||||||
|
bool VECT_OP_FUNC(IsClose)( const VECT_OP_TYPE* s0p, const VECT_OP_TYPE* s1p, unsigned sn, double pct );
|
||||||
|
|
||||||
/// Return the most frequently occuring element in sp.
|
/// Return the most frequently occuring element in sp.
|
||||||
VECT_OP_TYPE VECT_OP_FUNC(Mode)( const VECT_OP_TYPE* sp, unsigned sn );
|
VECT_OP_TYPE VECT_OP_FUNC(Mode)( const VECT_OP_TYPE* sp, unsigned sn );
|
||||||
|
Loading…
Reference in New Issue
Block a user