org.apache.sysml.runtime.compress

Class ColGroupDDC1

  • All Implemented Interfaces:
    Serializable


    public class ColGroupDDC1
    extends ColGroupDDC
    Class to encapsulate information about a column group that is encoded with dense dictionary encoding (DDC) using 1 byte codes.
    See Also:
    Serialized Form
    • Constructor Detail

      • ColGroupDDC1

        public ColGroupDDC1()
      • ColGroupDDC1

        public ColGroupDDC1(int[] colIndices,
                            int numRows,
                            UncompressedBitmap ubm)
      • ColGroupDDC1

        public ColGroupDDC1(int[] colIndices,
                            int numRows,
                            double[] values,
                            byte[] data)
    • Method Detail

      • getData

        protected double getData(int r,
                                 int colIx)
        Description copied from class: ColGroupDDC
        Generic get value for byte-length-agnostic access.
        Specified by:
        getData in class ColGroupDDC
        Parameters:
        r - global row index
        colIx - local column index
        Returns:
        value
      • setData

        protected void setData(int r,
                               int code)
        Description copied from class: ColGroupDDC
        Generic set value for byte-length-agnostic write of encoded value.
        Specified by:
        setData in class ColGroupDDC
        Parameters:
        r - global row index
        code - encoded value
      • 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
      • 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 ColGroupDDC
        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.
        Overrides:
        decompressToBlock in class ColGroupDDC
        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 colpos)
        Description copied from class: ColGroup
        Decompress to block.
        Overrides:
        decompressToBlock in class ColGroupDDC
        Parameters:
        target - dense output vector
        colpos - column to decompress, error if larger or equal numCols
      • countNonZerosPerRow

        protected void countNonZerosPerRow(int[] rnnz,
                                           int rl,
                                           int ru)
        Description copied from class: ColGroup
        Count the number of non-zeros per row
        Overrides:
        countNonZerosPerRow in class ColGroupDDC
        Parameters:
        rnnz - non-zeros per row
        rl - row lower bound, inclusive
        ru - row upper bound, exclusive
      • 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
      • computeSum

        protected void computeSum(MatrixBlock result,
                                  org.apache.sysml.runtime.functionobjects.KahanFunction kplus)
        Overrides:
        computeSum in class ColGroupDDC
      • computeRowSums

        protected void computeRowSums(MatrixBlock result,
                                      org.apache.sysml.runtime.functionobjects.KahanFunction kplus,
                                      int rl,
                                      int ru)
        Overrides:
        computeRowSums in class ColGroupDDC
      • 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

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