it.unimi.dsi.fastutil.ints.Int2IntArrayMap Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.ints.Int2IntArrayMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubsettedLikelihoodMatrix.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SubsettedLikelihoodMatrix(final LikelihoodMatrix<A> matrix, final List<A> alleles) { this.matrix = Utils.nonNull(matrix); this.alleles = Utils.nonNull(alleles); final int[] newIndices = new IndexRange(0, alleles.size()).mapToInteger(n -> n); final int[] oldIndices = alleles.stream().mapToInt(matrix::indexOfAllele).toArray(); Utils.validateArg(Arrays.stream(oldIndices).noneMatch(n -> n < 0), "All alleles must be found in likelihoods matrix"); newToOldIndexMap = new Int2IntArrayMap(newIndices, oldIndices); }
Example #2
Source File: SubsettedLikelihoodMatrix.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SubsettedLikelihoodMatrix(final LikelihoodMatrix<EVIDENCE, A> matrix, final List<A> alleles) { this.matrix = Utils.nonNull(matrix); this.alleles = Utils.nonNull(alleles); final int[] newIndices = new IndexRange(0, alleles.size()).mapToInteger(n -> n); final int[] oldIndices = alleles.stream().mapToInt(matrix::indexOfAllele).toArray(); Utils.validateArg(Arrays.stream(oldIndices).noneMatch(n -> n < 0), "All alleles must be found in likelihoods matrix"); newToOldIndexMap = new Int2IntArrayMap(newIndices, oldIndices); }
Example #3
Source File: FindCoversGenerator.java From metanome-algorithms with Apache License 2.0 | 4 votes |
private IntList generateInitialOrdering(List<DifferenceSet> tempDiffSet) { IntList result = new IntArrayList(); Int2IntMap counting = new Int2IntArrayMap(); for (DifferenceSet ds : tempDiffSet) { int lastIndex = ds.getAttributes().nextSetBit(0); while (lastIndex != -1) { if (!counting.containsKey(lastIndex)) { counting.put(lastIndex, 1); } else { counting.put(lastIndex, counting.get(lastIndex) + 1); } lastIndex = ds.getAttributes().nextSetBit(lastIndex + 1); } } // TODO: Comperator und TreeMap --> Tommy while (true) { if (counting.size() == 0) { break; } int biggestAttribute = -1; int numberOfOcc = 0; for (int attr : counting.keySet()) { if (biggestAttribute < 0) { biggestAttribute = attr; numberOfOcc = counting.get(attr); continue; } int tempOcc = counting.get(attr); if (tempOcc > numberOfOcc) { numberOfOcc = tempOcc; biggestAttribute = attr; } else if (tempOcc == numberOfOcc) { if (biggestAttribute > attr) { biggestAttribute = attr; } } } if (numberOfOcc == 0) { break; } result.add(biggestAttribute); counting.remove(biggestAttribute); } return result; }
Example #4
Source File: FindCoversGenerator.java From metanome-algorithms with Apache License 2.0 | 4 votes |
private IntList generateNextOrdering(List<DifferenceSet> next, IntList currentOrdering, int attribute) { IntList result = new IntArrayList(); Int2IntMap counting = new Int2IntArrayMap(); boolean seen = false; for (int i = 0; i < currentOrdering.size(); i++) { if (!seen) { if (currentOrdering.getInt(i) == attribute) { seen = true; } } else { counting.put(currentOrdering.getInt(i), 0); for (DifferenceSet ds : next) { if (ds.getAttributes().get(currentOrdering.getInt(i))) { counting.put(currentOrdering.getInt(i), counting.get(currentOrdering.getInt(i)) + 1); } } } } // TODO: Comperator und TreeMap --> Tommy while (true) { if (counting.size() == 0) { break; } int biggestAttribute = -1; int numberOfOcc = 0; for (int attr : counting.keySet()) { if (biggestAttribute < 0) { biggestAttribute = attr; numberOfOcc = counting.get(attr); continue; } int tempOcc = counting.get(attr); if (tempOcc > numberOfOcc) { numberOfOcc = tempOcc; biggestAttribute = attr; } else if (tempOcc == numberOfOcc) { if (biggestAttribute > attr) { biggestAttribute = attr; } } } if (numberOfOcc == 0) { break; } result.add(biggestAttribute); counting.remove(biggestAttribute); } return result; }
Example #5
Source File: AnchorTernaryTrie.java From tagme with Apache License 2.0 | 4 votes |
public static Anchor fake(String w){ Int2IntMap links = new Int2IntArrayMap(); links.put(0, w.length()); return Anchor.build(0, links, w.length(), new IntArraySet()); }