Search in sources :

Example 1 with DblArray

use of org.apache.sysml.runtime.compress.utils.DblArray in project systemml by apache.

the class CompressedSizeEstimatorSample method getValCounts.

private static HashMap<DblArray, Integer> getValCounts(ReaderColumnSelection sampleRowsReader) {
    HashMap<DblArray, Integer> valsCount = new HashMap<>();
    DblArray val = null;
    Integer cnt;
    while (null != (val = sampleRowsReader.nextRow())) {
        cnt = valsCount.get(val);
        if (cnt == null)
            cnt = 0;
        cnt++;
        valsCount.put(new DblArray(val), cnt);
    }
    return valsCount;
}
Also used : HashMap(java.util.HashMap) DblArray(org.apache.sysml.runtime.compress.utils.DblArray)

Example 2 with DblArray

use of org.apache.sysml.runtime.compress.utils.DblArray in project incubator-systemml by apache.

the class CompressedSizeEstimatorSample method getValCounts.

private static HashMap<DblArray, Integer> getValCounts(ReaderColumnSelection sampleRowsReader) {
    HashMap<DblArray, Integer> valsCount = new HashMap<>();
    DblArray val = null;
    Integer cnt;
    while (null != (val = sampleRowsReader.nextRow())) {
        cnt = valsCount.get(val);
        if (cnt == null)
            cnt = 0;
        cnt++;
        valsCount.put(new DblArray(val), cnt);
    }
    return valsCount;
}
Also used : HashMap(java.util.HashMap) DblArray(org.apache.sysml.runtime.compress.utils.DblArray)

Example 3 with DblArray

use of org.apache.sysml.runtime.compress.utils.DblArray in project incubator-systemml by apache.

the class BitmapEncoder method extractBitmap.

private static UncompressedBitmap extractBitmap(int[] colIndices, MatrixBlock rawblock, ReaderColumnSelection rowReader) {
    // probe map for distinct items (for value or value groups)
    DblArrayIntListHashMap distinctVals = new DblArrayIntListHashMap();
    // scan rows and probe/build distinct items
    DblArray cellVals = null;
    while ((cellVals = rowReader.nextRow()) != null) {
        IntArrayList lstPtr = distinctVals.get(cellVals);
        if (lstPtr == null) {
            // create new objects only on demand
            lstPtr = new IntArrayList();
            distinctVals.appendValue(new DblArray(cellVals), lstPtr);
        }
        lstPtr.appendValue(rowReader.getCurrentRowIndex());
    }
    return new UncompressedBitmap(distinctVals, colIndices.length);
}
Also used : DblArray(org.apache.sysml.runtime.compress.utils.DblArray) IntArrayList(org.apache.sysml.runtime.compress.utils.IntArrayList) DblArrayIntListHashMap(org.apache.sysml.runtime.compress.utils.DblArrayIntListHashMap)

Example 4 with DblArray

use of org.apache.sysml.runtime.compress.utils.DblArray in project systemml by apache.

the class BitmapEncoder method extractBitmap.

private static UncompressedBitmap extractBitmap(int[] colIndices, MatrixBlock rawblock, ReaderColumnSelection rowReader) {
    // probe map for distinct items (for value or value groups)
    DblArrayIntListHashMap distinctVals = new DblArrayIntListHashMap();
    // scan rows and probe/build distinct items
    DblArray cellVals = null;
    while ((cellVals = rowReader.nextRow()) != null) {
        IntArrayList lstPtr = distinctVals.get(cellVals);
        if (lstPtr == null) {
            // create new objects only on demand
            lstPtr = new IntArrayList();
            distinctVals.appendValue(new DblArray(cellVals), lstPtr);
        }
        lstPtr.appendValue(rowReader.getCurrentRowIndex());
    }
    return new UncompressedBitmap(distinctVals, colIndices.length);
}
Also used : DblArray(org.apache.sysml.runtime.compress.utils.DblArray) IntArrayList(org.apache.sysml.runtime.compress.utils.IntArrayList) DblArrayIntListHashMap(org.apache.sysml.runtime.compress.utils.DblArrayIntListHashMap)

Aggregations

DblArray (org.apache.sysml.runtime.compress.utils.DblArray)4 HashMap (java.util.HashMap)2 DblArrayIntListHashMap (org.apache.sysml.runtime.compress.utils.DblArrayIntListHashMap)2 IntArrayList (org.apache.sysml.runtime.compress.utils.IntArrayList)2