org.apache.sysml.runtime.compress

Class ColGroupUncompressed

  • All Implemented Interfaces:
    Serializable


    public class ColGroupUncompressed
    extends ColGroup
    Column group type for columns that are stored as dense arrays of doubles. Uses a MatrixBlock internally to store the column contents.
    See Also:
    Serialized Form
    • Constructor Detail

      • ColGroupUncompressed

        public ColGroupUncompressed()
      • ColGroupUncompressed

        public ColGroupUncompressed(List<Integer> colIndicesList,
                                    MatrixBlock rawblock)
                             throws DMLRuntimeException
        Main constructor.
        Parameters:
        colIndicesList - indices (relative to the current block) of the columns that this column group represents.
        rawblock - the uncompressed block; uncompressed data must be present at the time that the constructor is called
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • ColGroupUncompressed

        public ColGroupUncompressed(ArrayList<ColGroup> groupsToDecompress)
        Constructor for creating temporary decompressed versions of one or more compressed column groups.
        Parameters:
        groupsToDecompress - compressed columns to subsume. Must contain at least one element.
      • ColGroupUncompressed

        public ColGroupUncompressed(int[] colIndices,
                                    int numRows,
                                    MatrixBlock data)
        Constructor for internal use. Used when a method needs to build an instance of this class from scratch.
        Parameters:
        colIndices - column mapping for this column group
        numRows - number of rows in the column, for passing to the superclass
        data - matrix block
    • Method Detail

      • getData

        public MatrixBlock getData()
        Access for superclass
        Returns:
        direct pointer to the internal representation of the columns
      • estimateInMemorySize

        public long estimateInMemorySize()
        Description copied from class: ColGroup
        Note: Must be overridden by child classes to account for additional data and metadata
        Overrides:
        estimateInMemorySize in class ColGroup
        Returns:
        an upper bound on the number of bytes used to store this ColGroup in memory.
      • decompressToBlock

        public void decompressToBlock(MatrixBlock target,
                                      int rl,
                                      int ru)
        Description copied from class: ColGroup
        Decompress the contents of this column group into the specified full matrix block.
        Specified by:
        decompressToBlock in class ColGroup
        Parameters:
        target - a matrix block where the columns covered by this column group have not yet been filled in.
        rl - row lower
        ru - row upper
      • decompressToBlock

        public void decompressToBlock(MatrixBlock target,
                                      int[] colIndexTargets)
        Description copied from class: ColGroup
        Decompress the contents of this column group into uncompressed packed columns
        Specified by:
        decompressToBlock in class ColGroup
        Parameters:
        target - a dense matrix block. The block must have enough space to hold the contents of this column group.
        colIndexTargets - array that maps column indices in the original matrix block to columns of target.
      • decompressToBlock

        public void decompressToBlock(MatrixBlock target,
                                      int colpos)
        Description copied from class: ColGroup
        Decompress to block.
        Specified by:
        decompressToBlock in class ColGroup
        Parameters:
        target - dense output vector
        colpos - column to decompress, error if larger or equal numCols
      • get

        public double get(int r,
                          int c)
        Description copied from class: ColGroup
        Get the value at a global row/column position.
        Specified by:
        get in class ColGroup
        Parameters:
        r - row
        c - column
        Returns:
        value at the row/column position
      • rightMultByVector

        public void rightMultByVector(MatrixBlock vector,
                                      MatrixBlock result,
                                      int rl,
                                      int ru)
                               throws DMLRuntimeException
        Description copied from class: ColGroup
        Multiply the slice of the matrix that this column group represents by a vector on the right.
        Specified by:
        rightMultByVector in class ColGroup
        Parameters:
        vector - vector to multiply by (tall vector)
        result - accumulator for holding the result
        rl - row lower
        ru - row upper
        Throws:
        DMLRuntimeException - if the internal SystemML code that performs the multiplication experiences an error
      • leftMultByRowVector

        public void leftMultByRowVector(MatrixBlock vector,
                                        MatrixBlock result)
                                 throws DMLRuntimeException
        Description copied from class: ColGroup
        Multiply the slice of the matrix that this column group represents by a row vector on the left (the original column vector is assumed to be transposed already i.e. its size now is 1xn).
        Specified by:
        leftMultByRowVector in class ColGroup
        Parameters:
        vector - row vector
        result - matrix block result
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • scalarOperation

        public ColGroup scalarOperation(org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
                                 throws DMLRuntimeException
        Description copied from class: ColGroup
        Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
        Specified by:
        scalarOperation in class ColGroup
        Parameters:
        op - operation to perform
        Returns:
        version of this column group with the operation applied
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • getExactSizeOnDisk

        public long getExactSizeOnDisk()
        Description copied from class: ColGroup
        Returns the exact serialized size of column group. This can be used for example for buffer preallocation.
        Specified by:
        getExactSizeOnDisk in class ColGroup
        Returns:
        exact serialized size for column group
      • countNonZerosPerRow

        protected void countNonZerosPerRow(int[] rnnz,
                                           int rl,
                                           int ru)
        Description copied from class: ColGroup
        Count the number of non-zeros per row
        Specified by:
        countNonZerosPerRow in class ColGroup
        Parameters:
        rnnz - non-zeros per row
        rl - row lower bound, inclusive
        ru - row upper bound, exclusive
      • getIterator

        public Iterator<IJV> getIterator(int rl,
                                         int ru,
                                         boolean inclZeros,
                                         boolean rowMajor)
        Specified by:
        getIterator in class ColGroup

Copyright © 2017 The Apache Software Foundation. All rights reserved.