hmmer-3.3/easel/esl_vectorops.c
/* Function:  esl_vec_{DFIL}Compare()
 * Synopsis:  Return <eslOK> if two vectors are equal.
 * Incept:    SRE, Mon Nov  6 10:20:28 2006 [Janelia]
 *
 * Purpose:   Compare <vec1> to <vec2> for equality, by
 *            comparing each cognate element pair. Both vectors 
 *            are of size <n>. Equality of elements is
 *            defined by being $\leq$ fractional tolerance <tol> 
 *            for floating point comparisons, and strict equality
 *            for integer comparisons. Return <eslOK>
 *            if the vectors are equal, and <eslFAIL> if not.
 *            
 *            If <n=0>, the test always succeeds. In this case, either
 *            <vec1> and <vec2> (or both) may be <NULL>.  This
 *            accommodates an occasional convention of leaving empty
 *            vectors <NULL>.
 */
esl_vec_{DFIL}Compare()
Synopsis:  Return  if two vectors are equal.

Compare  to  for equality, by
comparing each cognate element pair. Both vectors
are of size . Equality of elements is
defined by being $\leq$ fractional tolerance 
for floating point comparisons, and strict equality
for integer comparisons. Return 
if the vectors are equal, and  if not.

If , the test always succeeds. In this case, either
 and  (or both) may be .  This
accommodates an occasional convention of leaving empty
vectors .
esl_vec_ { DFIL } Compare () Synopsis : Return if two vectors are equal . Compare to for equality by comparing each cognate element pair . Both vectors are of size . Equality of elements is defined by being $ \ leq$ fractional tolerance for floating point comparisons and strict equality for integer comparisons . Return if the vectors are equal and if not . If the test always succeeds . In this case either and ( or both ) may be . This accommodates an occasional convention of leaving empty vectors .
int
esl_vec_DCompare(const double *vec1, const double *vec2, int n, double tol)
{
  int i;
  for (i = 0; i < n; i++) if (esl_DCompare(vec1[i], vec2[i], tol) == eslFAIL) return eslFAIL;
  return eslOK;
}
int esl_vec_DCompare ( const double * vec1 , const double * vec2 , int n , double tol ) { int i ; for ( i = 0 ; i < n ; i ++ ) if ( esl_DCompare ( vec1 [ i ] , vec2 [ i ] , tol ) == eslFAIL ) return eslFAIL ; return eslOK ; }
Function:  esl_vec_{DFIL}Compare()
 Synopsis:  Return <eslOK> if two vectors are equal.
Function : esl_vec_ { DFIL } Compare () Synopsis : Return <eslOK > if two vectors are equal .