org.apache.sysds.runtime.compress.colgroup

## Class ColGroupFactory

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.ColGroupFactory

    public final class ColGroupFactory
    extends Object

Factory pattern for constructing ColGroups.

### Constructor Summary

Constructors
Constructor and Description
`ColGroupFactory()`

### Method Summary

All Methods Static Methods Concrete Methods
`static AColGroup` `compress(int[] colIndexes, int rlen, ABitmap ubm, AColGroup.CompressionType compType, CompressionSettings cs, MatrixBlock rawMatrixBlock, double tupleSparsity)` Method for compressing a column group.
`static List<AColGroup>` `compressColGroups(MatrixBlock in, CompressedSizeInfo csi, CompressionSettings compSettings, int k)` The actual compression method, that handles the logic of compressing multiple columns together.
`static AColGroup` `genColGroupConst(int numCols, double value)` Generate a constant column group.
`static AColGroup` `genColGroupConst(int numCols, double[] values)` Generate a constant column group.
`static AColGroup` `getColGroupConst(int[] cols, double value)` Generate a constant column group.
`static AColGroup` `getColGroupConst(int[] cols, double[] values)` Generate a constant column group.
`static AColGroup` `getColGroupConst(int numCols, ADictionary dict)` Generate a constant column group.

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

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

### Constructor Detail

#### ColGroupFactory

    public ColGroupFactory()

### Method Detail

#### compressColGroups

    public static List<AColGroup> compressColGroups(MatrixBlock in,
                                                    CompressedSizeInfo csi,
                                                    CompressionSettings compSettings,
                                                    int k)

The actual compression method, that handles the logic of compressing multiple columns together. This method also have the responsibility of correcting any estimation errors previously made.

Parameters:
  `in` - The input matrix, that could have been transposed if CompSettings was set to do that
  `csi` - The compression Information extracted from the estimation, this contains which groups of columns to compress together
  `compSettings` - The compression settings to construct the compression based on.
  `k` - The degree of parallelism used.
Returns:
  A Resulting array of ColGroups, containing the compressed information from the input matrix block.

#### genColGroupConst

    public static AColGroup genColGroupConst(int numCols,
                                             double value)

Generate a constant column group.

Parameters:
  `numCols` - The number of columns
  `value` - The value contained in all cells.
Returns:
  A Constant column group.

#### genColGroupConst

    public static AColGroup genColGroupConst(int numCols,
                                             double[] values)

Generate a constant column group.

Parameters:
  `numCols` - The number of columns.
  `values` - The value vector that contains all the unique values for each column in the matrix.
Returns:
  A Constant column group.

#### getColGroupConst

    public static AColGroup getColGroupConst(int[] cols,
                                             double value)

Generate a constant column group.

Parameters:
  `cols` - The specific column indexes that is contained in this constant group.
  `value` - The value contained in all cells.
Returns:
  A Constant column group.

#### getColGroupConst

    public static AColGroup getColGroupConst(int[] cols,
                                             double[] values)

Generate a constant column group.

Parameters:
  `cols` - The specific column indexes that is contained in this constant group.
  `values` - The value vector that contains all the unique values for each column in the matrix.
Returns:
  A Constant column group.

#### getColGroupConst

    public static AColGroup getColGroupConst(int numCols,
                                             ADictionary dict)

Generate a constant column group.

Parameters:
  `numCols` - The number of columns.
  `dict` - The dictionary to contain int the Constant group.
Returns:
  A Constant column group.

#### compress

    public static AColGroup compress(int[] colIndexes,
                                     int rlen,
                                     ABitmap ubm,
                                     AColGroup.CompressionType compType,
                                     CompressionSettings cs,
                                     MatrixBlock rawMatrixBlock,
                                     double tupleSparsity)

Method for compressing a column group.

Parameters:
  `colIndexes` - The column indexes to compress
  `rlen` - The number of rows in the columns
  `ubm` - The bitmap containing all the data needed for the compression (unless Uncompressed ColGroup)
  `compType` - The CompressionType selected.
  `cs` - The compression settings used for the given compression.
  `rawMatrixBlock` - The copy of the original input (maybe transposed) MatrixBlock
  `tupleSparsity` - The sparsity of the dictionary when constructed.
Returns:
  A Compressed ColGroup