List of usage examples for edu.stanford.nlp.util ArrayUtils toPrimitive
public static double[] toPrimitive(Double[] in)
From source file:structure.matrix.SparseMatrix.java
License:Open Source License
public int[] selectRow(int threshold) { List<Integer> list = Lists.newArrayList(); for (int i = 0; i < numRows; i++) { int nnz = rowPtr[i + 1] - rowPtr[i]; if (nnz >= threshold) list.add(i);//from ww w . ja v a2s. com } Integer[] select = new Integer[list.size()]; list.toArray(select); return ArrayUtils.toPrimitive(select); }
From source file:structure.matrix.SparseMatrix.java
License:Open Source License
public int[] selectColumn(int threshold) { List<Integer> list = Lists.newArrayList(); for (int i = 0; i < numColumns; i++) { int nnz = colPtr[i + 1] - colPtr[i]; if (nnz >= threshold) list.add(i);/*from w ww .j a v a 2 s .co m*/ } Integer[] select = new Integer[list.size()]; list.toArray(select); return ArrayUtils.toPrimitive(select); }
From source file:structure.matrix.SparseMatrix.java
License:Open Source License
private int[] randSequence(int num, int total) { List<Integer> list = Lists.newArrayList(); for (int i = 0; i < total; i++) list.add(i);//from ww w . j a va2 s .co m Collections.shuffle(list); List<Integer> sub = list.subList(0, num); Integer[] array = new Integer[num]; sub.toArray(array); return ArrayUtils.toPrimitive(array); }