org.apache.sysds.runtime.compress

## Class CompressedMatrixBlockFactory

- java.lang.Object
- - org.apache.sysds.runtime.compress.CompressedMatrixBlockFactory

-     public class CompressedMatrixBlockFactory
      extends Object

  Factory pattern to compress a Matrix Block into a CompressedMatrixBlock.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb)` Default sequential compression with no parallelization
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, CompressionSettings customSettings)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k, CompressionSettings compSettings)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k, CompressionSettings compSettings, ICostEstimate costEstimator)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k, CompressionSettings compSettings, WTreeRoot root)` The main method for compressing the input matrix.
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k, ICostEstimate costEstimator)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, int k, WTreeRoot root)`
    `static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>` | `compress(MatrixBlock mb, WTreeRoot root)`
    `static CompressedMatrixBlock` | `createConstant(int numRows, int numCols, double value)` Method for constructing a compressed matrix out of an constant input.
    `double` | `getLastTimePhase()`
    `void` | `setNextTimePhase(double time)`

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

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

- - ### Method Detail

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb)

      Default sequential compression with no parallelization
      Parameters:
        `mb` - The matrixBlock to compress
      Returns:
        A Pair of a Matrix Block and Compression Statistics.

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        WTreeRoot root)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        CompressionSettings customSettings)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k,
                                                                                                        WTreeRoot root)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k,
                                                                                                        ICostEstimate costEstimator)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k,
                                                                                                        CompressionSettings compSettings)

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k,
                                                                                                        CompressionSettings compSettings,
                                                                                                        WTreeRoot root)

      The main method for compressing the input matrix.
      Parameters:
        `mb` - The matrix block to compress
        `k` - The number of threads used to execute the compression
        `compSettings` - The Compression settings used
        `root` - The root instruction compressed, and used for calculating the computation cost of the compression
      Returns:
        A pair of an possibly compressed matrix block and compression statistics.

    - #### compress

          public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb,
                                                                                                        int k,
                                                                                                        CompressionSettings compSettings,
                                                                                                        ICostEstimate costEstimator)

    - #### createConstant

          public static CompressedMatrixBlock createConstant(int numRows,
                                                             int numCols,
                                                             double value)

      Method for constructing a compressed matrix out of an constant input. Since the input is a constant value it is trivially compressable, therefore we skip the entire compression planning and directly return a compressed constant matrix
      Parameters:
        `numRows` - The number of Rows in the matrix
        `numCols` - The number of Columns in the matrix
        `value` - The value contained in the matrix
      Returns:
        The Compressed Constant matrix.

    - #### setNextTimePhase

          public void setNextTimePhase(double time)

    - #### getLastTimePhase

          public double getLastTimePhase()

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