/**
  * @param x The array of price time series. The first time series should be the price; any other
  *     arrays are assumed to be a timeseries of dividend payments.
  * @return The exponential weighted historical volatility
  * @throws IllegalArgumentException If x is null, empty or if the first element of the array is
  *     null; if the number of values in the time series is less than three; if the dates in the
  *     different time series do not coincide
  */
 @Override
 public Double evaluate(final LocalDateDoubleTimeSeries... x) {
   testTimeSeries(x, 3);
   final LocalDateDoubleTimeSeries returnTS = _returnCalculator.evaluate(x);
   final Iterator<Double> iter = returnTS.valuesIterator();
   double returnValue = iter.next();
   double variance = returnValue * returnValue;
   while (iter.hasNext()) {
     returnValue = iter.next();
     variance = _lambda * variance + _lambdaM1 * returnValue * returnValue;
   }
   return Math.sqrt(variance);
 }
 /**
  * @param x An array of DoubleTimeSeries. The series <b>must</b> contain at least four elements;
  *     the asset price series, the dividend price series (can be null but it must be the second
  *     element), the reference price series and the reference dividend series. Any further
  *     elements will be ignored.
  * @throws IllegalArgumentException If the array is null
  * @throws TimeSeriesException Throws an exception if: the array is null; the array has less than
  *     two elements; the calculation mode is strict and the price series are not the same length.
  * @return A DoubleTimeSeries containing the excess return series.
  */
 @Override
 public LocalDateDoubleTimeSeries evaluate(final LocalDateDoubleTimeSeries... x) {
   Validate.notNull(x, "x");
   if (x.length < 4) {
     throw new TimeSeriesException("Time series array must contain at least four elements");
   }
   if (getMode() == CalculationMode.STRICT && x[0].size() != x[2].size()) {
     throw new TimeSeriesException(
         "Asset price series and reference price series were not the same size");
   }
   final LocalDateDoubleTimeSeries assetReturn =
       x[1] == null
           ? _returnCalculator.evaluate(x[0])
           : _returnCalculator.evaluate(Arrays.copyOfRange(x, 0, 2));
   final LocalDateDoubleTimeSeries referenceReturn =
       x[3] == null
           ? _returnCalculator.evaluate(x[2])
           : _returnCalculator.evaluate(Arrays.copyOfRange(x, 2, 4));
   return (LocalDateDoubleTimeSeries) assetReturn.subtract(referenceReturn);
 }