/** @return an element */ public double getElement(int row, int column) { if (!distancesKnown) { calculateDistances(); } return distances[row][column]; }
/** set an element - this overwrites any existing elements */ public void setElement(int row, int column, double value) { if (!distancesKnown) { calculateDistances(); } distances[row][column] = value; }
/** Returns the mean pairwise distance of this matrix */ public double getMeanDistance() { if (!distancesKnown) { calculateDistances(); } double dist = 0.0; int count = 0; for (int i = 0; i < dimension; i++) { for (int j = 0; j < dimension; j++) { if (i != j) { dist += distances[i][j]; count += 1; } } } return dist / (double) count; }