Package org.apache.sysds.runtime.matrix.data

## Interface LibMatrixCountDistinct

    public interface LibMatrixCountDistinct

This class contains various methods for counting the number of distinct values inside a MatrixBlock

### Field Summary

Fields
`static org.apache.commons.logging.Log` `LOG`
`static int` `minimumSize` The minimum number NonZero of cells in the input before using approximate techniques for counting number of distinct values.

### Method Summary

Static Methods
`static MatrixBlock` `countDistinctValuesFromSketch​(CorrMatrixBlock arg0, CountDistinctOperator op)`
`static CorrMatrixBlock` `createSketch​(MatrixBlock blkIn, CountDistinctOperator op)`
`static int` `estimateDistinctValues​(MatrixBlock in, CountDistinctOperator op)` Public method to count the number of distinct values inside a matrix.
`static CorrMatrixBlock` `unionSketch​(CorrMatrixBlock arg0, CorrMatrixBlock arg1, CountDistinctOperator op)`

### Field Detail

#### LOG

    static final org.apache.commons.logging.Log LOG

#### minimumSize

    static final int minimumSize

The minimum number NonZero of cells in the input before using approximate techniques for counting number of distinct values.

See Also:
  Constant Field Values

### Method Detail

#### estimateDistinctValues

    static int estimateDistinctValues​(MatrixBlock in,
                                      CountDistinctOperator op)

Public method to count the number of distinct values inside a matrix. Depending on which CountDistinctOperator selected it either gets the absolute number or a estimated value. TODO: Support counting num distinct in rows, or columns axis. TODO: Add support for distributed spark operations TODO: If the MatrixBlock type is CompressedMatrix, simply read the values from the ColGroups.

Parameters:
  `in` - the input matrix to count number distinct values in
  `op` - the selected operator to use
Returns:
  the distinct count

#### countDistinctValuesFromSketch

    static MatrixBlock countDistinctValuesFromSketch​(CorrMatrixBlock arg0,
                                                     CountDistinctOperator op)

#### createSketch

    static CorrMatrixBlock createSketch​(MatrixBlock blkIn,
                                        CountDistinctOperator op)

#### unionSketch

    static CorrMatrixBlock unionSketch​(CorrMatrixBlock arg0,
                                       CorrMatrixBlock arg1,
                                       CountDistinctOperator op)