org.apache.sysds.hops.rewrite

## Class HopRewriteRule

- java.lang.Object
- - org.apache.sysds.hops.rewrite.HopRewriteRule

Direct Known Subclasses:
  RewriteAlgebraicSimplificationDynamic, RewriteAlgebraicSimplificationStatic, RewriteBlockSizeAndReblock, RewriteCommonSubexpressionElimination, RewriteConstantFolding, RewriteElementwiseMultChainOptimization, RewriteFederatedExecution, RewriteGPUSpecificOps, RewriteIndexingVectorization, RewriteInjectSparkPReadCheckpointing, RewriteMatrixMultChainOptimization, RewriteRemoveDanglingParentReferences, RewriteRemovePersistentReadWrite, RewriteRemoveReadAfterWrite, RewriteRemoveUnnecessaryCasts, RewriteTransientWriteParentHandling

    public abstract class HopRewriteRule
    extends Object

Base class for all hop rewrites in order to enable generic application of all rules.

### Constructor Summary

Constructors
Constructor and Description
`HopRewriteRule()`

### Method Summary

All Methods Instance Methods Abstract Methods
`abstract Hop` `rewriteHopDAG(Hop root, ProgramRewriteStatus state)` Handle a predicate hop DAG with exactly one root.
`abstract ArrayList<Hop>` `rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)` Handle a generic (last-level) hop DAG with multiple roots.

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

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

### Constructor Detail

#### HopRewriteRule

    public HopRewriteRule()

### Method Detail

#### rewriteHopDAGs

    public abstract ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots,
                                                  ProgramRewriteStatus state)

Handle a generic (last-level) hop DAG with multiple roots.

Parameters:
  `roots` - high-level operator roots
  `state` - program rewrite status
Returns:
  list of high-level operators

#### rewriteHopDAG

    public abstract Hop rewriteHopDAG(Hop root,
                                      ProgramRewriteStatus state)

Handle a predicate hop DAG with exactly one root.

Parameters:
  `root` - high-level operator root
  `state` - program rewrite status
Returns:
  high-level operator