Package org.apache.sysds.hops.rewrite
Class RewriteElementwiseMultChainOptimization
- java.lang.Object
- 
- org.apache.sysds.hops.rewrite.HopRewriteRule
- 
- org.apache.sysds.hops.rewrite.RewriteElementwiseMultChainOptimization
 
 
- 
 public class RewriteElementwiseMultChainOptimization extends HopRewriteRule Prerequisite: RewriteCommonSubexpressionElimination must run before this rule. Rewrite a chain of element-wise multiply hops that contain identical elements. For example `(B * A) * B` is rewritten to `A * (B^2)` (or `(B^2) * A`), where `^` is element-wise power. The order of the multiplicands depends on their data types, dimensions (matrix or vector), and sparsity. Does not rewrite in the presence of foreign parents in the middle of the e-wise multiply chain, since foreign parents may rely on the individual results. Does not perform rewrites on an element-wise multiply if its dimensions are unknown. The new order of element-wise multiply chains is as follows:(((unknown * object * frame) * ([least-nnz-matrix * matrix] * most-nnz-matrix)) * ([least-nnz-row-vector * row-vector] * most-nnz-row-vector)) * ([[scalars * least-nnz-col-vector] * col-vector] * most-nnz-col-vector)Identical elements are replaced with powers.
- 
- 
Constructor SummaryConstructors Constructor Description RewriteElementwiseMultChainOptimization()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description HoprewriteHopDAG(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.
 
- 
- 
- 
Method Detail- 
rewriteHopDAGspublic ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) Description copied from class:HopRewriteRuleHandle a generic (last-level) hop DAG with multiple roots.- Specified by:
- rewriteHopDAGsin class- HopRewriteRule
- Parameters:
- roots- high-level operator roots
- state- program rewrite status
- Returns:
- list of high-level operators
 
 - 
rewriteHopDAGpublic Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) Description copied from class:HopRewriteRuleHandle a predicate hop DAG with exactly one root.- Specified by:
- rewriteHopDAGin class- HopRewriteRule
- Parameters:
- root- high-level operator root
- state- program rewrite status
- Returns:
- high-level operator
 
 
- 
 
-