本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntList类的典型用法代码示例。如果您正苦于以下问题:Java IntList类的具体用法?Java IntList怎么用?Java IntList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntList类属于it.unimi.dsi.fastutil.ints包,在下文中一共展示了IntList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: triangulateSingleNum
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
public static void triangulateSingleNum(IntList data, List<int[]> idsVert){
IntList dataNew=new IntArrayList(idsVert.size());
int count=0;
for(int[] face:idsVert){
dataNew.add(data.getInt(count));
dataNew.add(data.getInt(count+1));
dataNew.add(data.getInt(count+2));
if(face.length>3){
dataNew.add(data.getInt(count));
dataNew.add(data.getInt(count+2));
dataNew.add(data.getInt(count+3));
}
count+=face.length;
}
data.clear();
data.addAll(dataNew);
}
示例2: executePara
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
private void executePara(int attribute) throws CouldNotReceiveResultException, ColumnNameMismatchException {
for (OpenBitSet lhs : this.lhss.get(attribute)) {
if (lhs.get(attribute)) {
continue;
}
IntList bits = new IntArrayList();
int lastIndex = lhs.nextSetBit(0);
while (lastIndex != -1) {
bits.add(lastIndex);
lastIndex = lhs.nextSetBit(lastIndex + 1);
}
FunctionalDependencyGroup2 fdg = new FunctionalDependencyGroup2(attribute, bits);
this.fdrr.receiveResult((fdg.buildDependency(this.relationName, this.columns)));
this.result.add(fdg);
}
}
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:19,代码来源:FunctionalDependencyGenerator.java
示例3: output
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
private void output() throws CouldNotReceiveResultException, ColumnNameMismatchException {
// Read the discovered INDs from the attributes
Int2ObjectOpenHashMap<IntList> dep2ref = new Int2ObjectOpenHashMap<IntList>(this.numColumns);
for (Attribute spiderAttribute : this.attributeId2attributeObject.values())
if (!spiderAttribute.getReferenced().isEmpty())
dep2ref.put(spiderAttribute.getAttributeId(), new IntArrayList(spiderAttribute.getReferenced()));
// Write the result to the resultReceiver
for (int dep : dep2ref.keySet()) {
String depTableName = this.getTableNameFor(dep, this.tableColumnStartIndexes);
String depColumnName = this.columnNames.get(dep);
for (int ref : dep2ref.get(dep)) {
String refTableName = this.getTableNameFor(ref, this.tableColumnStartIndexes);
String refColumnName = this.columnNames.get(ref);
this.resultReceiver.receiveResult(new InclusionDependency(new ColumnPermutation(new ColumnIdentifier(depTableName, depColumnName)), new ColumnPermutation(new ColumnIdentifier(refTableName, refColumnName))));
this.numUnaryINDs++;
}
}
}
示例4: getRequiredListOfInteger
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
/**
* @return a IntList from the input JsonNode with the given name, or throw an BadRequestException
*/
public static IntList getRequiredListOfInteger(JsonNode json, String name) throws BadRequestException {
final JsonNode node = json.get(name);
if (node == null || !(node.isArray())) {
throw new BadRequestException("json is missing required List: " + name);
}
final IntList list = new IntArrayList(node.size());
for (JsonNode innerNode : node) {
if (!innerNode.canConvertToInt()) {
throw new BadRequestException("json is not an int: " + innerNode.toString());
}
list.add(innerNode.asInt());
}
return list;
}
示例5: featurize
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
public LearningInstance featurize(JsonNode entity, boolean update) {
Map<String, List<Feature>> feaMap = FeaturizerUtilities.getFeatureMap(entity, true,
featureExtractors, indexSpace);
String group = null;
if (groupKeys != null && groupKeys.size() > 0) {
group = FeatureExtractorUtilities.composeConcatenatedKey(entity, groupKeys);
}
TensorFlowInstance instance = new TensorFlowInstance(group);
for (Map.Entry<String, List<Feature>> entry : feaMap.entrySet()) {
DoubleList doubles = new DoubleArrayList();
IntList ints = new IntArrayList();
for (Feature feature : entry.getValue()) {
doubles.add(feature.getValue());
ints.add(feature.getIndex());
}
double[] darr = doubles.toDoubleArray();
instance.putValues(entry.getKey(), darr);
int[] iarr = ints.toIntArray();
instance.putIndices(entry.getKey(), iarr);
}
return instance;
}
示例6: getNeighbors
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
private List<double[]> getNeighbors(int curIndex, IntList svdIndices,
SVDFeature svdFeature,
List<String> features) {
List<double[]> raw = new ArrayList<>(svdIndices.size());
for (int target : svdIndices) {
if (target != curIndex && (numMatch == 0 || matchPrefixFeatures(curIndex, target, features))) {
double[] pair = new double[2];
pair[0] = target;
pair[1] = svdFeature.getVectorVarByNameIndex(SVDFeatureKey.FACTORS.get(), target)
.cosine(svdFeature.getVectorVarByNameIndex(SVDFeatureKey.FACTORS.get(), curIndex));
raw.add(pair);
}
}
Ordering<double[]> pairDoubleOrdering = SortingUtilities.pairDoubleSecondOrdering();
List<double[]> neighbors;
if (reverse) {
neighbors = pairDoubleOrdering.leastOf(raw, numNeighbors);
} else {
neighbors = pairDoubleOrdering.greatestOf(raw, numNeighbors);
}
return neighbors;
}
示例7: rerankPermutation
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
/**
* Returns the permutation to obtain the re-ranking
*
* @return permutation to obtain the re-ranking
*/
public int[] rerankPermutation() {
List<Tuple2od<I>> list = recommendation.getItems();
IntList perm = new IntArrayList();
IntLinkedOpenHashSet remainingI = new IntLinkedOpenHashSet();
IntStream.range(0, list.size()).forEach(remainingI::add);
while (!remainingI.isEmpty() && perm.size() < min(maxLength, cutoff)) {
int bestI = selectItem(remainingI, list);
perm.add(bestI);
remainingI.remove(bestI);
update(list.get(bestI));
}
while (perm.size() < min(maxLength, list.size())) {
perm.add(remainingI.removeFirstInt());
}
return perm.toIntArray();
}
示例8: whenThereIsNotIntervalsOnListItShouldWriteIntervalsSuccinctRepresentationSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenThereIsNotIntervalsOnListItShouldWriteIntervalsSuccinctRepresentationSuccessfully()
throws Exception
{
final int valueBitSize = 1;
final IntList list = new IntArrayList(new int[] {1, 2, 3, 5, 6, 7, 10, 11, 16, 19});
final String expectedOutput = "1".replace(" ", "");
final int expectedOffset = 1;
final Helper.Output out = getOutput();
final int offset = out.stream.writeIntervals(list, valueBitSize);
out.close();
assertEquals(expectedOutput, toBinaryString(out.buffer, offset));
assertEquals(expectedOffset, offset);
}
示例9: whenListIsSmallerThanMinIntervalSizeItShouldWriteIntervalsSuccinctRepresentationSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenListIsSmallerThanMinIntervalSizeItShouldWriteIntervalsSuccinctRepresentationSuccessfully()
throws Exception
{
final int valueBitSize = 1;
final IntList list = new IntArrayList(new int[] {1, 3, 4});
final String expectedOutput = "1".replace(" ", "");
final int expectedOffset = 1;
final Helper.Output out = getOutput();
final int offset = out.stream.writeIntervals(list, valueBitSize);
out.close();
assertEquals(expectedOutput, toBinaryString(out.buffer, offset));
assertEquals(expectedOffset, offset);
}
示例10: whenThereIsIntervalsOnListItShouldWriteIntervalsSuccinctRepresentationSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenThereIsIntervalsOnListItShouldWriteIntervalsSuccinctRepresentationSuccessfully() throws Exception {
final int valueBitSize = 3;
final IntList list = new IntArrayList(
new int[] {1, 3, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 30}
);
/**
* 3 [7, 8, 9, 10] [14, 15, 16, 17] [19, 20, 21, 22, 23, 24] Intervals from list.
* 3 [7, 10] [14, 17] [19, 24] Interval format.
* 3 [7, 0] [2, 0] [0, 2] Interval delta format.
* 4 7 1 3 1 1 3 Add 1 to ensure non zeros.
* 001 111 1 11 1 1 11 Binary representation.
* 3-00 111 1 2-1 1 1 2-1 Decimal Gamma Prefix and Binary Gamma Suffix.
* 11-00 111 1 01-1 1 1 01-1 Binary Gamma Prefix and Binary Gamma Suffix.
* 01100 111 1 0101 1 1 0101 Delta Encoding.
*/
final String expectedOutput = "01100 111 1 0101 1 1 0101".replace(" ", "");
final int expectedOffset = 19;
final Helper.Output out = getOutput();
final int offset = out.stream.writeIntervals(list, valueBitSize);
out.close();
assertEquals(expectedOutput, toBinaryString(out.buffer, offset));
assertEquals(expectedOffset, offset);
}
示例11: whenReferenceListLastElementsMatchesWithListShouldRecoverListSegmentOnReferenceListSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenReferenceListLastElementsMatchesWithListShouldRecoverListSegmentOnReferenceListSuccessfully()
throws Exception
{
final Helper.Input input = getInput("0100 01100 0 1 0101 1");
final int listIndex = 1;
final IntList referenceList = new IntArrayList(new int[] {0, 2, 3, 5, 9, 12, 13});
final IntList expectedList = new IntArrayList(new int[] {2, 3, 5, 12, 13});
final IntList list = new IntArrayList();
ReferenceIterator referenceIterator = new ReferenceIteratorBuilder(input, listIndex, referenceList).build();
while (referenceIterator.hasNext()) {
list.add(referenceIterator.next());
}
assertEquals(expectedList, list);
}
示例12: whenThereIsAnEncodedRepetitionsListItShouldReturnExpectedRemainingElementsSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenThereIsAnEncodedRepetitionsListItShouldReturnExpectedRemainingElementsSuccessfully()
throws Exception
{
final int originalListSize = 16;
Helper.Input input = getInput("01110 1 1 0100 0100 0100 1 0101 1 0100 1");
/**
* (0, 2), (2, 3), (4, 2), (7, 2), (9, 2) Repetitions
*/
final IntList expectedRemainingElements = new IntArrayList(
new int[] {4, 4, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}
);
final IntList remainingElements = new IntArrayList();
RepeatsIterator repeatsIterator = new RepeatsIterator(input.stream);
for(int i = 0; i < originalListSize; i++) {
remainingElements.add(repeatsIterator.getRemainingElements());
repeatsIterator.next();
}
remainingElements.add(repeatsIterator.getRemainingElements());
assertEquals(expectedRemainingElements, remainingElements);
}
示例13: whenIndexDoesNotHaveAnyPreviousIntersectingListItShouldIndexListAsExpected
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenIndexDoesNotHaveAnyPreviousIntersectingListItShouldIndexListAsExpected() {
final Long2ReferenceMap<IntList> expectedListsInvertedIndex = new Long2ReferenceOpenHashMap<IntList>() {{
put(1L, new IntArrayList(new int[] {0}));
put(3L, new IntArrayList(new int[] {0}));
put(4L, new IntArrayList(new int[] {0}));
put(5L, new IntArrayList(new int[] {0}));
put(8L, new IntArrayList(new int[] {0}));
}};
final InvertedListLongReferenceListsIndex listsIndex = new InvertedListLongReferenceListsIndex();
final int index = 0;
final LongList list = new LongArrayList(new long[] {1L, 3L, 4L, 5L, 8L});
listsIndex.addListIntoListsInvertedIndex(index, list);
assertEquals(
Helper.<Long, Long2ReferenceMap<IntList>>translateToUtilsCollection(expectedListsInvertedIndex),
Helper.<Long, Long2ReferenceMap<IntList>>translateToUtilsCollection(listsIndex.listsInvertedIndex)
);
}
开发者ID:groupon,项目名称:pebble,代码行数:20,代码来源:InvertedListLongReferenceListsIndexAddListIntoListsInvertedIndexTest.java
示例14: whenIndexHavePreviousIntersectingListItShouldIndexListAsExpected
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenIndexHavePreviousIntersectingListItShouldIndexListAsExpected() {
final Long2ReferenceMap<IntList> expectedListsInvertedIndex = new Long2ReferenceOpenHashMap<IntList>() {{
put(1L, new IntArrayList(new int[] {1}));
put(2L, new IntArrayList(new int[] {0}));
put(3L, new IntArrayList(new int[] {0, 1}));
put(4L, new IntArrayList(new int[] {1}));
put(5L, new IntArrayList(new int[] {0, 1}));
put(8L, new IntArrayList(new int[] {1}));
}};
final InvertedListLongReferenceListsIndex listsIndex = new InvertedListLongReferenceListsIndex();
listsIndex.listsInvertedIndex.put(2L, new IntArrayList(new int[]{0}));
listsIndex.listsInvertedIndex.put(3L, new IntArrayList(new int[]{0}));
listsIndex.listsInvertedIndex.put(5L, new IntArrayList(new int[]{0}));
final int index = 1;
final LongList list = new LongArrayList(new long[] {1L, 3L, 4L, 5L, 8L});
listsIndex.addListIntoListsInvertedIndex(index, list);
assertEquals(
Helper.<Long, Long2ReferenceMap<IntList>>translateToUtilsCollection(expectedListsInvertedIndex),
Helper.<Long, Long2ReferenceMap<IntList>>translateToUtilsCollection(listsIndex.listsInvertedIndex)
);
}
开发者ID:groupon,项目名称:pebble,代码行数:25,代码来源:InvertedListLongReferenceListsIndexAddListIntoListsInvertedIndexTest.java
示例15: whenRepetitionsItShouldWriteItsSuccinctRepresentationSuccessfully
import it.unimi.dsi.fastutil.ints.IntList; //导入依赖的package包/类
@Test
public void whenRepetitionsItShouldWriteItsSuccinctRepresentationSuccessfully() throws Exception {
final IntList list = new IntArrayList(new int[] {1, 1, 2, 3, 3, 3, 5, 6, 6, 7, 10, 11, 11, 16, 19, 19});
/**
* {(0, 2), (2, 3), (4, 2), (7, 2), (9, 2)} Repetitions Intervals.
* 5 0 0 1 1 1 0 2 0 1 0 Delta Representation.
* 6 1 1 2 2 2 1 3 1 2 1 Add 1 to ensure non zeros.
* 011 1 1 10 10 10 1 11 1 10 1 Binary representation.
* 3-10 1 1 2-0 2-0 2-0 1 2-1 1 2-0 1 Decimal Gamma Prefix and Binary Gamma Suffix
* 11-10 1 1 10-0 10-0 10-0 1 10-1 1 10-0 1 Binary Gamma Prefix and Binary Gamma Suffix
* 01110 1 1 0100 0100 0100 1 0101 1 0100 1 Delta Encoding
*/
final String expectedOutput = "01110 1 1 0100 0100 0100 1 0101 1 0100 1".replace(" ", "");
final int expectedOffset = 30;
final Helper.Output out = getOutput();
final int offset = out.stream.writeRepetitions(list);
out.close();
assertEquals(expectedOutput, toBinaryString(out.buffer, offset));
assertEquals(expectedOffset, offset);
}