matrix ex_diff( void)
{
/*
 * compute the relative percent differences in number of points between the paths
 */
  matrix t, r = zeros(L,L);
  int el1, el2, j, k;
  double d, dmin;
  vector perm, i1, i2;

  for( el1=1; el1<=L; ++el1) {
    for( el2=el1+1; el2<=L; ++el2) {
      dmin = HUGE_VAL;
      for( k=1; k<=MP; ++k) {
	d = 0;
	perm = perms(k);
        for( j=1; j<=K; ++j) {
	  i1 = 1 + (el1-1)*K + (j-1);
	  i2 = 1 + (el2-1)*K + (perm(j)-1);
	  t = ex(i1,:) != ex(i2,:);
	  d += sum(t(:));
        }
	if( d < dmin) dmin = d;
      }
    r(el1,el2) = dmin;
    }
  }

  return r/(N*K/100);
}
