throw new RuntimeException("Reference Set Size = 0. This should never happen!");
}
// prepare similarity matrix
int dim = obj.getDimensionality();
Matrix simMatrix = new Matrix(dim, dim, 0);
for(int i = 0; i < dim; i++) {
simMatrix.set(i, i, 1);
}
// prepare projected dimensionality
int projDim = 0;
// start variance analysis
double[] sum = new double[dim];
for(DistanceResultPair<D> neighbor : neighbors) {
V o = database.get(neighbor.getDBID());
for(int d = 0; d < dim; d++) {
sum[d] += Math.pow(obj.doubleValue(d + 1) - o.doubleValue(d + 1), 2.0);
}
}
for(int d = 0; d < dim; d++) {
if(Math.sqrt(sum[d]) / referenceSetSize <= delta) {
if(msg != null) {
msg.append("\nsum[" + d + "]= " + sum[d]);
msg.append("\n Math.sqrt(sum[d]) / referenceSetSize)= " + Math.sqrt(sum[d]) / referenceSetSize);
}
// projDim++;
simMatrix.set(d, d, kappa);
}
else {
// bug in paper?
projDim++;
}