org.apache.sysds.runtime.compress.colgroup

## Class ColGroupOLE

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.ColGroup
  - - org.apache.sysds.runtime.compress.colgroup.ColGroupValue
    - - org.apache.sysds.runtime.compress.colgroup.ColGroupOffset
      - - org.apache.sysds.runtime.compress.colgroup.ColGroupOLE

- All Implemented Interfaces:
    Serializable

      public class ColGroupOLE
      extends ColGroupOffset

  Class to encapsulate information about a column group that is encoded with simple lists of offsets for each set of distinct values.
  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 Static 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[] colixTargets)` 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
    `static char[]` | `genOffsetBitmap(int[] offsets, int len)` Encodes the bitmap in blocks of offsets.
    `ColGroup.CompressionType` | `getCompType()` Obtain the compression type.
    `int[]` | `getCounts(int[] counts)`
    `int[]` | `getCounts(int rl, int ru, int[] counts)`
    `long` | `getExactSizeOnDisk()` Returns the exact serialized size of column group.
    `Iterator<Integer>` | `getIterator(int k)`
    `Iterator<Integer>` | `getIterator(int k, int rl, int ru)`
    `org.apache.sysds.runtime.compress.colgroup.ColGroup.ColGroupRowIterator` | `getRowIterator(int rl, int ru)` Create a dense row iterator for a row index range.
    `void` | `leftMultByMatrix(double[] a, 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` | `leftMultByRowVector(double[] a, 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[] a, 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` | `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.
    `ColGroup` | `scalarOperation(ScalarOperator op)` Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
    `String` | `toString()`
    `void` | `write(DataOutput out)` Serializes column group to data output.

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

      `get, getBitmapOffsets, getBitmaps, getIterator, hasZeros`

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

      `cleanupThreadLocalMemory, getByteValues, getCounts, getCounts, getIfCountsType, getNumValues, getValues, getValuesAsBlock, isLossy, setupThreadLocalMemory, unaryAggregateOperations, unaryAggregateOperations`

    - ### 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

    - #### 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.

    - #### 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 `ColGroupOffset`
      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[] colixTargets)

      Description copied from class: `ColGroup`
      Decompress the contents of this column group into uncompressed packed columns
      Overrides:
        `decompressToBlock` in class `ColGroupOffset`
      Parameters:
        `target` - a dense matrix block. The block must have enough space to hold the contents of this column group.
        `colixTargets` - 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.
      Overrides:
        `decompressToBlock` in class `ColGroupOffset`
      Parameters:
        `target` - dense output vector
        `colpos` - column to decompress, error if larger or equal numCols

    - #### getCounts

          public int[] getCounts(int[] counts)

      Specified by:
        `getCounts` in class `ColGroupValue`

    - #### getCounts

          public int[] getCounts(int rl,
                                 int ru,
                                 int[] counts)

      Specified by:
        `getCounts` in class `ColGroupValue`

    - #### 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 `ColGroupOffset`
      Returns:
        an upper bound on the number of bytes used to store this ColGroup in memory.

    - #### 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

    - #### 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

    - #### 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[] a,
                                          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:
        `a` - row vector
        `c` - matrix block result
        `numVals` - The Number of values contained in the Column.

    - #### leftMultByRowVector

          public void leftMultByRowVector(double[] a,
                                          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:
        `a` - 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[] a,
                                       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:
        `a` - 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.

    - #### 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

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Description copied from class: `ColGroup`
      Deserialize column group from data input.
      Overrides:
        `readFields` in class `ColGroupOffset`
      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.
      Overrides:
        `write` in class `ColGroupOffset`
      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.
      Overrides:
        `getExactSizeOnDisk` in class `ColGroupOffset`
      Returns:
        exact serialized size for column group

    - #### getIterator

          public Iterator<Integer> getIterator(int k)

      Specified by:
        `getIterator` in class `ColGroupOffset`
      Parameters:
        `k` - index of value tuple with associated bitmap
      Returns:
        an iterator over the row offsets in this bitmap

    - #### getIterator

          public Iterator<Integer> getIterator(int k,
                                               int rl,
                                               int ru)

      Specified by:
        `getIterator` in class `ColGroupOffset`
      Parameters:
        `k` - index of value tuple with associated bitmap
        `rl` - row lower index, inclusive
        `ru` - row upper index, exclusive
      Returns:
        an iterator over the row offsets in this bitmap

    - #### 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 `ColGroupOffset`

    - #### genOffsetBitmap

          public static char[] genOffsetBitmap(int[] offsets,
                                               int len)

      Encodes the bitmap in blocks of offsets. Within each block, the bits are stored as absolute offsets from the start of the block.
      Parameters:
        `offsets` - uncompressed offset list
        `len` - logical length of the given offset list
      Returns:
        compressed version of said bitmap

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