当前位置: 首页>>代码示例>>Java>>正文


Java IntList.size方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntList.size方法的典型用法代码示例。如果您正苦于以下问题:Java IntList.size方法的具体用法?Java IntList.size怎么用?Java IntList.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.ints.IntList的用法示例。


在下文中一共展示了IntList.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:23,代码来源:FeatureKnnModel.java

示例2: 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();
}
 
开发者ID:RankSys,项目名称:RankSys,代码行数:29,代码来源:GreedyReranker.java

示例3: readDeltaItShouldReadExpectedValues

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
@Test
public void readDeltaItShouldReadExpectedValues() throws IOException {
    final IntList expectedValues = new IntArrayList(new int[] {17, 4, 6});
    /**
     * 18        5     7     Increment one.
     * 10010     101   111   Binary representation.
     * 5-0010    3-01  3-11  Decimal Gamma Prefix and Binary Gamma Suffix.
     * 101-0010  11-01 11-11 Binary Gamma Prefix and Binary Gamma Suffix.
     * 001010010 01101 01111 Delta Encoding.
     */
    final Helper.Input input = getInput("001010010 01101 01111");
    final InputBitStream inputStream = new InputBitStream(input.buffer);
    final IntList values = new IntArrayList();

    for (int i = 0; i < expectedValues.size(); i++) {
        values.add(inputStream.readDelta());
    }

    assertEquals(expectedValues, values);
}
 
开发者ID:groupon,项目名称:pebble,代码行数:21,代码来源:InputBitStreamReadDeltaTest.java

示例4: readGammaItShouldReadExpectedValues

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
@Test
public void readGammaItShouldReadExpectedValues() throws IOException {
    final IntList expectedValues = new IntArrayList(new int[] {17, 4, 6});
    /**
     * 18        5     7     Increment one.
     * 10010     101   111   Binary representation.
     * 5-0010    3-01  3-11  Decimal Gamma Prefix and Binary Gamma Suffix.
     * 000010010 00101 00111 Gamma Encoding.
     */
    final Helper.Input input = getInput("000010010 00101 00111");
    final InputBitStream inputStream = new InputBitStream(input.buffer);
    final IntList values = new IntArrayList();

    for (int i = 0; i < expectedValues.size(); i++) {
        values.add(inputStream.readGamma());
    }

    assertEquals(expectedValues, values);
}
 
开发者ID:groupon,项目名称:pebble,代码行数:20,代码来源:InputBitStreamReadGammaTest.java

示例5: checkNoProvoking

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
private static boolean checkNoProvoking(IntList indices, int faceSize, int pos) {
	int usedId=indices.getInt(pos);
	for(int i=0;i<indices.size();i+=faceSize) {
		if(indices.getInt(i)==usedId)return false;
	}
	return true;
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:8,代码来源:ModelUtil.java

示例6: uncompress

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
public static float[] uncompress(float[] dest, FloatList data, IntList indices, int partSize){
	int counter=0;
	for(int i=0;i<indices.size();i++){
		int pos=indices.getInt(i)*partSize;
		
		for(int j=0;j<partSize;j++){
			dest[counter++]=data.getFloat(pos+j);
		}
	}
	
	return dest;
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:13,代码来源:ModelUtil.java

示例7: increaseMeasure

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
private void increaseMeasure(final IntList measureList, final int level) {
  if (measureList.size() > level - 1) {
    final int prev = measureList.getInt(level - 1);
    measureList.set(level - 1, prev + 1);
  } else {
    final int skippedLevels = level - measureList.size() - 1;
    // add 0 for no application of the pruning rule in the skipped levels
    for (int i = 0; i < skippedLevels; i++) {
      measureList.add(0);
    }
    // add 1 for one application of the pruning rule in the new level
    measureList.add(1);
  }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:15,代码来源:Statistics.java

示例8: doRecusiveCrap

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
private void doRecusiveCrap(int currentAttribute, IntList currentOrdering, List<DifferenceSet> setsNotCovered,
                            IntList currentPath, List<DifferenceSet> originalDiffSet, List<FunctionalDependencyGroup2> result)
        throws CouldNotReceiveResultException, ColumnNameMismatchException {

    // Basic Case
    // FIXME
    if (!currentOrdering.isEmpty() && /* BUT */setsNotCovered.isEmpty()) {
        if (this.debugSysout)
            System.out.println("no FDs here");
        return;
    }

    if (setsNotCovered.isEmpty()) {

        List<OpenBitSet> subSets = this.generateSubSets(currentPath);
        if (this.noOneCovers(subSets, originalDiffSet)) {
            FunctionalDependencyGroup2 fdg = new FunctionalDependencyGroup2(currentAttribute, currentPath);
            this.addFdToReceivers(fdg);
            result.add(fdg);
        } else {
            if (this.debugSysout) {
                System.out.println("FD not minimal");
                System.out.println(new FunctionalDependencyGroup2(currentAttribute, currentPath));
            }
        }

        return;
    }

    // Recusive Case
    for (int i = 0; i < currentOrdering.size(); i++) {

        List<DifferenceSet> next = this.generateNextNotCovered(currentOrdering.getInt(i), setsNotCovered);
        IntList nextOrdering = this.generateNextOrdering(next, currentOrdering, currentOrdering.getInt(i));
        IntList currentPathCopy = new IntArrayList(currentPath);
        currentPathCopy.add(currentOrdering.getInt(i));
        this.doRecusiveCrap(currentAttribute, nextOrdering, next, currentPathCopy, originalDiffSet, result);
    }

}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:41,代码来源:FindCoversGenerator.java

示例9: sum

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
private int sum(IntList list) {
	int result = 0;
	int size = list.size();
	for (int i = 0; i < size; ++i) {
		result += list.getInt(i);
	}
	return result;
}
 
开发者ID:gpanther,项目名称:itdays-2016-cpu-workshop,代码行数:9,代码来源:_01_b_ListSum.java

示例10: add

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
/**
 * Adds to the store the <code>list</code>. In case the store is full it will overwrite the oldest list on the
 * store.
 *
 * @param offset position of the <code>list</code> respect to the list of lists, starting from zero.
 * @param recursiveReferences number of recursive reference of the <code>list</code>.
 * @param list to append to the store.
 * @return true when the <code>list</code> is added to the store and false when is not.
 */
public boolean add(final int offset, final int recursiveReferences, final IntList list) {
    if (recursiveReferences <= maxRecursiveReferences && minListSize <= list.size()) {
        if (lists[index] != null) {
            referenceListIndex.removeListFromListsInvertedIndex(index, lists[index]);
        }
        this.recursiveReferences[index] = recursiveReferences;
        offsets[index] = offset;
        lists[index] = new IntArrayList(list);
        referenceListIndex.addListIntoListsInvertedIndex(index, lists[index]);
        index = (index + 1) % offsets.length;
        return true;
    }
    return false;
}
 
开发者ID:groupon,项目名称:pebble,代码行数:24,代码来源:IntReferenceListsStore.java

示例11: readUnaryItShouldReadExpectedValues

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
@Test
public void readUnaryItShouldReadExpectedValues() throws IOException {
    final IntList expectedValues = new IntArrayList(new int[] {17, 4, 6});
    final Helper.Input input = getInput("00000000000000001 0001 000001");
    final InputBitStream inputStream = new InputBitStream(input.buffer);
    final IntList values = new IntArrayList();

    for (int i = 0; i < expectedValues.size(); i++) {
        values.add(inputStream.readUnary());
    }

    assertEquals(expectedValues, values);
}
 
开发者ID:groupon,项目名称:pebble,代码行数:14,代码来源:InputBitStreamReadUnaryTest.java

示例12: itShouldReadExpectedValues

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
@Test
public void itShouldReadExpectedValues() throws IOException {
    final IntList expectedValues = new IntArrayList(new int[] {1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1});
    final Helper.Input input = getInput("1 1 0 1 0 0 1 0 0 0 0 1");
    final InputBitStream inputStream = new InputBitStream(input.buffer);
    final IntList values = new IntArrayList();

    for (int i = 0; i < expectedValues.size(); i++) {
        values.add(inputStream.readBit());
    }

    assertEquals(expectedValues, values);
}
 
开发者ID:groupon,项目名称:pebble,代码行数:14,代码来源:InputBitStreamReadBitTest.java

示例13: generateNextOrdering

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
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) {
                    continue;
                } else {
                    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;
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:65,代码来源:FindCoversGenerator.java

示例14: add

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
public void add(IntList idxList, List<double[]> resps) {
    for (int i=0; i<idxList.size(); i++) {
        add(idxList.getInt(i), resps);
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:6,代码来源:MeanDivergence.java

示例15: remove

import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
public void remove(IntList idxList, List<double[]> resps) {
    for (int i=0; i<idxList.size(); i++) {
        remove(idxList.getInt(i), resps);
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:6,代码来源:MeanDivergence.java


注:本文中的it.unimi.dsi.fastutil.ints.IntList.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。