Class TemplateUtils

java.lang.Object
org.apache.sysds.hops.codegen.template.TemplateUtils

public class TemplateUtils extends Object
  • Field Details

  • Constructor Details

    • TemplateUtils

      public TemplateUtils()
  • Method Details

    • isVector

      public static boolean isVector(Hop hop)
    • isColVector

      public static boolean isColVector(Hop hop)
    • isColVector

      public static boolean isColVector(CNode hop)
    • isRowVector

      public static boolean isRowVector(CNode hop)
    • isMatrix

      public static boolean isMatrix(CNode hop)
    • wrapLookupIfNecessary

      public static CNode wrapLookupIfNecessary(CNode node, Hop hop)
    • wrapLookupIfNecessary

      public static CNode wrapLookupIfNecessary(CNode node, Hop hop, boolean rowTpl)
    • isMatrix

      public static boolean isMatrix(Hop hop)
    • isVectorOrScalar

      public static boolean isVectorOrScalar(Hop hop)
    • isBinaryMatrixRowVector

      public static boolean isBinaryMatrixRowVector(Hop hop)
    • isBinaryMatrixColVector

      public static boolean isBinaryMatrixColVector(Hop hop)
    • hasMatrixInput

      public static boolean hasMatrixInput(Hop hop)
    • isOperationSupported

      public static boolean isOperationSupported(Hop h)
    • createTemplate

      public static TemplateBase createTemplate(TemplateBase.TemplateType type)
    • createTemplate

      public static TemplateBase createTemplate(TemplateBase.TemplateType type, TemplateBase.CloseType ctype)
    • createCompatibleTemplates

      public static TemplateBase[] createCompatibleTemplates(TemplateBase.TemplateType type, TemplateBase.CloseType ctype)
    • getCellType

      public static SpoofCellwise.CellType getCellType(Hop hop)
    • getRowType

      public static SpoofRowwise.RowType getRowType(Hop output, Hop... inputs)
    • getAggOp

      public static Types.AggOp getAggOp(Hop hop)
    • getOuterProductType

      public static SpoofOuterProduct.OutProdType getOuterProductType(Hop X, Hop U, Hop V, Hop out)
    • getLiteral

      public static CNodeData getLiteral(CNode node)
    • isLiteral

      public static boolean isLiteral(CNode node)
    • isLiteral

      public static boolean isLiteral(CNode node, String val)
    • isLookup

      public static boolean isLookup(CNode node, boolean includeRC1)
    • isUnary

      public static boolean isUnary(CNode node, CNodeUnary.UnaryType... types)
    • isUnaryRowAgg

      public static boolean isUnaryRowAgg(CNode node)
    • isBinary

      public static boolean isBinary(CNode node, CNodeBinary.BinType... types)
    • rIsSparseSafeOnly

      public static boolean rIsSparseSafeOnly(CNode node, CNodeBinary.BinType... types)
    • rContainsInput

      public static boolean rContainsInput(CNode node, long hopID)
    • isTernary

      public static boolean isTernary(CNode node, CNodeTernary.TernaryType... types)
    • createCNodeData

      public static CNodeData createCNodeData(Hop hop, boolean compileLiterals)
    • skipTranspose

      public static CNode skipTranspose(CNode cdataOrig, Hop hop, HashMap<Long,CNode> tmp, boolean compileLiterals)
    • findRemovableConditionalPatternInOuterProduct

      public static LinkedList<Long> findRemovableConditionalPatternInOuterProduct(Hop hop)
    • skipConditionalInOuterProduct

      public static long skipConditionalInOuterProduct(Hop hop, HashMap<Long,CNode> tmp, HashSet<Hop> inHops)
    • hasTransposeParentUnderOuterProduct

      public static boolean hasTransposeParentUnderOuterProduct(Hop hop)
    • hasSingleOperation

      public static boolean hasSingleOperation(CNodeTpl tpl)
    • isValidSingleOperation

      public static boolean isValidSingleOperation(Hop hop)
    • hasNoOperation

      public static boolean hasNoOperation(CNodeTpl tpl)
    • hasOnlyDataNodeOrLookupInputs

      public static boolean hasOnlyDataNodeOrLookupInputs(CNode node)
    • determineMinVectorIntermediates

      public static int determineMinVectorIntermediates(CNode node, CNode main)
    • isUnaryOperatorPipeline

      public static boolean isUnaryOperatorPipeline(CNode node)
    • getMaxVectorIntermediates

      public static int getMaxVectorIntermediates(CNode node)
    • countVectorIntermediates

      public static int countVectorIntermediates(CNode node)
    • getMaxLiveVectorIntermediates

      public static int getMaxLiveVectorIntermediates(CNode node, CNode main, Map<Long,Set<Long>> parents, Set<org.apache.commons.lang3.tuple.Pair<Long,Long>> stack)
    • isValidNumVectorIntermediates

      public static boolean isValidNumVectorIntermediates(CNode node, CNode main, Map<Long,Set<Long>> parents, Map<Long,org.apache.commons.lang3.tuple.Pair<Long,org.apache.commons.lang3.mutable.MutableInt>> inUse, Set<Long> inUse2, int count)
    • rIsValidNumVectorIntermediates

      public static boolean rIsValidNumVectorIntermediates(CNode node, CNode main, Map<Long,Set<Long>> parents, Map<Long,org.apache.commons.lang3.tuple.Pair<Long,org.apache.commons.lang3.mutable.MutableInt>> inUse, Set<Long> inUse2, IDSequence buff)
    • getAllParents

      public static Map<Long,Set<Long>> getAllParents(CNode node)
    • getAllParents

      public static void getAllParents(CNode node, Map<Long,Set<Long>> parents)
    • isType

      public static boolean isType(TemplateBase.TemplateType type, TemplateBase.TemplateType... validTypes)
    • hasCommonRowTemplateMatrixInput

      public static boolean hasCommonRowTemplateMatrixInput(Hop input1, Hop input2, CPlanMemoTable memo)
    • getRowTemplateMatrixInput

      public static long getRowTemplateMatrixInput(Hop current, CPlanMemoTable memo)
    • containsBinary

      public static boolean containsBinary(CNode node, CNodeBinary.BinType type)
    • rContainsBinary

      public static boolean rContainsBinary(CNode node, CNodeBinary.BinType type)
    • containsOuterProduct

      public static boolean containsOuterProduct(Hop hop)
    • containsOuterProduct

      public static boolean containsOuterProduct(Hop hop, Hop probe)
    • rFlipVectorLookups

      public static void rFlipVectorLookups(CNode current)
    • containsFusedRowVecAgg

      public static boolean containsFusedRowVecAgg(CNodeTpl tpl)