Package org.apache.sysds.runtime.compress.colgroup

## Class ColGroupRLE

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.AColGroup
  - - org.apache.sysds.runtime.compress.colgroup.AColGroupCompressed
    - - org.apache.sysds.runtime.compress.colgroup.AColGroupValue
      - - org.apache.sysds.runtime.compress.colgroup.AColGroupOffset
        - - org.apache.sysds.runtime.compress.colgroup.ColGroupRLE

All Implemented Interfaces:
  `Serializable`, `Cloneable`

    public class ColGroupRLE
    extends AColGroupOffset

A group of columns compressed with a single run-length encoded bitmap.

See Also:
  Serialized Form

### Nested Class Summary

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

`AColGroup.CompressionType`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`AColGroup` `binaryRowOpLeft​(BinaryOperator op, double[] v, boolean isRowSafe)` Perform a binary row operation.
`AColGroup` `binaryRowOpRight​(BinaryOperator op, double[] v, boolean isRowSafe)` Perform a binary row operation.
`boolean[]` `computeZeroIndicatorVector()`
`void` `countNonZerosPerRow​(int[] rnnz, int rl, int ru)`
`static char[]` `genRLEBitmap​(int[] offsets, int len)` Encodes the bitmap as a series of run lengths and offsets.
`org.apache.sysds.runtime.compress.colgroup.AColGroup.ColGroupType` `getColGroupType()`
`AColGroup.CompressionType` `getCompType()` Obtain the compression type.
`int[]` `getCounts​(int[] counts)`
`double` `getIdx​(int r, int colIdx)` Get the value at a colGroup specific row/column index position.
`void` `leftMultByAColGroup​(AColGroup lhs, MatrixBlock result)` Left side matrix multiplication with a column group that is transposed.
`void` `leftMultByMatrixNoPreAgg​(MatrixBlock matrix, MatrixBlock result, int rl, int ru, int cl, int cu)` Left multiply with this column group.
`AColGroup` `scalarOperation​(ScalarOperator op)` Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
`String` `toString()`
`void` `tsmmAColGroup​(AColGroup other, MatrixBlock result)` Matrix multiply with this other column group, but: 1.
`AColGroup` `unaryOperation​(UnaryOperator op)`

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

`estimateInMemorySize, getBitmapOffsets, getBitmaps, getCost, getExactSizeOnDisk, hasZeros, readFields, write`

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

`centralMoment, computeColSums, containsValue, copy, decompressToDenseBlock, decompressToSparseBlock, forceMatrixBlockDictionary, getCachedCounts, getCounts, getDictionary, getNumberNonZeros, getNumValues, replace, rexpandCols, rightMultByMatrix`

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

`getMax, getMin, preAggRows, tsmm, unaryAggregateOperations, unaryAggregateOperations`

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

`colSum, decompressToDenseBlock, decompressToSparseBlock, get, getColIndices, getNumCols, shiftColIndices, sliceColumn, sliceColumns`

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

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

### Method Detail

#### getCompType

    public AColGroup.CompressionType getCompType()

Description copied from class: `AColGroup`
Obtain the compression type.

Specified by:
  `getCompType` in class `AColGroup`
Returns:
  How the elements of the column group are compressed.

#### getColGroupType

    public org.apache.sysds.runtime.compress.colgroup.AColGroup.ColGroupType getColGroupType()

#### getCounts

    public int[] getCounts​(int[] counts)

Specified by:
  `getCounts` in class `AColGroupValue`

#### scalarOperation

    public AColGroup scalarOperation​(ScalarOperator op)

Description copied from class: `AColGroup`
Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.

Specified by:
  `scalarOperation` in class `AColGroup`
Parameters:
  `op` - operation to perform
Returns:
  version of this column group with the operation applied

#### unaryOperation

    public AColGroup unaryOperation​(UnaryOperator op)

Specified by:
  `unaryOperation` in class `AColGroup`

#### binaryRowOpLeft

    public AColGroup binaryRowOpLeft​(BinaryOperator op,
                                     double[] v,
                                     boolean isRowSafe)

Description copied from class: `AColGroup`
Perform a binary row operation.

Specified by:
  `binaryRowOpLeft` in class `AColGroup`
Parameters:
  `op` - The operation to execute
  `v` - The vector of values to apply, should be same length as dictionary length.
  `isRowSafe` - True if the binary op is applied to an entire zero row and all results are zero
Returns:
  A updated column group with the new values.

#### binaryRowOpRight

    public AColGroup binaryRowOpRight​(BinaryOperator op,
                                      double[] v,
                                      boolean isRowSafe)

Description copied from class: `AColGroup`
Perform a binary row operation.

Specified by:
  `binaryRowOpRight` in class `AColGroup`
Parameters:
  `op` - The operation to execute
  `v` - The vector of values to apply, should be same length as dictionary length.
  `isRowSafe` - True if the binary op is applied to an entire zero row and all results are zero
Returns:
  A updated column group with the new values.

#### computeZeroIndicatorVector

    public boolean[] computeZeroIndicatorVector()

#### countNonZerosPerRow

    public void countNonZerosPerRow​(int[] rnnz,
                                    int rl,
                                    int ru)

Specified by:
  `countNonZerosPerRow` in class `AColGroupOffset`

#### getIdx

    public double getIdx​(int r,
                         int colIdx)

Description copied from class: `AColGroup`
Get the value at a colGroup specific row/column index position.

Specified by:
  `getIdx` in class `AColGroup`
Parameters:
  `r` - row
  `colIdx` - column index in the _colIndexes.
Returns:
  value at the row/column index position

#### leftMultByMatrixNoPreAgg

    public void leftMultByMatrixNoPreAgg​(MatrixBlock matrix,
                                         MatrixBlock result,
                                         int rl,
                                         int ru,
                                         int cl,
                                         int cu)

Description copied from class: `AColGroup`
Left multiply with this column group.

Specified by:
  `leftMultByMatrixNoPreAgg` in class `AColGroup`
Parameters:
  `matrix` - The matrix to multiply with on the left
  `result` - The result to output the values into, always dense for the purpose of the column groups parallelizing
  `rl` - The row to begin the multiplication from on the lhs matrix
  `ru` - The row to end the multiplication at on the lhs matrix
  `cl` - The column to begin the multiplication from on the lhs matrix
  `cu` - The column to end the multiplication at on the lhs matrix

#### leftMultByAColGroup

    public void leftMultByAColGroup​(AColGroup lhs,
                                    MatrixBlock result)

Description copied from class: `AColGroup`
Left side matrix multiplication with a column group that is transposed.

Specified by:
  `leftMultByAColGroup` in class `AColGroup`
Parameters:
  `lhs` - The left hand side Column group to multiply with, the left hand side should be considered transposed.
  `result` - The result matrix to insert the result of the multiplication into

#### tsmmAColGroup

    public void tsmmAColGroup​(AColGroup other,
                              MatrixBlock result)

Description copied from class: `AColGroup`
Matrix multiply with this other column group, but: 1. Only output upper triangle values. 2. Multiply both ways with "this" being on the left and on the right. It should be guaranteed that the input is not the same as the caller of the method. The second step is achievable by treating the initial multiplied matrix, and adding its values to the correct locations in the output.

Specified by:
  `tsmmAColGroup` in class `AColGroup`
Parameters:
  `other` - The other Column group to multiply with
  `result` - The result matrix to put the results into

#### toString

    public String toString()

Overrides:
  `toString` in class `AColGroupOffset`

#### genRLEBitmap

    public static char[] genRLEBitmap​(int[] offsets,
                                      int len)

Encodes the bitmap as a series of run lengths and offsets. Note that this method should not be called if the len is 0.

Parameters:
  `offsets` - uncompressed offset list
  `len` - logical length of the given offset list
Returns:
  compressed version of said bitmap