wkmeans.c
PREC compute_rms2(const PREC *CX, unsigned int dim, unsigned int ncls)
{
  int cnt = 0;
  PREC rms = 0.0;
  for (int i = ncls - 1; i > 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      const PREC *pc1 = CX + i * dim;
      const PREC *pc2 = CX + j * dim;
      PREC d = compute_distance(pc1, pc2, dim);
      rms += d * d;
      cnt++;
    }
  }
  rms /= cnt;
  rms = sqrt(rms);
  return (rms);
}
/* This computes the between cluster root-mean-squared distance */
This computes the between cluster root-mean-squared distance
This computes the between cluster root - mean - squared distance
PREC compute_rms2(const PREC *CX, unsigned int dim, unsigned int ncls)
{
  int cnt = 0;
  PREC rms = 0.0;
  for (int i = ncls - 1; i > 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      const PREC *pc1 = CX + i * dim;
      const PREC *pc2 = CX + j * dim;
      PREC d = compute_distance(pc1, pc2, dim);
      rms += d * d;
      cnt++;
    }
  }
  rms /= cnt;
  rms = sqrt(rms);
  return (rms);
}
PREC compute_rms2 ( const PREC * CX , unsigned int dim , unsigned int ncls ) { int cnt = 0 ; PREC rms = 0.0 ; for ( int i = ncls - 1 ; i > 0 ; i -- ) { for ( int j = i - 1 ; j >= 0 ; j -- ) { const PREC * pc1 = CX + i * dim ; const PREC * pc2 = CX + j * dim ; PREC d = compute_distance ( pc1 , pc2 , dim ) ; rms += d * d ; cnt ++ ; } } rms /= cnt ; rms = sqrt ( rms ) ; return ( rms ) ; }
This computes the between cluster root-mean-squared distance
This computes the between cluster root - mean - squared distance