Package org.apache.sysds.hops.estim

## Class SparsityEstimator

- java.lang.Object
- - org.apache.sysds.hops.estim.SparsityEstimator

- Direct Known Subclasses:
    `EstimatorBasicAvg`, `EstimatorBasicWorst`, `EstimatorBitsetMM`, `EstimatorDensityMap`, `EstimatorLayeredGraph`, `EstimatorMatrixHistogram`, `EstimatorSample`, `EstimatorSampleRa`

      public abstract class SparsityEstimator
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SparsityEstimator.OpCode` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `MIN_PAR_THRESHOLD` |
    `static boolean` | `MULTI_THREADED_BUILD` |
    `static boolean` | `MULTI_THREADED_ESTIM` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SparsityEstimator()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract DataCharacteristics` | `estim​(MMNode root)` | Estimates the output sparsity of a DAG of matrix multiplications for the given operator graph of a single root node.
    `abstract double` | `estim​(MatrixBlock m, SparsityEstimator.OpCode op)` | Estimates the output sparsity for a given unary operation.
    `abstract double` | `estim​(MatrixBlock m1, MatrixBlock m2)` | Estimates the output sparsity for a single matrix multiplication.
    `abstract double` | `estim​(MatrixBlock m1, MatrixBlock m2, SparsityEstimator.OpCode op)` | Estimates the output sparsity for a given binary operation.

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

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

- - ### Field Detail

    - #### MULTI_THREADED_BUILD

          public static boolean MULTI_THREADED_BUILD

    - #### MULTI_THREADED_ESTIM

          public static boolean MULTI_THREADED_ESTIM

    - #### MIN_PAR_THRESHOLD

          public static final int MIN_PAR_THRESHOLD

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SparsityEstimator

          public SparsityEstimator()

  - ### Method Detail

    - #### estim

          public abstract DataCharacteristics estim​(MMNode root)

      Estimates the output sparsity of a DAG of matrix multiplications for the given operator graph of a single root node.
      Parameters:
        `root` - DAG root node
      Returns:
        output data characteristics

    - #### estim

          public abstract double estim​(MatrixBlock m1,
                                       MatrixBlock m2)

      Estimates the output sparsity for a single matrix multiplication.
      Parameters:
        `m1` - left-hand-side operand
        `m2` - right-hand-side operand
      Returns:
        sparsity

    - #### estim

          public abstract double estim​(MatrixBlock m1,
                                       MatrixBlock m2,
                                       SparsityEstimator.OpCode op)

      Estimates the output sparsity for a given binary operation.
      Parameters:
        `m1` - left-hand-side operand
        `m2` - right-hand-side operand
        `op` - operator code
      Returns:
        sparsity

    - #### estim

          public abstract double estim​(MatrixBlock m,
                                       SparsityEstimator.OpCode op)

      Estimates the output sparsity for a given unary operation.
      Parameters:
        `m` - left-hand-side operand
        `op` - operator code
      Returns:
        sparsity