@Test public void testComplementSet() { int [] result=Utils.complementSet(new int []{1,3,4,5,6}, new int []{4,5}); assertArrayEquals(new int []{1,3,6},result); result=Utils.complementSet(new int []{1,3,4,5,6}, new int []{1,3,4,5,6}); assertArrayEquals(new int []{},result); result=Utils.complementSet(new int []{1,3,4,5,6}, new int []{1}); assertArrayEquals(new int []{3,4,5,6},result); result=Utils.complementSet(new int []{1,3,4,5,6}, new int []{4,6}); assertArrayEquals(new int []{1,3,5},result); }
public static int [] complementSet(int[] referenceSet, int[] comparingSet) { int [] indices= new int[referenceSet.length-comparingSet.length]; int j=0,l=0,i; for (i=0; i<referenceSet.length && l<comparingSet.length;i++){ if(referenceSet[i]!=comparingSet[l]) { indices[j]=referenceSet[i]; j++; } else l++; } while(i<referenceSet.length){ indices[j]=referenceSet[i]; i++; j++; } return indices; }
Utils { public static int [] complementSet(int[] referenceSet, int[] comparingSet) { int [] indices= new int[referenceSet.length-comparingSet.length]; int j=0,l=0,i; for (i=0; i<referenceSet.length && l<comparingSet.length;i++){ if(referenceSet[i]!=comparingSet[l]) { indices[j]=referenceSet[i]; j++; } else l++; } while(i<referenceSet.length){ indices[j]=referenceSet[i]; i++; j++; } return indices; } }
Utils { public static int [] complementSet(int[] referenceSet, int[] comparingSet) { int [] indices= new int[referenceSet.length-comparingSet.length]; int j=0,l=0,i; for (i=0; i<referenceSet.length && l<comparingSet.length;i++){ if(referenceSet[i]!=comparingSet[l]) { indices[j]=referenceSet[i]; j++; } else l++; } while(i<referenceSet.length){ indices[j]=referenceSet[i]; i++; j++; } return indices; }  }
Utils { public static int [] complementSet(int[] referenceSet, int[] comparingSet) { int [] indices= new int[referenceSet.length-comparingSet.length]; int j=0,l=0,i; for (i=0; i<referenceSet.length && l<comparingSet.length;i++){ if(referenceSet[i]!=comparingSet[l]) { indices[j]=referenceSet[i]; j++; } else l++; } while(i<referenceSet.length){ indices[j]=referenceSet[i]; i++; j++; } return indices; }  static double computeVariance(double count, double sum, double sumSquares); static double computeVariance(DoubleVector statistics); static double computeSD(double squaredSum, double sum, double weightSeen); static double computeSD(DoubleVector statistics); static DoubleVector[][] copy(DoubleVector[][] toCopy); static DoubleVector[] copy(DoubleVector[] toCopy); static SingleVector[] copyAsFloatVector(DoubleVector[] toCopy); static SingleVector[] copy(SingleVector[] toCopy); static DoubleVector floatToDoubleVector(SingleVector toCopy); static int [] complementSet(int[] referenceSet, int[] comparingSet); static int[] getIndexCorrespondence(int[] originalSet, int[] subSet); static double computeEntropy(DoubleVector statistics); static double computeEntropy(double count, double sum); }
Utils { public static int [] complementSet(int[] referenceSet, int[] comparingSet) { int [] indices= new int[referenceSet.length-comparingSet.length]; int j=0,l=0,i; for (i=0; i<referenceSet.length && l<comparingSet.length;i++){ if(referenceSet[i]!=comparingSet[l]) { indices[j]=referenceSet[i]; j++; } else l++; } while(i<referenceSet.length){ indices[j]=referenceSet[i]; i++; j++; } return indices; }  static double computeVariance(double count, double sum, double sumSquares); static double computeVariance(DoubleVector statistics); static double computeSD(double squaredSum, double sum, double weightSeen); static double computeSD(DoubleVector statistics); static DoubleVector[][] copy(DoubleVector[][] toCopy); static DoubleVector[] copy(DoubleVector[] toCopy); static SingleVector[] copyAsFloatVector(DoubleVector[] toCopy); static SingleVector[] copy(SingleVector[] toCopy); static DoubleVector floatToDoubleVector(SingleVector toCopy); static int [] complementSet(int[] referenceSet, int[] comparingSet); static int[] getIndexCorrespondence(int[] originalSet, int[] subSet); static double computeEntropy(DoubleVector statistics); static double computeEntropy(double count, double sum);  }