org.apache.sysds.runtime.instructions

## Class InstructionUtils

- java.lang.Object
- - org.apache.sysds.runtime.instructions.InstructionUtils

-     public class InstructionUtils
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstructionUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `checkNumFields(String[] parts, int expected)`
    `static int` | `checkNumFields(String[] parts, int expected1, int expected2)`
    `static int` | `checkNumFields(String str, int expected)`
    `static int` | `checkNumFields(String str, int expected1, int expected2)`
    `static String` | `concatOperandParts(String... inputs)`
    `static String` | `concatOperands(String... inputs)`
    `static String` | `concatStrings(String... inputs)`
    `static Types.CorrectionLocationType` | `deriveAggregateOperatorCorrectionLocation(String opcode)`
    `static String` | `deriveAggregateOperatorOpcode(String opcode)`
    `static Types.Direction` | `getAggDirection(String opcode)`
    `static Types.AggOp` | `getAggOp(String opcode)`
    `static CPInstruction.CPType` | `getCPType(String str)`
    `static CPInstruction.CPType` | `getCPTypeByOpcode(String opcode)`
    `static LopProperties.ExecType` | `getExecType(String str)`
    `static FEDInstruction.FEDType` | `getFEDType(String str)`
    `static GPUInstruction.GPUINSTRUCTION_TYPE` | `getGPUType(String str)`
    `static String[]` | `getInstructionParts(String str)` Given an instruction string, strip-off the execution type and return opcode and all input/output operands WITHOUT their data/value type.
    `static String[]` | `getInstructionPartsWithValueType(String str)` Given an instruction string, this function strips-off the execution type (CP or MR) and returns the remaining parts, which include the opcode as well as the input and output operands.
    `static AggregateBinaryOperator` | `getMatMultOperator(int k)`
    `static String` | `getOpCode(String str)`
    `static SPInstruction.SPType` | `getSPType(String str)`
    `static SPInstruction.SPType` | `getSPTypeByOpcode(String opcode)`
    `static boolean` | `isBuiltinFunction(String opcode)`
    `static boolean` | `isDistQuaternaryOpcode(String opcode)`
    `static boolean` | `isUnaryMetadata(String opcode)`
    `static AggregateOperator` | `parseAggregateOperator(String opcode, String corrLoc)`
    `static AggregateTernaryOperator` | `parseAggregateTernaryOperator(String opcode)`
    `static AggregateTernaryOperator` | `parseAggregateTernaryOperator(String opcode, int numThreads)`
    `static AggregateUnaryOperator` | `parseBasicAggregateUnaryOperator(String opcode)`
    `static AggregateUnaryOperator` | `parseBasicAggregateUnaryOperator(String opcode, int numThreads)`
    `static AggregateUnaryOperator` | `parseBasicCumulativeAggregateUnaryOperator(UnaryOperator uop)`
    `static BinaryOperator` | `parseBinaryOperator(String opcode)`
    `static Operator` | `parseBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2)`
    `static AggregateUnaryOperator` | `parseCumulativeAggregateUnaryOperator(String opcode)`
    `static BinaryOperator` | `parseExtendedBinaryOperator(String opcode)`
    `static Operator` | `parseExtendedBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2)`
    `static Operator` | `parseGroupedAggOperator(String fn, String other)`
    `static ScalarOperator` | `parseScalarBinaryOperator(String opcode, boolean arg1IsScalar)` scalar-matrix operator
    `static ScalarOperator` | `parseScalarBinaryOperator(String opcode, boolean arg1IsScalar, double constant)` scalar-matrix operator
    `static TernaryOperator` | `parseTernaryOperator(String opcode)`
    `static UnaryOperator` | `parseUnaryOperator(String opcode)`
    `static String` | `replaceOperand(String instStr, int operand, String newValue)`
    `static String` | `replaceOperandName(String instStr)`

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

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

- - ### Constructor Detail

    - #### InstructionUtils

          public InstructionUtils()

  - ### Method Detail

    - #### checkNumFields

          public static int checkNumFields(String str,
                                           int expected)

    - #### checkNumFields

          public static int checkNumFields(String[] parts,
                                           int expected)

    - #### checkNumFields

          public static int checkNumFields(String[] parts,
                                           int expected1,
                                           int expected2)

    - #### checkNumFields

          public static int checkNumFields(String str,
                                           int expected1,
                                           int expected2)

    - #### getInstructionParts

          public static String[] getInstructionParts(String str)

      Given an instruction string, strip-off the execution type and return opcode and all input/output operands WITHOUT their data/value type. i.e., ret.length = parts.length-1 (-1 for execution type)
      Parameters:
        `str` - instruction string
      Returns:
        instruction parts as string array

    - #### getInstructionPartsWithValueType

          public static String[] getInstructionPartsWithValueType(String str)

      Given an instruction string, this function strips-off the execution type (CP or MR) and returns the remaining parts, which include the opcode as well as the input and output operands. Each returned part will have the datatype and valuetype associated with the operand. This function is invoked mainly for parsing CPInstructions.
      Parameters:
        `str` - instruction string
      Returns:
        instruction parts as string array

    - #### getExecType

          public static LopProperties.ExecType getExecType(String str)

    - #### getOpCode

          public static String getOpCode(String str)

    - #### getSPType

          public static SPInstruction.SPType getSPType(String str)

    - #### getCPType

          public static CPInstruction.CPType getCPType(String str)

    - #### getSPTypeByOpcode

          public static SPInstruction.SPType getSPTypeByOpcode(String opcode)

    - #### getCPTypeByOpcode

          public static CPInstruction.CPType getCPTypeByOpcode(String opcode)

    - #### getGPUType

          public static GPUInstruction.GPUINSTRUCTION_TYPE getGPUType(String str)

    - #### getFEDType

          public static FEDInstruction.FEDType getFEDType(String str)

    - #### isBuiltinFunction

          public static boolean isBuiltinFunction(String opcode)

    - #### isUnaryMetadata

          public static boolean isUnaryMetadata(String opcode)

    - #### parseBasicAggregateUnaryOperator

          public static AggregateUnaryOperator parseBasicAggregateUnaryOperator(String opcode)

    - #### parseBasicAggregateUnaryOperator

          public static AggregateUnaryOperator parseBasicAggregateUnaryOperator(String opcode,
                                                                                int numThreads)

    - #### parseAggregateTernaryOperator

          public static AggregateTernaryOperator parseAggregateTernaryOperator(String opcode)

    - #### parseAggregateTernaryOperator

          public static AggregateTernaryOperator parseAggregateTernaryOperator(String opcode,
                                                                               int numThreads)

    - #### parseAggregateOperator

          public static AggregateOperator parseAggregateOperator(String opcode,
                                                                 String corrLoc)

    - #### parseBasicCumulativeAggregateUnaryOperator

          public static AggregateUnaryOperator parseBasicCumulativeAggregateUnaryOperator(UnaryOperator uop)

    - #### parseCumulativeAggregateUnaryOperator

          public static AggregateUnaryOperator parseCumulativeAggregateUnaryOperator(String opcode)

    - #### parseUnaryOperator

          public static UnaryOperator parseUnaryOperator(String opcode)

    - #### parseBinaryOrBuiltinOperator

          public static Operator parseBinaryOrBuiltinOperator(String opcode,
                                                              CPOperand in1,
                                                              CPOperand in2)

    - #### parseExtendedBinaryOrBuiltinOperator

          public static Operator parseExtendedBinaryOrBuiltinOperator(String opcode,
                                                                      CPOperand in1,
                                                                      CPOperand in2)

    - #### parseBinaryOperator

          public static BinaryOperator parseBinaryOperator(String opcode)

    - #### parseTernaryOperator

          public static TernaryOperator parseTernaryOperator(String opcode)

    - #### parseScalarBinaryOperator

          public static ScalarOperator parseScalarBinaryOperator(String opcode,
                                                                 boolean arg1IsScalar)

      scalar-matrix operator
      Parameters:
        `opcode` - the opcode
        `arg1IsScalar` - ?
      Returns:
        scalar operator

    - #### parseScalarBinaryOperator

          public static ScalarOperator parseScalarBinaryOperator(String opcode,
                                                                 boolean arg1IsScalar,
                                                                 double constant)

      scalar-matrix operator
      Parameters:
        `opcode` - the opcode
        `arg1IsScalar` - ?
        `constant` - ?
      Returns:
        scalar operator

    - #### parseExtendedBinaryOperator

          public static BinaryOperator parseExtendedBinaryOperator(String opcode)

    - #### deriveAggregateOperatorOpcode

          public static String deriveAggregateOperatorOpcode(String opcode)

    - #### getAggOp

          public static Types.AggOp getAggOp(String opcode)

    - #### getAggDirection

          public static Types.Direction getAggDirection(String opcode)

    - #### deriveAggregateOperatorCorrectionLocation

          public static Types.CorrectionLocationType deriveAggregateOperatorCorrectionLocation(String opcode)

    - #### isDistQuaternaryOpcode

          public static boolean isDistQuaternaryOpcode(String opcode)

    - #### getMatMultOperator

          public static AggregateBinaryOperator getMatMultOperator(int k)

    - #### parseGroupedAggOperator

          public static Operator parseGroupedAggOperator(String fn,
                                                         String other)

    - #### replaceOperand

          public static String replaceOperand(String instStr,
                                              int operand,
                                              String newValue)

    - #### replaceOperandName

          public static String replaceOperandName(String instStr)

    - #### concatOperands

          public static String concatOperands(String... inputs)

    - #### concatOperandParts

          public static String concatOperandParts(String... inputs)

    - #### concatStrings

          public static String concatStrings(String... inputs)

Copyright © 2020 The Apache Software Foundation. All rights reserved.