Package org.apache.sysds.hops.rewrite

# Class RewriteMatrixMultChainWithTransOptimization

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

public class RewriteMatrixMultChainWithTransOptimization extends HopRewriteRule
Advanced Matrix Multiplication Chain Optimizer using Dynamic Programming.

This rewrite optimizes matrix multiplication chains by simultaneously exploring standard parenthesization and the transpose property: (A %*% B)^T = B^T %*% A^T. It uses a DP algorithm to find the execution plan with the minimal computational cost (FLOPs), inserting physical transposes only when mathematically cheaper. In comparison to RewriteMatrixMultChainOptimization.java this builds complete new HOP DAG and returns it

## Constructor Summary

Constructors
Constructor
Description
`RewriteMatrixMultChainWithTransOptimization()`

## Method Summary

Modifier and Type
Method
Description
`Hop`
`rewriteHopDAG(Hop root, ProgramRewriteStatus state)`
Handle a predicate hop DAG with exactly one root.
`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 Details

### RewriteMatrixMultChainWithTransOptimization

public RewriteMatrixMultChainWithTransOptimization()

## Method Details

### rewriteHopDAGs

public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
Description copied from class: `HopRewriteRule`
Handle a generic (last-level) hop DAG with multiple roots.

Specified by:
  `rewriteHopDAGs` in class `HopRewriteRule`
Parameters:
  `roots` - high-level operator roots
  `state` - program rewrite status
Returns:
  list of high-level operators

### rewriteHopDAG

public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
Description copied from class: `HopRewriteRule`
Handle a predicate hop DAG with exactly one root.

Specified by:
  `rewriteHopDAG` in class `HopRewriteRule`
Parameters:
  `root` - high-level operator root
  `state` - program rewrite status
Returns:
  high-level operator