public double seriesDistance(double[][] series1,double[][] series2) throws Exception {
  if (series1.length == series2.length) {
    Double res=0D;
    for (int i=0; i < series1.length; i++) {
      res=res + distance2(series1[i],series2[i]);
    }
    return Math.sqrt(res);
  }
 else {
    throw new Exception("Exception in Euclidean distance: array lengths are not equal");
  }
}

public double seriesDistance ( double [ ] [ ] series1 , double [ ] [ ] series2 ) throws Exception { if ( series1 . length == series2 . length ) { Double res = 0D ; for ( int i = 0 ; i < series1 . length ; i ++ ) { res = res + distance2 ( series1 [ i ] , series2 [ i ] ) ; } return Math . sqrt ( res ) ; } else { throw new Exception ( "Exception in Euclidean distance: array lengths are not equal" ) ; } }
calculates euclidean distance between two multi - dimensional time - series of equal length .
