org.apache.sysds.runtime.compress.colgroup

## Class ColGroupUncompressed

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.ColGroup
  - - org.apache.sysds.runtime.compress.colgroup.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

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.sysds.runtime.compress.colgroup.ColGroup

      `ColGroup.CompressionType`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `countNonZerosPerRow(int[] rnnz, int rl, int ru)` Count the number of non-zeros per row
    `void` | `decompressToBlock(MatrixBlock target, int colpos)` Decompress to block.
    `void` | `decompressToBlock(MatrixBlock target, int[] colIndexTargets)` Decompress the contents of this column group into uncompressed packed columns
    `void` | `decompressToBlock(MatrixBlock target, int rl, int ru)` Decompress the contents of this column group into the specified full matrix block.
    `long` | `estimateInMemorySize()` Note: Must be overridden by child classes to account for additional data and metadata
    `double` | `get(int r, int c)` Get the value at a global row/column position.
    `ColGroup.CompressionType` | `getCompType()` Obtain the compression type.
    `MatrixBlock` | `getData()` Access for superclass
    `long` | `getExactSizeOnDisk()` Returns the exact serialized size of column group.
    `boolean` | `getIfCountsType()` Returns true if in the getValuesAsBlock method returns values in groups (that needs to be counted) or individually potentially repeated values
    `Iterator<IJV>` | `getIterator(int rl, int ru, boolean inclZeros, boolean rowMajor)` Create a column group iterator for a row index range.
    `org.apache.sysds.runtime.compress.colgroup.ColGroup.ColGroupRowIterator` | `getRowIterator(int rl, int ru)` Create a dense row iterator for a row index range.
    `double[]` | `getValues()` Get all the values in the colGroup.
    `MatrixBlock` | `getValuesAsBlock()` Returns the ColGroup as a MatrixBlock.
    `long` | `getValuesSize()`
    `boolean` | `isLossy()` Is Lossy
    `void` | `leftMultByMatrix(double[] vector, double[] c, int numVals, double[] values, int numRows, int numCols, int rl, int ru, int vOff)` 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.
    `void` | `leftMultByMatrix(MatrixBlock matrix, MatrixBlock result)`
    `void` | `leftMultByRowVector(double[] vector, double[] c, int numVals)` 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.
    `void` | `leftMultByRowVector(double[] vector, double[] c, int numVals, double[] values)` 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.
    `void` | `readFields(DataInput in)` Deserialize column group from data input.
    `void` | `rightMultByMatrix(double[] matrix, double[] result, int numVals, double[] values, int rl, int ru, int vOff)`
    `void` | `rightMultByMatrix(MatrixBlock vector, MatrixBlock result, int rl, int ru)`
    `void` | `rightMultByVector(double[] b, double[] c, int rl, int ru, double[] dictVals)` Multiply the slice of the matrix that this column group represents by a vector on the right.
    `void` | `rightMultByVector(MatrixBlock vector, MatrixBlock result, int rl, int ru)`
    `ColGroup` | `scalarOperation(ScalarOperator op)` Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
    `String` | `toString()`
    `void` | `unaryAggregateOperations(AggregateUnaryOperator op, double[] ret)` Unary Aggregate operator, since aggregate operators require new object output, the output becomes an uncompressed matrix.
    `void` | `unaryAggregateOperations(AggregateUnaryOperator op, double[] result, int rl, int ru)` Unary Aggregate operator, since aggregate operators require new object output, the output becomes an uncompressed matrix.
    `void` | `unaryAggregateOperations(AggregateUnaryOperator op, MatrixBlock ret)`
    `void` | `write(DataOutput out)` Serializes column group to data output.

    - ### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.ColGroup

      `getColIndex, getColIndices, getNumCols, getNumRows, shiftColIndices`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getValuesSize

          public long getValuesSize()

    - #### getCompType

          public ColGroup.CompressionType getCompType()

      Description copied from class: `ColGroup`
      Obtain the compression type.
      Specified by:
        `getCompType` in class `ColGroup`
      Returns:
        How the elements of the column group are compressed.

    - #### 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
      Specified by:
        `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(double[] b,
                                        double[] c,
                                        int rl,
                                        int ru,
                                        double[] dictVals)

      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:
        `b` - vector to multiply by (tall vector)
        `c` - accumulator for holding the result
        `rl` - row lower
        `ru` - row upper if the internal SystemML code that performs the multiplication experiences an error
        `dictVals` - The dictionary values materialized

    - #### rightMultByVector

          public void rightMultByVector(MatrixBlock vector,
                                        MatrixBlock result,
                                        int rl,
                                        int ru)

    - #### rightMultByMatrix

          public void rightMultByMatrix(MatrixBlock vector,
                                        MatrixBlock result,
                                        int rl,
                                        int ru)

    - #### rightMultByMatrix

          public void rightMultByMatrix(double[] matrix,
                                        double[] result,
                                        int numVals,
                                        double[] values,
                                        int rl,
                                        int ru,
                                        int vOff)

      Specified by:
        `rightMultByMatrix` in class `ColGroup`

    - #### leftMultByRowVector

          public void leftMultByRowVector(double[] vector,
                                          double[] c,
                                          int numVals)

      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
        `c` - matrix block result
        `numVals` - The Number of values contained in the Column.

    - #### leftMultByRowVector

          public void leftMultByRowVector(double[] vector,
                                          double[] c,
                                          int numVals,
                                          double[] values)

      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
        `c` - matrix block result
        `numVals` - The Number of values contained in the Column.
        `values` - The materialized list of values contained in the dictionary.

    - #### leftMultByMatrix

          public void leftMultByMatrix(double[] vector,
                                       double[] c,
                                       int numVals,
                                       double[] values,
                                       int numRows,
                                       int numCols,
                                       int rl,
                                       int ru,
                                       int vOff)

      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:
        `leftMultByMatrix` in class `ColGroup`
      Parameters:
        `vector` - matrix to left multiply
        `c` - matrix block result
        `numVals` - The Number of values contained in the Column.
        `values` - The materialized list of values contained in the dictionary.
        `numRows` - The number of rows in the matrix input
        `numCols` - The number of columns in the colGroups parent matrix.
        `rl` - The row to start the matrix multiplication from
        `ru` - The row to stop the matrix multiplication at.
        `vOff` - The offset into the first argument matrix to start at.

    - #### leftMultByMatrix

          public void leftMultByMatrix(MatrixBlock matrix,
                                       MatrixBlock result)

    - #### scalarOperation

          public ColGroup scalarOperation(ScalarOperator op)

      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

    - #### unaryAggregateOperations

          public void unaryAggregateOperations(AggregateUnaryOperator op,
                                               double[] ret)

      Description copied from class: `ColGroup`
      Unary Aggregate operator, since aggregate operators require new object output, the output becomes an uncompressed matrix.
      Specified by:
        `unaryAggregateOperations` in class `ColGroup`
      Parameters:
        `op` - The operator used
        `ret` - Rhe output matrix block.

    - #### unaryAggregateOperations

          public void unaryAggregateOperations(AggregateUnaryOperator op,
                                               MatrixBlock ret)

    - #### unaryAggregateOperations

          public void unaryAggregateOperations(AggregateUnaryOperator op,
                                               double[] result,
                                               int rl,
                                               int ru)

      Description copied from class: `ColGroup`
      Unary Aggregate operator, since aggregate operators require new object output, the output becomes an uncompressed matrix.
      Specified by:
        `unaryAggregateOperations` in class `ColGroup`
      Parameters:
        `op` - The operator used
        `result` - The output matrix block.
        `rl` - The Starting Row to do aggregation from
        `ru` - The last Row to do aggregation to (not included)

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Description copied from class: `ColGroup`
      Deserialize column group from data input.
      Specified by:
        `readFields` in class `ColGroup`
      Parameters:
        `in` - data input
      Throws:
        `IOException` - if IOException occurs

    - #### write

          public void write(DataOutput out)
                     throws IOException

      Description copied from class: `ColGroup`
      Serializes column group to data output.
      Specified by:
        `write` in class `ColGroup`
      Parameters:
        `out` - data output
      Throws:
        `IOException` - if IOException 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

          public 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)

      Description copied from class: `ColGroup`
      Create a column group iterator for a row index range.
      Specified by:
        `getIterator` in class `ColGroup`
      Parameters:
        `rl` - row lower index, inclusive
        `ru` - row upper index, exclusive
        `inclZeros` - include zero values into scope of iterator
        `rowMajor` - use a row major iteration order
      Returns:
        an iterator instance

    - #### getRowIterator

          public org.apache.sysds.runtime.compress.colgroup.ColGroup.ColGroupRowIterator getRowIterator(int rl,
                                                                                                        int ru)

      Description copied from class: `ColGroup`
      Create a dense row iterator for a row index range. This iterator implies the inclusion of zeros and row-major iteration order.
      Specified by:
        `getRowIterator` in class `ColGroup`
      Parameters:
        `rl` - row lower index, inclusive
        `ru` - row upper index, exclusive
      Returns:
        an iterator instance

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getValuesAsBlock

          public MatrixBlock getValuesAsBlock()

      Description copied from class: `ColGroup`
      Returns the ColGroup as a MatrixBlock. Used as a fall back solution in case a operation is not supported. Use in connection to getIfCountsType to get if the values are repeated.
      Specified by:
        `getValuesAsBlock` in class `ColGroup`
      Returns:
        Matrix Block of the contained Values. Possibly contained in groups.

    - #### getIfCountsType

          public boolean getIfCountsType()

      Description copied from class: `ColGroup`
      Returns true if in the getValuesAsBlock method returns values in groups (that needs to be counted) or individually potentially repeated values
      Specified by:
        `getIfCountsType` in class `ColGroup`
      Returns:
        boolean

    - #### getValues

          public double[] getValues()

      Description copied from class: `ColGroup`
      Get all the values in the colGroup. Note that this is only the stored values not the way they are stored. Making the output a list of values used in that colGroup not the actual full column.
      Specified by:
        `getValues` in class `ColGroup`
      Returns:
        a double list of values.

    - #### isLossy

          public boolean isLossy()

      Description copied from class: `ColGroup`
      Is Lossy
      Specified by:
        `isLossy` in class `ColGroup`
      Returns:
        returns if the ColGroup is compressed in a lossy manner.

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