public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel) { List<Integer> allStartPoints = getSamplingPattern(BASE_SAMPLING_LEVEL); // calculate starting indexes for sampling rounds int initialRound = BASE_SAMPLING_LEVEL - currentSamplingLevel; int numRounds = Math.abs(currentSamplingLevel - newSamplingLevel); int[] startPoints = new int[numRounds]; for (int i = 0; i < numRounds; ++i) { int start = allStartPoints.get(initialRound + i); // our "ideal" start points will be affected by the removal of items in earlier rounds, so go through all // earlier rounds, and if we see an index that comes before our ideal start point, decrement the start point int adjustment = 0; for (int j = 0; j < initialRound; ++j) { if (allStartPoints.get(j) < start) adjustment++; } startPoints[i] = start - adjustment; } return startPoints; } }
public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel) { List<Integer> allStartPoints = getSamplingPattern(BASE_SAMPLING_LEVEL); // calculate starting indexes for sampling rounds int initialRound = BASE_SAMPLING_LEVEL - currentSamplingLevel; int numRounds = Math.abs(currentSamplingLevel - newSamplingLevel); int[] startPoints = new int[numRounds]; for (int i = 0; i < numRounds; ++i) { int start = allStartPoints.get(initialRound + i); // our "ideal" start points will be affected by the removal of items in earlier rounds, so go through all // earlier rounds, and if we see an index that comes before our ideal start point, decrement the start point int adjustment = 0; for (int j = 0; j < initialRound; ++j) { if (allStartPoints.get(j) < start) adjustment++; } startPoints[i] = start - adjustment; } return startPoints; } }
public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel) { List<Integer> allStartPoints = getSamplingPattern(BASE_SAMPLING_LEVEL); // calculate starting indexes for sampling rounds int initialRound = BASE_SAMPLING_LEVEL - currentSamplingLevel; int numRounds = Math.abs(currentSamplingLevel - newSamplingLevel); int[] startPoints = new int[numRounds]; for (int i = 0; i < numRounds; ++i) { int start = allStartPoints.get(initialRound + i); // our "ideal" start points will be affected by the removal of items in earlier rounds, so go through all // earlier rounds, and if we see an index that comes before our ideal start point, decrement the start point int adjustment = 0; for (int j = 0; j < initialRound; ++j) { if (allStartPoints.get(j) < start) adjustment++; } startPoints[i] = start - adjustment; } return startPoints; } }
public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel) { List<Integer> allStartPoints = getSamplingPattern(BASE_SAMPLING_LEVEL); // calculate starting indexes for sampling rounds int initialRound = BASE_SAMPLING_LEVEL - currentSamplingLevel; int numRounds = Math.abs(currentSamplingLevel - newSamplingLevel); int[] startPoints = new int[numRounds]; for (int i = 0; i < numRounds; ++i) { int start = allStartPoints.get(initialRound + i); // our "ideal" start points will be affected by the removal of items in earlier rounds, so go through all // earlier rounds, and if we see an index that comes before our ideal start point, decrement the start point int adjustment = 0; for (int j = 0; j < initialRound; ++j) { if (allStartPoints.get(j) < start) adjustment++; } startPoints[i] = start - adjustment; } return startPoints; } }
public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel) { List<Integer> allStartPoints = getSamplingPattern(BASE_SAMPLING_LEVEL); // calculate starting indexes for sampling rounds int initialRound = BASE_SAMPLING_LEVEL - currentSamplingLevel; int numRounds = Math.abs(currentSamplingLevel - newSamplingLevel); int[] startPoints = new int[numRounds]; for (int i = 0; i < numRounds; ++i) { int start = allStartPoints.get(initialRound + i); // our "ideal" start points will be affected by the removal of items in earlier rounds, so go through all // earlier rounds, and if we see an index that comes before our ideal start point, decrement the start point int adjustment = 0; for (int j = 0; j < initialRound; ++j) { if (allStartPoints.get(j) < start) adjustment++; } startPoints[i] = start - adjustment; } return startPoints; } }
/** * Returns a list that can be used to translate current index summary indexes to their original index before * downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) * * For example, if [0, 64] is returned, the current index summary entry at index 0 was originally * at index 0, and the current index 1 was originally at index 64. * * @param samplingLevel the current sampling level for the index summary * * @return a list of original indexes for current summary entries */ public static List<Integer> getOriginalIndexes(int samplingLevel) { List<Integer> originalIndexes = originalIndexCache.get(samplingLevel); if (originalIndexes != null) return originalIndexes; List<Integer> pattern = getSamplingPattern(BASE_SAMPLING_LEVEL).subList(0, BASE_SAMPLING_LEVEL - samplingLevel); originalIndexes = new ArrayList<>(samplingLevel); for (int j = 0; j < BASE_SAMPLING_LEVEL; j++) { if (!pattern.contains(j)) originalIndexes.add(j); } originalIndexCache.put(samplingLevel, originalIndexes); return originalIndexes; }
List<Integer> ordering = getSamplingPattern(samplingLevel/2); List<Integer> startIndices = new ArrayList<>(samplingLevel);
/** * Returns a list that can be used to translate current index summary indexes to their original index before * downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) * * For example, if [0, 64] is returned, the current index summary entry at index 0 was originally * at index 0, and the current index 1 was originally at index 64. * * @param samplingLevel the current sampling level for the index summary * * @return a list of original indexes for current summary entries */ public static List<Integer> getOriginalIndexes(int samplingLevel) { List<Integer> originalIndexes = originalIndexCache.get(samplingLevel); if (originalIndexes != null) return originalIndexes; List<Integer> pattern = getSamplingPattern(BASE_SAMPLING_LEVEL).subList(0, BASE_SAMPLING_LEVEL - samplingLevel); originalIndexes = new ArrayList<>(samplingLevel); for (int j = 0; j < BASE_SAMPLING_LEVEL; j++) { if (!pattern.contains(j)) originalIndexes.add(j); } originalIndexCache.put(samplingLevel, originalIndexes); return originalIndexes; }
/** * Returns a list that can be used to translate current index summary indexes to their original index before * downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) * * For example, if [0, 64] is returned, the current index summary entry at index 0 was originally * at index 0, and the current index 1 was originally at index 64. * * @param samplingLevel the current sampling level for the index summary * * @return a list of original indexes for current summary entries */ public static List<Integer> getOriginalIndexes(int samplingLevel) { List<Integer> originalIndexes = originalIndexCache.get(samplingLevel); if (originalIndexes != null) return originalIndexes; List<Integer> pattern = getSamplingPattern(BASE_SAMPLING_LEVEL).subList(0, BASE_SAMPLING_LEVEL - samplingLevel); originalIndexes = new ArrayList<>(samplingLevel); for (int j = 0; j < BASE_SAMPLING_LEVEL; j++) { if (!pattern.contains(j)) originalIndexes.add(j); } originalIndexCache.put(samplingLevel, originalIndexes); return originalIndexes; }
/** * Returns a list that can be used to translate current index summary indexes to their original index before * downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) * * For example, if [0, 64] is returned, the current index summary entry at index 0 was originally * at index 0, and the current index 1 was originally at index 64. * * @param samplingLevel the current sampling level for the index summary * * @return a list of original indexes for current summary entries */ public static List<Integer> getOriginalIndexes(int samplingLevel) { List<Integer> originalIndexes = originalIndexCache.get(samplingLevel); if (originalIndexes != null) return originalIndexes; List<Integer> pattern = getSamplingPattern(BASE_SAMPLING_LEVEL).subList(0, BASE_SAMPLING_LEVEL - samplingLevel); originalIndexes = new ArrayList<>(samplingLevel); for (int j = 0; j < BASE_SAMPLING_LEVEL; j++) { if (!pattern.contains(j)) originalIndexes.add(j); } originalIndexCache.put(samplingLevel, originalIndexes); return originalIndexes; }
/** * Returns a list that can be used to translate current index summary indexes to their original index before * downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) * * For example, if [0, 64] is returned, the current index summary entry at index 0 was originally * at index 0, and the current index 1 was originally at index 64. * * @param samplingLevel the current sampling level for the index summary * * @return a list of original indexes for current summary entries */ public static List<Integer> getOriginalIndexes(int samplingLevel) { List<Integer> originalIndexes = originalIndexCache.get(samplingLevel); if (originalIndexes != null) return originalIndexes; List<Integer> pattern = getSamplingPattern(BASE_SAMPLING_LEVEL).subList(0, BASE_SAMPLING_LEVEL - samplingLevel); originalIndexes = new ArrayList<>(samplingLevel); for (int j = 0; j < BASE_SAMPLING_LEVEL; j++) { if (!pattern.contains(j)) originalIndexes.add(j); } originalIndexCache.put(samplingLevel, originalIndexes); return originalIndexes; }
List<Integer> ordering = getSamplingPattern(samplingLevel/2); List<Integer> startIndices = new ArrayList<>(samplingLevel);
List<Integer> ordering = getSamplingPattern(samplingLevel/2); List<Integer> startIndices = new ArrayList<>(samplingLevel);
List<Integer> ordering = getSamplingPattern(samplingLevel/2); List<Integer> startIndices = new ArrayList<>(samplingLevel);
List<Integer> ordering = getSamplingPattern(samplingLevel/2); List<Integer> startIndices = new ArrayList<>(samplingLevel);