class EuclideanDistance implements IDistanceMetric {

	@Override
	public double distance(final double[] a, final double[] b) {
		// Parameter checks.
		RobustnessUtil.sameLengthOrDie(a, b);

		int n = a.length;
		// Sum over all elements.
		double result = 0;
		for (int i = 0; i < n; i++) {
			result += Math.pow((a[i] - b[i]), 2);
		}
		result = Math.sqrt(result);

		return result;
	}

}