Package 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

Modifier and Type
Method
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, int k)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, CompressionSettingsBuilder compSettings)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, CompressionSettingsBuilder compSettings, ACostEstimate costEstimator)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, CompressionSettingsBuilder compSettings, CostEstimatorBuilder csb)`
The main method for compressing the input matrix.
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, CompressionSettingsBuilder 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, ACostEstimate costEstimator)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, CostEstimatorBuilder csb)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, int k, InstructionTypeCounter ins)`
`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, CompressionSettingsBuilder customSettings)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, ACostEstimate costEstimator)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, CostEstimatorBuilder csb)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, InstructionTypeCounter ins)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, WTreeRoot root)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, ScalarObject sf, int k, WTreeRoot root)`
`static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics>`
`compress(MatrixBlock mb, MatrixBlock sf, int k, WTreeRoot root)`
`static Future<Void>`
`compressAsync(ExecutionContext ec, String varName)`
`static Future<Void>`
`compressAsync(ExecutionContext ec, String varName, InstructionTypeCounter ins)`
`static CompressedMatrixBlock`
`createConstant(int numRows, int numCols, double value)`
Method for constructing a compressed matrix out of an constant input.
`static CompressedMatrixBlock`
`genUncompressedCompressedMatrixBlock(MatrixBlock mb)`
Generate a CompressedMatrixBlock Object that contains a single uncompressed matrix block column group.
`static boolean`
`transposeHeuristics(int nGroups, MatrixBlock mb)`

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

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

## Method Details

### 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, CostEstimatorBuilder csb)

### compress

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

### compress

public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb, CompressionSettingsBuilder 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, MatrixBlock sf, int k, WTreeRoot root)

### compress

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

### compress

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

### compress

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

### compress

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

### compress

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

### compress

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

### compressAsync

public static Future<Void> compressAsync(ExecutionContext ec, String varName)

### compressAsync

public static Future<Void> compressAsync(ExecutionContext ec, String varName, InstructionTypeCounter ins)

### compress

public static org.apache.commons.lang3.tuple.Pair<MatrixBlock,CompressionStatistics> compress(MatrixBlock mb, int k, CompressionSettingsBuilder 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, CompressionSettingsBuilder compSettings, CostEstimatorBuilder csb)
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
  `csb` - The cost estimation builder
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, CompressionSettingsBuilder compSettings, ACostEstimate costEstimator)

### genUncompressedCompressedMatrixBlock

public static CompressedMatrixBlock genUncompressedCompressedMatrixBlock(MatrixBlock mb)
Generate a CompressedMatrixBlock Object that contains a single uncompressed matrix block column group. Note this could be an empty colgroup if the input is empty.

Parameters:
  `mb` - The matrix block to be contained in the uncompressed matrix block column,
Returns:
  a CompressedMatrixBlock

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

### transposeHeuristics

public static boolean transposeHeuristics(int nGroups, MatrixBlock mb)