org.apache.sysml.runtime.compress

Class ColGroupDDC

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ColGroupDDC1, ColGroupDDC2


    public abstract class ColGroupDDC
    extends ColGroupValue
    Class to encapsulate information about a column group that is encoded with dense dictionary encoding (DDC). NOTE: zero values are included at position 0 in the value dictionary, which simplifies various operations such as counting the number of non-zeros.
    See Also:
    Serialized Form
    • Constructor Detail

      • ColGroupDDC

        public ColGroupDDC()
      • ColGroupDDC

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

        protected ColGroupDDC(int[] colIndices,
                              int numRows,
                              double[] values)
    • Method Detail

      • 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
      • 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
      • unaryAggregateOperations

        public void unaryAggregateOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op,
                                             MatrixBlock result,
                                             int rl,
                                             int ru)
                                      throws DMLRuntimeException
        Specified by:
        unaryAggregateOperations in class ColGroupValue
        Parameters:
        op - aggregation operator
        result - output matrix block
        rl - row lower index, inclusive
        ru - row upper index, exclusive
        Throws:
        DMLRuntimeException - on invalid inputs
      • computeSum

        protected void computeSum(MatrixBlock result,
                                  org.apache.sysml.runtime.functionobjects.KahanFunction kplus)
      • computeColSums

        protected void computeColSums(MatrixBlock result,
                                      org.apache.sysml.runtime.functionobjects.KahanFunction kplus)
      • computeRowSums

        protected void computeRowSums(MatrixBlock result,
                                      org.apache.sysml.runtime.functionobjects.KahanFunction kplus,
                                      int rl,
                                      int ru)
      • computeRowMxx

        protected void computeRowMxx(MatrixBlock result,
                                     org.apache.sysml.runtime.functionobjects.Builtin builtin,
                                     int rl,
                                     int ru)
      • postScaling

        protected final void postScaling(double[] vals,
                                         double[] c)
      • getData

        protected abstract double getData(int r,
                                          int colIx)
        Generic get value for byte-length-agnostic access.
        Parameters:
        r - global row index
        colIx - local column index
        Returns:
        value
      • setData

        protected abstract void setData(int r,
                                        int code)
        Generic set value for byte-length-agnostic write of encoded value.
        Parameters:
        r - global row index
        code - encoded value
      • 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 ColGroupValue
        Returns:
        an upper bound on the number of bytes used to store this ColGroup in memory.
      • 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.