org.apache.sysds.hops.estim

## Class EstimatorSampleRa

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

    public class EstimatorSampleRa
    extends SparsityEstimator

This estimator implements an approach based on row/column sampling Rasmus Resen Amossen, Andrea Campagna, Rasmus Pagh: Better Size Estimation for Sparse Matrix Products. Algorithmica 69(3): 741-757 (2014) Credit: This code is based on the original implementation provided by the authors, modified to fit the SparsityEstimator API, support binary matrix products, avoid unnecessary file access, use Well1024a for seeding local RNGs, and generally improve performance.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.sysds.hops.estim.SparsityEstimator

`SparsityEstimator.OpCode`

### Field Summary

### Fields inherited from class org.apache.sysds.hops.estim.SparsityEstimator

`MIN_PAR_THRESHOLD, MULTI_THREADED_BUILD, MULTI_THREADED_ESTIM`

### Constructor Summary

Constructors
Constructor and Description
`EstimatorSampleRa()`
`EstimatorSampleRa(double sampleFrac)`
`EstimatorSampleRa(int runs, double sampleFrac, double eps, double delta, int k)`

### Method Summary

All Methods Instance Methods Concrete Methods
`double` `estim(MatrixBlock m1, MatrixBlock m2)` Estimates the output sparsity for a single matrix multiplication.
`double` `estim(MatrixBlock m1, MatrixBlock m2, SparsityEstimator.OpCode op)` Estimates the output sparsity for a given binary operation.
`double` `estim(MatrixBlock m, SparsityEstimator.OpCode op)` Estimates the output sparsity for a given unary operation.
`DataCharacteristics` `estim(MMNode root)` Estimates the output sparsity of a DAG of matrix multiplications for the given operator graph of a single root node.
`double` `h(int x, int y)`
`void` `sortAndTruncate(ArrayList<Double> sketch)`

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

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

### Constructor Detail

#### EstimatorSampleRa

    public EstimatorSampleRa()

#### EstimatorSampleRa

    public EstimatorSampleRa(double sampleFrac)

#### EstimatorSampleRa

    public EstimatorSampleRa(int runs,
                             double sampleFrac,
                             double eps,
                             double delta,
                             int k)

### Method Detail

#### estim

    public DataCharacteristics estim(MMNode root)

Description copied from class: `SparsityEstimator`
Estimates the output sparsity of a DAG of matrix multiplications for the given operator graph of a single root node.

Specified by:
  `estim` in class `SparsityEstimator`
Parameters:
  `root` - DAG root node
Returns:
  output data characteristics

#### estim

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

Description copied from class: `SparsityEstimator`
Estimates the output sparsity for a given binary operation.

Specified by:
  `estim` in class `SparsityEstimator`
Parameters:
  `m1` - left-hand-side operand
  `m2` - right-hand-side operand
  `op` - operator code
Returns:
  sparsity

#### estim

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

Description copied from class: `SparsityEstimator`
Estimates the output sparsity for a given unary operation.

Specified by:
  `estim` in class `SparsityEstimator`
Parameters:
  `m` - left-hand-side operand
  `op` - operator code
Returns:
  sparsity

#### estim

    public double estim(MatrixBlock m1,
                        MatrixBlock m2)

Description copied from class: `SparsityEstimator`
Estimates the output sparsity for a single matrix multiplication.

Specified by:
  `estim` in class `SparsityEstimator`
Parameters:
  `m1` - left-hand-side operand
  `m2` - right-hand-side operand
Returns:
  sparsity

#### sortAndTruncate

    public void sortAndTruncate(ArrayList<Double> sketch)

#### h

    public double h(int x,
                    int y)