org.apache.sysds.runtime.matrix.data

## Class LibMatrixCountDistinct

- java.lang.Object
- - org.apache.sysds.runtime.matrix.data.LibMatrixCountDistinct

    public class LibMatrixCountDistinct
    extends Object

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

### Field Summary

Fields
`static int` `minimumSize` The minimum number NonZero of cells in the input before using approximate techniques for counting number of distinct values.

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `estimateDistinctValues(MatrixBlock in, CountDistinctOperator op)` Public method to count the number of distinct values inside a matrix.

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

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

### Field Detail

#### minimumSize

    public static int minimumSize

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

### Method Detail

#### estimateDistinctValues

    public 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 vaules from the ColGroups.

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