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 Details

    • RewriteElementwiseMultChainOptimization

      public RewriteElementwiseMultChainOptimization()
  • Method Details