class SquaredBackwardDifferenceComplexity implements ITimeSeriesComplexity {

	@Override
	public double complexity(final double[] t) {
		int n = t.length;
		double sum = .0;
		for (int i = 0; i < n - 1; i++) {
			sum += (t[i] - t[i + 1]) * (t[i] - t[i + 1]);
		}
		return Math.sqrt(sum);
	}

}