V x = database.get(id);
List<Double> probabilities = new ArrayList<Double>(k);
for(int i = 0; i < k; i++) {
V difference = x.minus(means.get(i));
Matrix differenceRow = difference.getRowVector();
Vector differenceCol = difference.getColumnVector();
Matrix rowTimesCov = differenceRow.times(invCovMatr.get(i));
Vector rowTimesCovTimesCol = rowTimesCov.times(differenceCol);
double power = rowTimesCovTimesCol.get(0, 0) / 2.0;
double prob = normDistrFactor.get(i) * Math.exp(-power);
if(logger.isDebuggingFinest()) {
logger.debugFinest(" difference vector= ( " + difference.toString() + " )\n" + " differenceRow:\n" + FormatUtil.format(differenceRow, " ") + "\n" + " differenceCol:\n" + FormatUtil.format(differenceCol, " ") + "\n" + " rowTimesCov:\n" + FormatUtil.format(rowTimesCov, " ") + "\n" + " rowTimesCovTimesCol:\n" + FormatUtil.format(rowTimesCovTimesCol, " ") + "\n" + " power= " + power + "\n" + " prob=" + prob + "\n" + " inv cov matrix: \n" + FormatUtil.format(invCovMatr.get(i), " "));
}