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


Java IntArrayList.size方法代码示例

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


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

示例1: computeScores

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
static double[][] computeScores(EnrichmentLandscape result,
                                int totalAttributes,
                                IntArrayList attributeIndexes,
                                int typeIndex) {

    ScoringFunction score = Neighborhood.getScoringFunction(typeIndex);
    List<? extends Neighborhood> neighborhoods = result.getNeighborhoods();
    int filteredAttributes = attributeIndexes.size();
    double[][] scores = new double[filteredAttributes][];
    IntStream.range(0, filteredAttributes)
             .parallel()
             .forEach(filteredIndex -> {
                 int attributeIndex = attributeIndexes.get(filteredIndex);
                 scores[filteredIndex] = neighborhoods.stream()
                                                      .mapToDouble(n -> score.get(n, attributeIndex))
                                                      .toArray();
             });
    return scores;
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:20,代码来源:ClusterBasedGroupingMethod.java

示例2: mdsAlg

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public AbstractMDSResult mdsAlg(Graph g) {
	ThreadMXBean bean = ManagementFactory.getThreadMXBean();
	long start = bean.getCurrentThreadCpuTime();
	IntArrayList W = new IntArrayList(g.getVertices());
	prepTime = bean.getCurrentThreadCpuTime() - start;
	Integer[] sorted = new Integer[W.size()];
	for (int i = 0; i < W.size(); i++) {
		sorted[i] = Integer.valueOf(W.buffer[i]);
	}
	Arrays.sort(sorted, new LessByN1AComparator(g));
	for (int i = 0; i < W.size(); i++) {
		W.buffer[i] = sorted[i].intValue();
	}
	IntOpenHashSet S = new IntOpenHashSet(W.size() / 10);
	while (!W.isEmpty()) {
		int pick = W.get(W.size() - 1);
		W.removeAll(g.getN1(pick));
		S.add(pick);
	}
	runTime = bean.getCurrentThreadCpuTime() - start;
	MDSResultBackedByIntOpenHashSet result = new MDSResultBackedByIntOpenHashSet();
	result.setResult(S);
	return result;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:26,代码来源:GreedyQuickAlgorithm.java

示例3: getSortedUnprocessedNodes

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
/**
 * Returns all transformations that do not have the given property and sorts the resulting array
 * according to the strategy.
 *
 * @param level The level which is to be sorted
 * @param triggerSkip The trigger to be used for limiting the number of nodes to be sorted
 * @return A sorted array of nodes remaining on this level
 */
private int[] getSortedUnprocessedNodes(int level, DependentAction triggerSkip) {

    // Create
    IntArrayList list = new IntArrayList();
    for (LongIterator iter = solutionSpace.unsafeGetLevel(level); iter.hasNext();) {
        long id = iter.next();
        if (!skip(triggerSkip, solutionSpace.getTransformation(id))) {
            list.add((int)id);
        }            
    }

    // Copy & sort
    int[] array = new int[list.size()];
    System.arraycopy(list.buffer, 0, array, 0, list.elementsCount);
    sort(array);
    return array;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:26,代码来源:FLASHAlgorithmImpl.java

示例4: ShardFetchRequest

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public ShardFetchRequest(SearchScrollRequest request, long id, IntArrayList list, ScoreDoc lastEmittedDoc) {
    super(request);
    this.id = id;
    this.docIds = list.buffer;
    this.size = list.size();
    this.lastEmittedDoc = lastEmittedDoc;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:ShardFetchRequest.java

示例5: getFields

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
WrappedSootField[] getFields() {
	if (graph == null || graph.getVertices().size() == 0) {
		return new WrappedSootField[] { intToField(entryNode) };
	}

	IntArrayList shortestPath = getShortestPath(entryNode, targetNode);
	WrappedSootField[] out = new WrappedSootField[shortestPath.size()];
	int i = 0;
	for (IntCursor p : shortestPath) {
		out[i] = intToField(p.value);
		i++;
	}
	return out;
}
 
开发者ID:themaplelab,项目名称:boomerang,代码行数:15,代码来源:FieldGraph.java

示例6: convertToInt

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
protected static int[] convertToInt(IntArrayList trainSet) {
  int[] train = new int[trainSet.size()];
  int a = 0;
  for (IntCursor i : trainSet) {
    train[a++] = i.value;
  }
  return train;
}
 
开发者ID:patrickzib,项目名称:SFA,代码行数:9,代码来源:Classifier.java

示例7: execute

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public int execute(int i) {
	list = new IntArrayList(0);
       for (int j = 0; j < i; j++) {
           list.add(j);
       }
       
	return list.size();
}
 
开发者ID:marcotc,项目名称:java-collection-benchmark,代码行数:10,代码来源:Hppc.java

示例8: computeExpectations

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][][] xis;
  IntArrayList cache = new IntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattices.get(i).getInput();
    SumLattice lattice = lattices.get(i);
    xis = lattice.getXis();
    for (int ip = 1; ip < fvs.size(); ++ip) {
      cache.clear();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraintsMap.containsKey(fi)) {
          cache.add(constraintsMap.get(fi));
        }
      }
      for (int prev = 0; prev < map.getNumStates(); ++prev) {
        int liPrev = map.getLabelIndex(prev);
        if (liPrev != StateLabelMap.START_LABEL) {
          for (int curr = 0; curr < map.getNumStates(); ++curr) {
            int liCurr = map.getLabelIndex(curr);
            if (liCurr != StateLabelMap.START_LABEL) {
              double prob = Math.exp(xis[ip][prev][curr]);
              for (int j = 0; j < cache.size(); j++) {
                constraintsList.get(cache.get(j)).expectation[liPrev][liCurr] += prob;
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:37,代码来源:TwoLabelGEConstraints.java

示例9: computeExpectations

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][] gammas;    
  IntArrayList cache = new IntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    SumLattice lattice = lattices.get(i);
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattice.getInput();
    gammas = lattice.getGammas();
    for (int ip = 0; ip < fvs.size(); ++ip) {
      cache.clear();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraints.containsKey(fi)) {
          cache.add(fi);
        }
      }
      if (constraints.containsKey(fv.getAlphabet().size())) {
        cache.add(fv.getAlphabet().size());
      }
      for (int s = 0; s < map.getNumStates(); ++s) {
        int li = map.getLabelIndex(s);
        if (li != StateLabelMap.START_LABEL) {
          double gammaProb = Math.exp(gammas[ip+1][s]);
          for (int j = 0; j < cache.size(); j++) {
            constraints.get(cache.get(j)).incrementExpectation(li,gammaProb);
          }
        }
      }
    }
  }
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:35,代码来源:OneLabelL2RangeGEConstraints.java

示例10: computeExpectations

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][] gammas;    
  IntArrayList cache = new IntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    SumLattice lattice = lattices.get(i);
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattice.getInput();
    gammas = lattice.getGammas();
    for (int ip = 0; ip < fvs.size(); ++ip) {
      cache.clear();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraints.containsKey(fi)) {
          cache.add(fi);
        }
      }
      if (constraints.containsKey(fv.getAlphabet().size())) {
        cache.add(fv.getAlphabet().size());
      }
      for (int s = 0; s < map.getNumStates(); ++s) {
        int li = map.getLabelIndex(s);
        if (li != StateLabelMap.START_LABEL) {
          double gammaProb = Math.exp(gammas[ip+1][s]);
          for (int j = 0; j < cache.size(); j++) {
            constraints.get(cache.get(j)).expectation[li] += gammaProb;
          }
        }
      }
    }
  }
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:35,代码来源:OneLabelGEConstraints.java

示例11: shuffle

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private void shuffle(IntArrayList arrayList) {
  for (int i = arrayList.size() - 1; i > 0; i--) {
    int index = random.nextInt(i + 1);
    // Swap
    int value = arrayList.get(index);
    arrayList.set(index,arrayList.get(i));
    arrayList.set(i, value);
  }
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:10,代码来源:GreedyAgglomerativeByDensity.java

示例12: getBinaryLabels

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
/** @return an array of 1 or -1. */
protected byte[] getBinaryLabels(IntArrayList ys, int currLabel)
{
	int i, size = ys.size();
	byte[] aY = new byte[size];
	
	for (i=0; i<size; i++)
		aY[i] = (ys.get(i) == currLabel) ? (byte)1 : (byte)-1;
		
	return aY;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:12,代码来源:AbstractOneVsAll.java

示例13: gms

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private IntOpenHashSet gms(IntArrayList choiceVertex,
		IntOpenHashSet chosenVertices, Graph g) {
	if (choiceVertex.size() == 0) {
		// we have made our choice - let's compute it
		IntOpenHashSet neighbours = new IntOpenHashSet(chosenVertices.size() << 1);
		for (IntCursor vertex : chosenVertices) {
			neighbours.addAll(g.getN1(vertex.value));
		}
		/*
		 * for (Integer l : chosenVertices) { System.out.print(l);
		 * System.out.print(" "); } System.out.print(" --> "); for (Integer l :
		 * neighbours) { System.out.print(l); System.out.print(" "); }
		 */
		if (neighbours.size() == g.getNumberOfVertices()) {
			// System.out.println("*");
			return chosenVertices;
		} else {
			// System.out.println("");
			return null;
		}
	} else {
		int v = choiceVertex.get(choiceVertex.size() - 1);
		IntArrayList ch = new IntArrayList(choiceVertex);
		ch.remove(choiceVertex.size() - 1);

		// choose vertices
		// don't choose current
		IntOpenHashSet set1 = gms(ch, chosenVertices, g);
		// choose current
		IntOpenHashSet chV = new IntOpenHashSet(chosenVertices);
		chV.add(v);
		IntOpenHashSet set2 = gms(ch, chV, g);
		if (set1 == null)
			return set2;
		if ((set2 != null) && (set2.size() <= set1.size()))
			return set2;
		return set1;
	}
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:40,代码来源:NaiveAlgorithm.java

示例14: ShardFetchRequest

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public ShardFetchRequest(long id, IntArrayList list, ScoreDoc lastEmittedDoc) {
    this.id = id;
    this.docIds = list.buffer;
    this.size = list.size();
    this.lastEmittedDoc = lastEmittedDoc;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:ShardFetchRequest.java

示例15: createForArrays

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public static PairedIntShortArrayListPermutationProxy createForArrays(
    final IntArrayList intArr, final ShortArrayList shortArr) {
  return new PairedIntShortArrayListPermutationProxy(intArr, shortArr,
      0, intArr.size());
}
 
开发者ID:BBN-E,项目名称:bue-common-open,代码行数:6,代码来源:PairedIntShortArrayListPermutationProxy.java


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