Search in sources :

Example 1 with ColGroupUncompressed

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

the class ConverterUtils method getUncompressedColBlock.

public static MatrixBlock getUncompressedColBlock(ColGroup group) {
    MatrixBlock ret = null;
    if (group instanceof ColGroupUncompressed) {
        ret = ((ColGroupUncompressed) group).getData();
    } else {
        ArrayList<ColGroup> tmpGroup = new ArrayList<ColGroup>(Arrays.asList(group));
        ColGroupUncompressed decompressedCols = new ColGroupUncompressed(tmpGroup);
        ret = decompressedCols.getData();
    }
    return ret;
}
Also used : MatrixBlock(org.apache.sysml.runtime.matrix.data.MatrixBlock) ColGroup(org.apache.sysml.runtime.compress.ColGroup) ArrayList(java.util.ArrayList) ColGroupUncompressed(org.apache.sysml.runtime.compress.ColGroupUncompressed)

Example 2 with ColGroupUncompressed

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

the class ConverterUtils method copyColGroup.

/**
 * Copy col group instance with deep copy of column indices but
 * shallow copy of actual contents;
 *
 * @param group column group
 * @return column group (deep copy of indices but shallow copy of contents)
 */
public static ColGroup copyColGroup(ColGroup group) {
    ColGroup ret = null;
    // deep copy col indices
    int[] colIndices = Arrays.copyOf(group.getColIndices(), group.getNumCols());
    // create copy of column group
    if (group instanceof ColGroupUncompressed) {
        ColGroupUncompressed in = (ColGroupUncompressed) group;
        ret = new ColGroupUncompressed(colIndices, in.getNumRows(), in.getData());
    } else if (group instanceof ColGroupRLE) {
        ColGroupRLE in = (ColGroupRLE) group;
        ret = new ColGroupRLE(colIndices, in.getNumRows(), in.hasZeros(), in.getValues(), in.getBitmaps(), in.getBitmapOffsets());
    } else if (group instanceof ColGroupOLE) {
        ColGroupOLE in = (ColGroupOLE) group;
        ret = new ColGroupOLE(colIndices, in.getNumRows(), in.hasZeros(), in.getValues(), in.getBitmaps(), in.getBitmapOffsets());
    }
    return ret;
}
Also used : ColGroupOLE(org.apache.sysml.runtime.compress.ColGroupOLE) ColGroup(org.apache.sysml.runtime.compress.ColGroup) ColGroupRLE(org.apache.sysml.runtime.compress.ColGroupRLE) ColGroupUncompressed(org.apache.sysml.runtime.compress.ColGroupUncompressed)

Aggregations

ColGroup (org.apache.sysml.runtime.compress.ColGroup)2 ColGroupUncompressed (org.apache.sysml.runtime.compress.ColGroupUncompressed)2 ArrayList (java.util.ArrayList)1 ColGroupOLE (org.apache.sysml.runtime.compress.ColGroupOLE)1 ColGroupRLE (org.apache.sysml.runtime.compress.ColGroupRLE)1 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)1