private static double[][] getDistanceMatrix(List<TimeSerie> timeSeries) throws InputException {
		double[][] distanceMatrix = new double[timeSeries.size()][timeSeries.size()];
		
		// Construct the lower half of the matrix
		for (int i = 0; i < timeSeries.size(); i++) {
			for (int j = 0; j < i; j++) {
				distanceMatrix[i][j] = timeSeries.get(i).distanceTo(timeSeries.get(j));
			}
		}
		
		// Copy the values from lower half to upper half of the matrix
		for (int i = 0; i < timeSeries.size(); i++) {
			for (int j = (i + 1); j < timeSeries.size(); j++) {
				distanceMatrix[i][j] = distanceMatrix[j][i];
			}
		}
		
		// Diagonal values should be zero
		for (int i = 0; i < timeSeries.size(); i++) {
			distanceMatrix[i][i] = 0;
		}
		
		return distanceMatrix;
	}