protected ApproximationLine progressiveKnnDistanceApproximation(int k_max){
  if (!isLeaf()) {
    throw new UnsupportedOperationException("Progressive KNN-distance approximation " + "is only vailable in leaf nodes!");
  }
  int k_0=0;
  double y_1=Double.POSITIVE_INFINITY;
  double y_kmax=Double.POSITIVE_INFINITY;
  for (int i=0; i < getNumEntries(); i++) {
    MkCoPLeafEntry entry=(MkCoPLeafEntry)getEntry(i);
    ApproximationLine approx=entry.getProgressiveKnnDistanceApproximation();
    k_0=Math.max(approx.getK_0(),k_0);
  }
  for (int i=0; i < getNumEntries(); i++) {
    MkCoPLeafEntry entry=(MkCoPLeafEntry)getEntry(i);
    ApproximationLine approx=entry.getProgressiveKnnDistanceApproximation();
    y_1=Math.min(approx.getValueAt(k_0),y_1);
    y_kmax=Math.min(approx.getValueAt(k_max),y_kmax);
  }
  double m=(y_kmax - y_1) / (Math.log(k_max) - Math.log(k_0));
  double t=y_1 - m * Math.log(k_0);
  return new ApproximationLine(k_0,m,t);
}

protected ApproximationLine progressiveKnnDistanceApproximation ( int k_max ) { if ( ! isLeaf ( ) ) { throw new UnsupportedOperationException ( "Progressive KNN-distance approximation " + "is only vailable in leaf nodes!" ) ; } int k_0 = 0 ; double y_1 = Double . POSITIVE_INFINITY ; double y_kmax = Double . POSITIVE_INFINITY ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; k_0 = Math . max ( approx . getK_0 ( ) , k_0 ) ; } for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; y_1 = Math . min ( approx . getValueAt ( k_0 ) , y_1 ) ; y_kmax = Math . min ( approx . getValueAt ( k_max ) , y_kmax ) ; } double m = ( y_kmax - y_1 ) / ( Math . log ( k_max ) - Math . log ( k_0 ) ) ; double t = y_1 - m * Math . log ( k_0 ) ; return new ApproximationLine ( k_0 , m , t ) ; }
determines and returns the progressive approximation for the knn distances of this node as the maximum of the progressive approximations of all entries .
