Package org.apache.sysds.hops.rewrite

# Class HopRewriteUtils

java.lang.Object
org.apache.sysds.hops.rewrite.HopRewriteUtils

public class HopRewriteUtils extends Object

## Constructor Summary

Constructors
Constructor
Description
`HopRewriteUtils()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`addChildReference(Hop parent, Hop child)`
`static void`
`addChildReference(Hop parent, Hop child, int pos)`
`static boolean`
`alwaysRequiresReblock(Hop hop)`
`static boolean`
`checkAvgRowsGteCols(List<Hop> list)`
`static boolean`
`checkConsistentRows(List<Hop> list1, List<Hop> list2)`
`static boolean`
`checkInputDataTypes(Hop hop, Types.DataType... dt)`
`static void`
`cleanupUnreferenced(Hop... inputs)`
`static int`
`compareSize(Hop hop1, Hop hop2)`
Compares the size of outputs from hop1 and hop2, in terms of number of matrix cells.
`static boolean`
`containsInput(Hop current, Hop probe)`
`static boolean`
`containsOp(List<Hop> candidates, Class<? extends Hop> clazz)`
`static boolean`
`containsSecondOrderBuiltin(List<Hop> roots)`
`static boolean`
`containsTransposeOperation(List<Hop> hops)`
`static DataGenOp`
`copyDataGenOp(DataGenOp inputGen, double scale, double shift)`
Assumes that min and max are literal ops, needs to be checked from outside.
`static void`
`copyLineNumbers(Hop src, Hop dest)`
`static void`
`copyLineNumbers(MatrixObject mo, Hop tread)`
`static void`
`copyLineNumbers(MatrixBlock mb, Hop tread)`
`static AggUnaryOp`
`createAggUnaryOp(Hop input, String op)`
`static AggUnaryOp`
`createAggUnaryOp(Hop input, Types.AggOp op, Types.Direction dir)`
`static BinaryOp`
`createBinary(Hop input1, Hop input2, String op)`
`static BinaryOp`
`createBinary(Hop input1, Hop input2, Types.OpOp2 op)`
`static BinaryOp`
`createBinary(Hop input1, Hop input2, Types.OpOp2 op, boolean outer)`
`static BinaryOp`
`createBinaryMinus(Hop input)`
`static Hop`
`createComputeNnz(Hop input)`
`static Hop`
`createDataGenOp(Hop rowInput, boolean tRowInput, Hop colInput, boolean tColInput, double value)`
`static Hop`
`createDataGenOp(Hop input, double value)`
`static Hop`
`createDataGenOp(Hop rowInput, Hop colInput, double value)`
`static Hop`
`createDataGenOpByVal(List<LiteralOp> values, long rows, long cols)`
`static Hop`
`createDataGenOpByVal(Hop rowInput, Hop colInput, Hop dimsInput, Types.DataType dt, Types.ValueType vt, double value)`
`static DataOp`
`createDataOp(String name, Hop in, Types.OpOpData type)`
`static IndexingOp`
`createIndexingOp(Hop input, long rix, long cix)`
`static IndexingOp`
`createIndexingOp(Hop input, long rl, long ru, long cl, long cu)`
`static IndexingOp`
`createIndexingOp(Hop input, Hop batchsize)`
`static IndexingOp`
`createIndexingOp(Hop input, Hop rl, Hop ru, Hop cl, Hop cu)`
`static LeftIndexingOp`
`createLeftIndexingOp(Hop lhs, Hop rhs, Hop rl, Hop ru, Hop cl, Hop cu)`
`static AggBinaryOp`
`createMatrixMultiply(Hop left, Hop right)`
`static NaryOp`
`createNary(Types.OpOpN op, Hop... inputs)`
`static ParameterizedBuiltinOp`
`createParameterizedBuiltinOp(Hop input, LinkedHashMap<String,Hop> args, Types.ParamBuiltinOp op)`
`static Hop`
`createPartialTsmmCbind(Hop X, Hop deltaX, Hop tsmmIn1)`
`static ReorgOp`
`createReorg(List<Hop> inputs, Types.ReOrgOp rop)`
`static ReorgOp`
`createReorg(Hop input, String rop)`
`static ReorgOp`
`createReorg(Hop input, Types.ReOrgOp rop)`
`static Hop`
`createScalarIndexing(Hop input, long rix, long cix)`
`static DataGenOp`
`createSeqDataGenOp(Hop input)`
`static DataGenOp`
`createSeqDataGenOp(Hop input, boolean asc)`
`static DataGenOp`
`createSeqDataGenOp(Hop proxy, Hop from, Hop to, Hop incr)`
`static AggUnaryOp`
`createSum(Hop input)`
`static TernaryOp`
`createTernary(Hop mleft, Hop smid, Hop mright, String opcode)`
`static TernaryOp`
`createTernary(Hop mleft, Hop smid, Hop mright, Types.OpOp3 op)`
`static TernaryOp`
`createTernary(Hop in1, Hop in2, Hop in3, Hop in4, Hop in5, Types.OpOp3 op)`
`static DataOp`
`createTransientRead(String name, Hop h)`
`static DataOp`
`createTransientRead(String name, MatrixObject mo)`
`static DataOp`
`createTransientRead(String name, MatrixBlock mb)`
`static DataOp`
`createTransientWrite(String name, Hop in)`
`static ReorgOp`
`createTranspose(Hop input)`
`static AggBinaryOp`
`createTsmm(Hop input, boolean left)`
`static UnaryOp`
`createUnary(Hop input, String type)`
`static UnaryOp`
`createUnary(Hop input, Types.OpOp1 type)`
`static Hop`
`createValueHop(Hop hop, boolean row)`
`static Hop`
`getBasic1NSequenceMax(Hop hop)`
`static boolean`
`getBooleanValue(LiteralOp op)`
`static boolean`
`getBooleanValueSafe(LiteralOp op)`
`static int`
`getChildReferencePos(Hop parent, Hop child)`
`static Hop`
`getDataGenOpConstantValue(Hop hop)`
`static double`
`getDoubleValue(LiteralOp op)`
`static double`
`getDoubleValueSafe(LiteralOp op)`
`static long`
`getIntValue(LiteralOp op)`
Return the int value of a LiteralOp (as a long).
`static long`
`getIntValueSafe(Hop op)`
`static long`
`getIntValueSafe(LiteralOp op)`
`static Hop`
`getLargestInput(Hop hop)`
`static long`
`getMaxInputDim(Hop hop, boolean dim1)`
`static long`
`getMaxInputDim(DataCharacteristics[] dc, boolean dim1)`
`static long`
`getMaxNcolInput(Hop hop)`
`static long`
`getMaxNrowInput(Hop hop)`
`static Hop`
`getOtherInput(Hop hop, Hop input)`
`static ScalarObject`
`getScalarObject(LiteralOp op)`
`static long`
`getSumValidInputDims(Hop hop, boolean dim1)`
`static long`
`getSumValidInputDims(DataCharacteristics[] mc, boolean dim1)`
`static long`
`getSumValidInputNnz(Hop hop)`
`static long`
`getSumValidInputNnz(DataCharacteristics[] mc, boolean worstcase)`
`static int`
`getValidOpPos(Types.OpOp2 input, Types.OpOp2... validTab)`
`static boolean`
`hasListInputs(Hop hop)`
`static boolean`
`hasOnlyUnaryBinaryParents(Hop hop, boolean disallowLhs)`
`static boolean`
`hasOnlyWriteParents(Hop hop, boolean inclTransient, boolean inclPersistent)`
`static boolean`
`hasValidInputDims(Hop hop, boolean dim1)`
`static boolean`
`hasValidInputDims(DataCharacteristics[] mc, boolean dim1)`
`static boolean`
`hasValidInputNnz(Hop hop)`
`static boolean`
`hasValidInputNnz(DataCharacteristics[] mc, boolean worstcase)`
`static boolean`
`isAggUnaryOp(Hop hop, Types.AggOp... op)`
`static boolean`
`isAggUnaryOp(Hop hop, Types.AggOp op, Types.Direction dir)`
`static boolean`
`isBasic1NSequence(Hop hop)`
`static boolean`
`isBasic1NSequence(Hop seq, Hop input, boolean row)`
`static boolean`
`isBasicN1Sequence(Hop hop)`
`static boolean`
`isBinary(Hop hop, Types.OpOp2 type)`
`static boolean`
`isBinary(Hop hop, Types.OpOp2... types)`
`static boolean`
`isBinary(Hop hop, Types.OpOp2 type, int maxParents)`
`static boolean`
`isBinaryMatrixColVectorOperation(Hop hop)`
`static boolean`
`isBinaryMatrixMatrixOperation(Hop hop)`
`static boolean`
`isBinaryMatrixMatrixOperationWithSharedInput(Hop hop)`
`static boolean`
`isBinaryMatrixRowVectorOperation(Hop hop)`
`static boolean`
`isBinaryMatrixScalar(Hop hop, Types.OpOp2 type, double val)`
`static boolean`
`isBinaryMatrixScalarOperation(Hop hop)`
`static boolean`
`isBinaryPPred(Hop hop)`
`static boolean`
`isBinarySparseSafe(Hop hop)`
`static boolean`
`isColumnRangeIndexing(IndexingOp hop)`
`static boolean`
`isColumnRightIndexing(Hop hop)`
`static boolean`
`isConsecutiveIndex(Hop index, Hop index2)`
`static boolean`
`isData(Hop hop, Types.OpOpData type)`
`static boolean`
`isData(Hop hop, Types.OpOpData... types)`
`static boolean`
`isData(Hop hop, Types.OpOpData type, Types.DataType dt)`
`static boolean`
`isDataGenOp(Hop hop, Types.OpOpDG... ops)`
`static boolean`
`isDataGenOpWithConstantValue(Hop hop)`
`static boolean`
`isDataGenOpWithConstantValue(Hop hop, double value)`
`static boolean`
`isDataGenOpWithLiteralInputs(Hop hop, Types.OpOpDG... ops)`
`static boolean`
`isDataGenOpWithNonDeterminism(Hop hop)`
`static boolean`
`isDense(Hop hop)`
`static boolean`
`isDimsKnown(Hop hop)`
`static boolean`
`isDnn(Hop hop, Types.OpOpDnn type)`
`static boolean`
`isDnn(Hop hop, Types.OpOpDnn... types)`
`static boolean`
`isEmpty(Hop hop)`
`static boolean`
`isEqualMatrixSize(BinaryOp hop)`
`static boolean`
`isEqualSize(Hop hop1, Hop hop2)`
`static boolean`
`isEqualSize(Hop hop1, Hop... hops)`
`static boolean`
`isEqualValue(Hop hop1, Hop hop2)`
`static boolean`
`isEqualValue(LiteralOp hop1, LiteralOp hop2)`
`static boolean`
`isFullColumnIndexing(IndexingOp hop)`
`static boolean`
`isFullColumnIndexing(LeftIndexingOp hop)`
`static boolean`
`isFullRowIndexing(IndexingOp hop)`
`static boolean`
`isFullRowIndexing(LeftIndexingOp hop)`
`static boolean`
`isLastLevelLoopStatementBlock(StatementBlock sb)`
`static boolean`
`isLastLevelStatementBlock(StatementBlock sb)`
`static boolean`
`isLiteralOfValue(Hop hop, boolean val)`
`static boolean`
`isLiteralOfValue(Hop hop, double val)`
`static boolean`
`isLiteralOfValue(Hop hop, Double... val)`
`static boolean`
`isLiteralOfValue(Hop hop, String val)`
`static boolean`
`isLoopStatementBlock(StatementBlock sb)`
`static boolean`
`isMatrixMultiply(Hop hop)`
`static boolean`
`isNary(Hop hop, Types.OpOpN type)`
`static boolean`
`isNary(Hop hop, Types.OpOpN... types)`
`static boolean`
`isNonZeroIndicator(Hop pred, Hop hop)`
`static boolean`
`isNotMatrixVectorBinaryOperation(Hop hop)`
`static boolean`
`isOuterBinary(Hop hop)`
`static boolean`
`isOuterProductLikeMM(Hop hop)`
`static boolean`
`isParameterizedBuiltinOp(Hop hop, Types.ParamBuiltinOp type)`
`static boolean`
`isParameterizedBuiltinOp(Hop hop, Types.ParamBuiltinOp... types)`
`static boolean`
`isRemoveEmpty(Hop hop)`
`static boolean`
`isRemoveEmpty(Hop hop, boolean rows)`
`static boolean`
`isReorg(Hop hop, Types.ReOrgOp type)`
`static boolean`
`isReorg(Hop hop, Types.ReOrgOp... types)`
`static boolean`
`isScalarMatrixBinaryMult(Hop hop)`
`static boolean`
`isSingleBlock(Hop hop)`
`static boolean`
`isSingleBlock(Hop hop, boolean cols)`
Checks our BLOCKSIZE CONSTRAINT, w/ awareness of forced single node execution mode.
`static boolean`
`isSizeExpressionOf(Hop size, Hop input, boolean row)`
`static boolean`
`isSparse(Hop hop)`
`static boolean`
`isSparse(Hop hop, double threshold)`
`static boolean`
`isSum(Hop hop)`
`static boolean`
`isSumSq(Hop hop)`
`static boolean`
`isTerminalHop(Hop hop)`
Check if given hop is of a terminal type.
`static boolean`
`isTernary(Hop hop, Types.OpOp3 type)`
`static boolean`
`isTernary(Hop hop, Types.OpOp3... types)`
`static boolean`
`isTransformEncode(Hop hop)`
`static boolean`
`isTransposeOfItself(Hop hop1, Hop hop2)`
`static boolean`
`isTransposeOperation(Hop hop)`
`static boolean`
`isTransposeOperation(Hop hop, int maxParents)`
`static boolean`
`isTsmm(Hop input)`
`static boolean`
`isTsmmInput(Hop input)`
`static boolean`
`isUnary(Hop hop, Types.OpOp1 type)`
`static boolean`
`isUnary(Hop hop, Types.OpOp1... types)`
`static boolean`
`isUnary(Hop hop, Types.OpOp1 type, int maxParents)`
`static boolean`
`isUnnecessaryRightIndexing(Hop hop)`
`static boolean`
`isValidOp(Types.AggOp input, Types.AggOp... validTab)`
`static boolean`
`isValidOp(Types.OpOp1 input, Types.OpOp1... validTab)`
`static boolean`
`isValidOp(Types.OpOp2 input, Types.OpOp2... validTab)`
`static boolean`
`isValidOp(Types.ParamBuiltinOp input, Types.ParamBuiltinOp... validTab)`
`static boolean`
`isValidOp(Types.ReOrgOp input, Types.ReOrgOp... validTab)`
`static boolean`
`isValidOuterBinaryOp(Types.OpOp2 op)`
`static boolean`
`isValueTypeCast(Types.OpOp1 op)`
`static boolean`
`knownParamservFunctions(Hop hop)`
`static boolean`
`knownParamservFunctions(Hop hop, DMLProgram prog)`
`static boolean`
`rContainsRead(Hop root, String var, boolean includeMetaOp)`
`static void`
`refreshOutputParameters(Hop hnew, Hop hold)`
`static void`
`removeAllChildReferences(Hop parent)`
`static void`
`removeChildReference(Hop parent, Hop child)`
`static void`
`removeChildReferenceByPos(Hop parent, Hop child, int posChild)`
`static void`
`replaceChildReference(Hop parent, Hop inOld, Hop inNew)`
`static void`
`replaceChildReference(Hop parent, Hop inOld, Hop inNew, int pos)`
`static void`
`replaceChildReference(Hop parent, Hop inOld, Hop inNew, int pos, boolean refresh)`
`static Hop`
`rewireAllParentChildReferences(Hop hold, Hop hnew)`
Replace an old Hop with a replacement Hop.
`static boolean`
`rHasSimpleReadChain(Hop root, String var)`
`static void`
`setOutputParameters(Hop hop, long rlen, long clen, int blen, long nnz)`
`static void`
`setOutputParametersForScalar(Hop hop)`
`static void`
`setUnoptimizedFunctionCalls(StatementBlock sb)`
`static void`
`updateHopCharacteristics(Hop hop, int blen, Hop src)`
`static void`
`updateHopCharacteristics(Hop hop, int blen, MemoTable memo, Hop src)`

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

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

## Constructor Details

### HopRewriteUtils

public HopRewriteUtils()

## Method Details

### isValueTypeCast

public static boolean isValueTypeCast(Types.OpOp1 op)

### getBooleanValue

public static boolean getBooleanValue(LiteralOp op)

### getBooleanValueSafe

public static boolean getBooleanValueSafe(LiteralOp op)

### getDoubleValue

public static double getDoubleValue(LiteralOp op)

### getDoubleValueSafe

public static double getDoubleValueSafe(LiteralOp op)

### getIntValue

public static long getIntValue(LiteralOp op)
Return the int value of a LiteralOp (as a long). Note: For comparisons, this is *only* to be used in situations in which the value is absolutely guaranteed to be an integer. Otherwise, a safer alternative is `getDoubleValue`.

Parameters:
  `op` - literal operator
Returns:
  long value of literal op

### getIntValueSafe

public static long getIntValueSafe(Hop op)

### getIntValueSafe

public static long getIntValueSafe(LiteralOp op)

### isLiteralOfValue

public static boolean isLiteralOfValue(Hop hop, Double... val)

### isLiteralOfValue

public static boolean isLiteralOfValue(Hop hop, double val)

### isLiteralOfValue

public static boolean isLiteralOfValue(Hop hop, String val)

### isLiteralOfValue

public static boolean isLiteralOfValue(Hop hop, boolean val)

### getScalarObject

public static ScalarObject getScalarObject(LiteralOp op)

### getChildReferencePos

public static int getChildReferencePos(Hop parent, Hop child)

### removeChildReference

public static void removeChildReference(Hop parent, Hop child)

### removeChildReferenceByPos

public static void removeChildReferenceByPos(Hop parent, Hop child, int posChild)

### removeAllChildReferences

public static void removeAllChildReferences(Hop parent)

### addChildReference

public static void addChildReference(Hop parent, Hop child)

### addChildReference

public static void addChildReference(Hop parent, Hop child, int pos)

### rewireAllParentChildReferences

public static Hop rewireAllParentChildReferences(Hop hold, Hop hnew)
Replace an old Hop with a replacement Hop. If the old Hop has no parents, then return the replacement. Otherwise rewire each of the Hop's parents into the replacement and return the replacement.

Parameters:
  `hold` - To be replaced
  `hnew` - The replacement
Returns:
  hnew

### replaceChildReference

public static void replaceChildReference(Hop parent, Hop inOld, Hop inNew)

### replaceChildReference

public static void replaceChildReference(Hop parent, Hop inOld, Hop inNew, int pos)

### replaceChildReference

public static void replaceChildReference(Hop parent, Hop inOld, Hop inNew, int pos, boolean refresh)

### cleanupUnreferenced

public static void cleanupUnreferenced(Hop... inputs)

### getOtherInput

public static Hop getOtherInput(Hop hop, Hop input)

### getLargestInput

public static Hop getLargestInput(Hop hop)

### createDataGenOp

public static Hop createDataGenOp(Hop input, double value)

### copyDataGenOp

public static DataGenOp copyDataGenOp(DataGenOp inputGen, double scale, double shift)
Assumes that min and max are literal ops, needs to be checked from outside.

Parameters:
  `inputGen` - input data gen op
  `scale` - the scale
  `shift` - the shift
Returns:
  data gen op

### createDataGenOp

public static Hop createDataGenOp(Hop rowInput, Hop colInput, double value)

### createDataGenOp

public static Hop createDataGenOp(Hop rowInput, boolean tRowInput, Hop colInput, boolean tColInput, double value)

### createDataGenOpByVal

public static Hop createDataGenOpByVal(Hop rowInput, Hop colInput, Hop dimsInput, Types.DataType dt, Types.ValueType vt, double value)

### createDataGenOpByVal

public static Hop createDataGenOpByVal(List<LiteralOp> values, long rows, long cols)

### isDataGenOp

public static boolean isDataGenOp(Hop hop, Types.OpOpDG... ops)

### isDataGenOpWithLiteralInputs

public static boolean isDataGenOpWithLiteralInputs(Hop hop, Types.OpOpDG... ops)

### isDataGenOpWithConstantValue

public static boolean isDataGenOpWithConstantValue(Hop hop)

### isDataGenOpWithConstantValue

public static boolean isDataGenOpWithConstantValue(Hop hop, double value)

### isDataGenOpWithNonDeterminism

public static boolean isDataGenOpWithNonDeterminism(Hop hop)

### getDataGenOpConstantValue

public static Hop getDataGenOpConstantValue(Hop hop)

### createTransientRead

public static DataOp createTransientRead(String name, Hop h)

### createTransientRead

public static DataOp createTransientRead(String name, MatrixBlock mb)

### createTransientRead

public static DataOp createTransientRead(String name, MatrixObject mo)

### createTransientWrite

public static DataOp createTransientWrite(String name, Hop in)

### createDataOp

public static DataOp createDataOp(String name, Hop in, Types.OpOpData type)

### createTranspose

public static ReorgOp createTranspose(Hop input)

### createReorg

public static ReorgOp createReorg(Hop input, String rop)

### createReorg

public static ReorgOp createReorg(Hop input, Types.ReOrgOp rop)

### createReorg

public static ReorgOp createReorg(List<Hop> inputs, Types.ReOrgOp rop)

### createUnary

public static UnaryOp createUnary(Hop input, String type)

### createUnary

public static UnaryOp createUnary(Hop input, Types.OpOp1 type)

### createBinaryMinus

public static BinaryOp createBinaryMinus(Hop input)

### createBinary

public static BinaryOp createBinary(Hop input1, Hop input2, String op)

### createBinary

public static BinaryOp createBinary(Hop input1, Hop input2, Types.OpOp2 op)

### createBinary

public static BinaryOp createBinary(Hop input1, Hop input2, Types.OpOp2 op, boolean outer)

### createSum

public static AggUnaryOp createSum(Hop input)

### createAggUnaryOp

public static AggUnaryOp createAggUnaryOp(Hop input, String op)

### createAggUnaryOp

public static AggUnaryOp createAggUnaryOp(Hop input, Types.AggOp op, Types.Direction dir)

### createTsmm

public static AggBinaryOp createTsmm(Hop input, boolean left)

### createMatrixMultiply

public static AggBinaryOp createMatrixMultiply(Hop left, Hop right)

### createParameterizedBuiltinOp

public static ParameterizedBuiltinOp createParameterizedBuiltinOp(Hop input, LinkedHashMap<String,Hop> args, Types.ParamBuiltinOp op)

### createScalarIndexing

public static Hop createScalarIndexing(Hop input, long rix, long cix)

### createIndexingOp

public static IndexingOp createIndexingOp(Hop input, Hop batchsize)

### createIndexingOp

public static IndexingOp createIndexingOp(Hop input, long rix, long cix)

### createIndexingOp

public static IndexingOp createIndexingOp(Hop input, long rl, long ru, long cl, long cu)

### createIndexingOp

public static IndexingOp createIndexingOp(Hop input, Hop rl, Hop ru, Hop cl, Hop cu)

### createLeftIndexingOp

public static LeftIndexingOp createLeftIndexingOp(Hop lhs, Hop rhs, Hop rl, Hop ru, Hop cl, Hop cu)

### createNary

public static NaryOp createNary(Types.OpOpN op, Hop... inputs)

### createValueHop

public static Hop createValueHop(Hop hop, boolean row)

### createSeqDataGenOp

public static DataGenOp createSeqDataGenOp(Hop input)

### createSeqDataGenOp

public static DataGenOp createSeqDataGenOp(Hop input, boolean asc)

### createSeqDataGenOp

public static DataGenOp createSeqDataGenOp(Hop proxy, Hop from, Hop to, Hop incr)

### createTernary

public static TernaryOp createTernary(Hop mleft, Hop smid, Hop mright, String opcode)

### createTernary

public static TernaryOp createTernary(Hop mleft, Hop smid, Hop mright, Types.OpOp3 op)

### createTernary

public static TernaryOp createTernary(Hop in1, Hop in2, Hop in3, Hop in4, Hop in5, Types.OpOp3 op)

### createComputeNnz

public static Hop createComputeNnz(Hop input)

### setOutputParameters

public static void setOutputParameters(Hop hop, long rlen, long clen, int blen, long nnz)

### setOutputParametersForScalar

public static void setOutputParametersForScalar(Hop hop)

### refreshOutputParameters

public static void refreshOutputParameters(Hop hnew, Hop hold)

### copyLineNumbers

public static void copyLineNumbers(Hop src, Hop dest)

### copyLineNumbers

public static void copyLineNumbers(MatrixBlock mb, Hop tread)

### copyLineNumbers

public static void copyLineNumbers(MatrixObject mo, Hop tread)

### updateHopCharacteristics

public static void updateHopCharacteristics(Hop hop, int blen, Hop src)

### updateHopCharacteristics

public static void updateHopCharacteristics(Hop hop, int blen, MemoTable memo, Hop src)

### isDimsKnown

public static boolean isDimsKnown(Hop hop)

### isEmpty

public static boolean isEmpty(Hop hop)

### isEqualMatrixSize

public static boolean isEqualMatrixSize(BinaryOp hop)

### isEqualSize

public static boolean isEqualSize(Hop hop1, Hop hop2)

### isEqualSize

public static boolean isEqualSize(Hop hop1, Hop... hops)

### isSingleBlock

public static boolean isSingleBlock(Hop hop)

### isSingleBlock

public static boolean isSingleBlock(Hop hop, boolean cols)
Checks our BLOCKSIZE CONSTRAINT, w/ awareness of forced single node execution mode.

Parameters:
  `hop` - high-level operator
  `cols` - true if cols
Returns:
  true if single block

### isOuterProductLikeMM

public static boolean isOuterProductLikeMM(Hop hop)

### isOuterBinary

public static boolean isOuterBinary(Hop hop)

### isValidOuterBinaryOp

public static boolean isValidOuterBinaryOp(Types.OpOp2 op)

### isSparse

public static boolean isSparse(Hop hop)

### isDense

public static boolean isDense(Hop hop)

### isSparse

public static boolean isSparse(Hop hop, double threshold)

### isEqualValue

public static boolean isEqualValue(Hop hop1, Hop hop2)

### isEqualValue

public static boolean isEqualValue(LiteralOp hop1, LiteralOp hop2)

### isNotMatrixVectorBinaryOperation

public static boolean isNotMatrixVectorBinaryOperation(Hop hop)

### isReorg

public static boolean isReorg(Hop hop, Types.ReOrgOp type)

### isReorg

public static boolean isReorg(Hop hop, Types.ReOrgOp... types)

### isTransposeOperation

public static boolean isTransposeOperation(Hop hop)

### isTransposeOperation

public static boolean isTransposeOperation(Hop hop, int maxParents)

### containsTransposeOperation

public static boolean containsTransposeOperation(List<Hop> hops)

### isTransposeOfItself

public static boolean isTransposeOfItself(Hop hop1, Hop hop2)

### isTsmm

public static boolean isTsmm(Hop input)

### isTsmmInput

public static boolean isTsmmInput(Hop input)

### isBinary

public static boolean isBinary(Hop hop, Types.OpOp2 type)

### isBinary

public static boolean isBinary(Hop hop, Types.OpOp2... types)

### isBinary

public static boolean isBinary(Hop hop, Types.OpOp2 type, int maxParents)

### isBinaryPPred

public static boolean isBinaryPPred(Hop hop)

### isBinarySparseSafe

public static boolean isBinarySparseSafe(Hop hop)

### isBinaryMatrixScalarOperation

public static boolean isBinaryMatrixScalarOperation(Hop hop)

### isBinaryMatrixMatrixOperation

public static boolean isBinaryMatrixMatrixOperation(Hop hop)

### isBinaryMatrixMatrixOperationWithSharedInput

public static boolean isBinaryMatrixMatrixOperationWithSharedInput(Hop hop)

### isBinaryMatrixScalar

public static boolean isBinaryMatrixScalar(Hop hop, Types.OpOp2 type, double val)

### isTernary

public static boolean isTernary(Hop hop, Types.OpOp3 type)

### isTernary

public static boolean isTernary(Hop hop, Types.OpOp3... types)

### containsInput

public static boolean containsInput(Hop current, Hop probe)

### isData

public static boolean isData(Hop hop, Types.OpOpData... types)

### isData

public static boolean isData(Hop hop, Types.OpOpData type)

### isData

public static boolean isData(Hop hop, Types.OpOpData type, Types.DataType dt)

### isTransformEncode

public static boolean isTransformEncode(Hop hop)

### isBinaryMatrixColVectorOperation

public static boolean isBinaryMatrixColVectorOperation(Hop hop)

### isBinaryMatrixRowVectorOperation

public static boolean isBinaryMatrixRowVectorOperation(Hop hop)

### isUnary

public static boolean isUnary(Hop hop, Types.OpOp1 type)

### isUnary

public static boolean isUnary(Hop hop, Types.OpOp1 type, int maxParents)

### isUnary

public static boolean isUnary(Hop hop, Types.OpOp1... types)

### isTerminalHop

public static boolean isTerminalHop(Hop hop)
Check if given hop is of a terminal type. Terminal hops are either of type print or write.

Parameters:
  `hop` - for which the type is checked
Returns:
  true if hop is terminal

### isMatrixMultiply

public static boolean isMatrixMultiply(Hop hop)

### isAggUnaryOp

public static boolean isAggUnaryOp(Hop hop, Types.AggOp op, Types.Direction dir)

### isAggUnaryOp

public static boolean isAggUnaryOp(Hop hop, Types.AggOp... op)

### isSum

public static boolean isSum(Hop hop)

### isSumSq

public static boolean isSumSq(Hop hop)

### isParameterizedBuiltinOp

public static boolean isParameterizedBuiltinOp(Hop hop, Types.ParamBuiltinOp type)

### isParameterizedBuiltinOp

public static boolean isParameterizedBuiltinOp(Hop hop, Types.ParamBuiltinOp... types)

### isRemoveEmpty

public static boolean isRemoveEmpty(Hop hop, boolean rows)

### isRemoveEmpty

public static boolean isRemoveEmpty(Hop hop)

### isNary

public static boolean isNary(Hop hop, Types.OpOpN type)

### isNary

public static boolean isNary(Hop hop, Types.OpOpN... types)

### isDnn

public static boolean isDnn(Hop hop, Types.OpOpDnn type)

### isDnn

public static boolean isDnn(Hop hop, Types.OpOpDnn... types)

### isNonZeroIndicator

public static boolean isNonZeroIndicator(Hop pred, Hop hop)

### checkInputDataTypes

public static boolean checkInputDataTypes(Hop hop, Types.DataType... dt)

### checkAvgRowsGteCols

public static boolean checkAvgRowsGteCols(List<Hop> list)

### checkConsistentRows

public static boolean checkConsistentRows(List<Hop> list1, List<Hop> list2)

### isColumnRightIndexing

public static boolean isColumnRightIndexing(Hop hop)

### isFullColumnIndexing

public static boolean isFullColumnIndexing(LeftIndexingOp hop)

### isFullColumnIndexing

public static boolean isFullColumnIndexing(IndexingOp hop)

### isFullRowIndexing

public static boolean isFullRowIndexing(LeftIndexingOp hop)

### isFullRowIndexing

public static boolean isFullRowIndexing(IndexingOp hop)

### isColumnRangeIndexing

public static boolean isColumnRangeIndexing(IndexingOp hop)

### isConsecutiveIndex

public static boolean isConsecutiveIndex(Hop index, Hop index2)

### isUnnecessaryRightIndexing

public static boolean isUnnecessaryRightIndexing(Hop hop)

### isScalarMatrixBinaryMult

public static boolean isScalarMatrixBinaryMult(Hop hop)

### isBasic1NSequence

public static boolean isBasic1NSequence(Hop hop)

### isBasic1NSequence

public static boolean isBasic1NSequence(Hop seq, Hop input, boolean row)

### isBasicN1Sequence

public static boolean isBasicN1Sequence(Hop hop)

### getBasic1NSequenceMax

public static Hop getBasic1NSequenceMax(Hop hop)

### isSizeExpressionOf

public static boolean isSizeExpressionOf(Hop size, Hop input, boolean row)

### hasOnlyWriteParents

public static boolean hasOnlyWriteParents(Hop hop, boolean inclTransient, boolean inclPersistent)

### hasOnlyUnaryBinaryParents

public static boolean hasOnlyUnaryBinaryParents(Hop hop, boolean disallowLhs)

### alwaysRequiresReblock

public static boolean alwaysRequiresReblock(Hop hop)

### containsOp

public static boolean containsOp(List<Hop> candidates, Class<? extends Hop> clazz)

### rHasSimpleReadChain

public static boolean rHasSimpleReadChain(Hop root, String var)

### rContainsRead

public static boolean rContainsRead(Hop root, String var, boolean includeMetaOp)

### createPartialTsmmCbind

public static Hop createPartialTsmmCbind(Hop X, Hop deltaX, Hop tsmmIn1)

### isValidOp

public static boolean isValidOp(Types.AggOp input, Types.AggOp... validTab)

### isValidOp

public static boolean isValidOp(Types.OpOp1 input, Types.OpOp1... validTab)

### isValidOp

public static boolean isValidOp(Types.OpOp2 input, Types.OpOp2... validTab)

### isValidOp

public static boolean isValidOp(Types.ReOrgOp input, Types.ReOrgOp... validTab)

### isValidOp

public static boolean isValidOp(Types.ParamBuiltinOp input, Types.ParamBuiltinOp... validTab)

### getValidOpPos

public static int getValidOpPos(Types.OpOp2 input, Types.OpOp2... validTab)

### compareSize

public static int compareSize(Hop hop1, Hop hop2)
Compares the size of outputs from hop1 and hop2, in terms of number of matrix cells.

Parameters:
  `hop1` - high-level operator 1
  `hop2` - high-level operator 2
Returns:
  0 if sizes are equal, <0 for hop1<hop2, >0 for hop1>hop2.

### isLastLevelStatementBlock

public static boolean isLastLevelStatementBlock(StatementBlock sb)

### isLoopStatementBlock

public static boolean isLoopStatementBlock(StatementBlock sb)

### isLastLevelLoopStatementBlock

public static boolean isLastLevelLoopStatementBlock(StatementBlock sb)

### getMaxNrowInput

public static long getMaxNrowInput(Hop hop)

### getMaxNcolInput

public static long getMaxNcolInput(Hop hop)

### getMaxInputDim

public static long getMaxInputDim(Hop hop, boolean dim1)

### getSumValidInputDims

public static long getSumValidInputDims(Hop hop, boolean dim1)

### hasValidInputDims

public static boolean hasValidInputDims(Hop hop, boolean dim1)

### getSumValidInputNnz

public static long getSumValidInputNnz(Hop hop)

### hasValidInputNnz

public static boolean hasValidInputNnz(Hop hop)

### getMaxInputDim

public static long getMaxInputDim(DataCharacteristics[] dc, boolean dim1)

### getSumValidInputDims

public static long getSumValidInputDims(DataCharacteristics[] mc, boolean dim1)

### hasValidInputDims

public static boolean hasValidInputDims(DataCharacteristics[] mc, boolean dim1)

### getSumValidInputNnz

public static long getSumValidInputNnz(DataCharacteristics[] mc, boolean worstcase)

### hasValidInputNnz

public static boolean hasValidInputNnz(DataCharacteristics[] mc, boolean worstcase)

### hasListInputs

public static boolean hasListInputs(Hop hop)

### containsSecondOrderBuiltin

public static boolean containsSecondOrderBuiltin(List<Hop> roots)

### knownParamservFunctions

public static boolean knownParamservFunctions(Hop hop)

### knownParamservFunctions

public static boolean knownParamservFunctions(Hop hop, DMLProgram prog)

### setUnoptimizedFunctionCalls

public static void setUnoptimizedFunctionCalls(StatementBlock sb)