Пример #1
0
 /*
  * The implementation for double array
  */
 public double[] autoCorr(double[] xx) {
   double[] ac = new double[xx.length];
   int n = xx.length;
   for (int j = 0; j < n; j++) {
     double[] yy = new double[xx.length];
     // Set y as a time-sifting (of time j) array of x.
     for (int i = 0; i < n; i++) {
       yy[i] = xx[(i + j) % xx.length];
     }
     ac[j] = Stat.corrCoeff(xx, yy);
   }
   return ac;
 }
Пример #2
0
 private void calcCorrelationMap() {
   Iterator<Integer> it1 = nodemap.keySet().iterator();
   while (it1.hasNext()) {
     int id1 = it1.next();
     Map<Integer, Double> subcsmap = new HashMap<Integer, Double>();
     Iterator<Integer> it2 = nodemap.keySet().iterator();
     while (it2.hasNext()) {
       int id2 = it2.next();
       if (id1 == id2) {
         continue;
       }
       double[] values1 = linkedListToDoubleArray(nodemap.get(id1).values());
       double[] values2 = linkedListToDoubleArray(nodemap.get(id2).values());
       double correlation = Stat.corrCoeff(values1, values2);
       subcsmap.put(id2, correlation);
     }
     correlationmap.put(id1, subcsmap);
   }
 }