org.apache.sysds.runtime.compress.colgroup

## Class ColGroupFactory

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

-     public class ColGroupFactory
      extends Object

  Factory pattern for constructing ColGroups.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColGroupFactory()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static List<ColGroup>` | `assignColumns(int numCols, ColGroup[] colGroups, MatrixBlock rawBlock, CompressionSettings compSettings)` Method for producing the final ColGroupList stored inside the CompressedMatrixBlock.
    `static ColGroup` | `compress(int[] colIndexes, int rlen, ABitmap ubm, ColGroup.CompressionType compType, CompressionSettings cs, MatrixBlock rawMatrixBlock)` Method for compressing an ColGroup.
    `static ColGroup[]` | `compressColGroups(MatrixBlock in, HashMap<Integer,Double> compRatios, List<int[]> groups, CompressionSettings compSettings, int k)` The actual compression method, that handles the logic of compressing multiple columns together.

    - ### 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 ColGroup[] compressColGroups(MatrixBlock in,
                                                     HashMap<Integer,Double> compRatios,
                                                     List<int[]> groups,
                                                     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
        `compRatios` - The previously computed Compression ratings of individual col indexes.
        `groups` - The column groups to consider compressing 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.

    - #### compress

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

      Method for compressing an ColGroup.
      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
      Returns:
        A Compressed ColGroup

    - #### assignColumns

          public static List<ColGroup> assignColumns(int numCols,
                                                     ColGroup[] colGroups,
                                                     MatrixBlock rawBlock,
                                                     CompressionSettings compSettings)

      Method for producing the final ColGroupList stored inside the CompressedMatrixBlock. TODO Redesign this method such that it does not utilize the null pointers to decide on which ColGroups should be incompressable. This is done by changing both this method and compressColGroup inside this class.
      Parameters:
        `numCols` - The number of columns in input matrix
        `colGroups` - The colgroups made to assign
        `rawBlock` - The (maybe transposed) original MatrixBlock
        `compSettings` - The Compressionsettings used.
      Returns:
        return the final ColGroupList.

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