protected static void calculateSelectivityCoeffs(List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon) {
    final int dimensions = query.getDimensionality();
    double[] lowerVals = new double[dimensions];
    double[] upperVals = new double[dimensions];

    VectorApproximation queryApprox = calculatePartialApproximation(null, query, daFiles);

    for(int i = 0; i < dimensions; i++) {
      final double val = query.doubleValue(i);
      lowerVals[i] = val - epsilon;
      upperVals[i] = val + epsilon;
    }

    DoubleVector lowerEpsilon = DoubleVector.wrap(lowerVals);
    VectorApproximation lowerEpsilonPartitions = calculatePartialApproximation(null, lowerEpsilon, daFiles);

    DoubleVector upperEpsilon = DoubleVector.wrap(upperVals);
    VectorApproximation upperEpsilonPartitions = calculatePartialApproximation(null, upperEpsilon, daFiles);

    for(int i = 0; i < daFiles.size(); i++) {
      int coeff = (queryApprox.getApproximation(i) - lowerEpsilonPartitions.getApproximation(i)) + (upperEpsilonPartitions.getApproximation(i) - queryApprox.getApproximation(i)) + 1;
      daFiles.get(i).first = coeff;
    }
  }
protected static void calculateSelectivityCoeffs ( List < DoubleObjPair < DAFile > > daFiles , NumberVector query , double epsilon ) { final int dimensions = query . getDimensionality ( ) ; double [ ] lowerVals = new double [ dimensions ] ; double [ ] upperVals = new double [ dimensions ] ; VectorApproximation queryApprox = calculatePartialApproximation ( null , query , daFiles ) ; for ( int i = 0 ; i < dimensions ; i ++ ) { final double val = query . doubleValue ( i ) ; lowerVals [ i ] = val - epsilon ; upperVals [ i ] = val + epsilon ; } DoubleVector lowerEpsilon = DoubleVector . wrap ( lowerVals ) ; VectorApproximation lowerEpsilonPartitions = calculatePartialApproximation ( null , lowerEpsilon , daFiles ) ; DoubleVector upperEpsilon = DoubleVector . wrap ( upperVals ) ; VectorApproximation upperEpsilonPartitions = calculatePartialApproximation ( null , upperEpsilon , daFiles ) ; for ( int i = 0 ; i < daFiles . size ( ) ; i ++ ) { int coeff = ( queryApprox . getApproximation ( i ) - lowerEpsilonPartitions . getApproximation ( i ) ) + ( upperEpsilonPartitions . getApproximation ( i ) - queryApprox . getApproximation ( i ) ) + 1 ; daFiles . get ( i ) . first = coeff ; } }
Calculate selectivity coefficients.

@param daFiles List of files to use
@param query Query vector
@param epsilon Epsilon radius