Example usage for edu.stanford.nlp.util ArrayUtils toPrimitive

List of usage examples for edu.stanford.nlp.util ArrayUtils toPrimitive

Introduction

In this page you can find the example usage for edu.stanford.nlp.util ArrayUtils toPrimitive.

Prototype

public static double[] toPrimitive(Double[] in) 

Source Link

Usage

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);
}