Refactor of the downsampling machinery to accept different strategies

* Implemented Adaptive downsampler
   * Added integration test
   * Added option to RRead scala script to choose downsampling strategy
This commit is contained in:
Mauricio Carneiro 2012-01-02 18:26:31 -05:00
parent cce8511d29
commit 4a208c7c06
1 changed files with 16 additions and 0 deletions

View File

@ -573,6 +573,10 @@ public class MathUtils {
return array[minElementIndex(array)];
}
public static int arrayMin(int[] array) {
return array[minElementIndex(array)];
}
public static byte arrayMin(byte[] array) {
return array[minElementIndex(array)];
}
@ -601,6 +605,18 @@ public class MathUtils {
return minI;
}
public static int minElementIndex(int[] array) {
if (array == null) throw new IllegalArgumentException("Array cannot be null!");
int minI = -1;
for (int i = 0; i < array.length; i++) {
if (minI == -1 || array[i] < array[minI])
minI = i;
}
return minI;
}
public static int arrayMaxInt(List<Integer> array) {
if (array == null) throw new IllegalArgumentException("Array cannot be null!");
if (array.size() == 0) throw new IllegalArgumentException("Array size cannot be 0!");