in src/main/java/org/apache/sysds/runtime/instructions/SPInstructionParser.java [93:257]
public static SPInstruction parseSingleInstruction ( InstructionType sptype, String str ) {
if ( str == null || str.isEmpty() )
return null;
String [] parts = null;
switch(sptype)
{
// matrix multiplication instructions
case CPMM:
return CpmmSPInstruction.parseInstruction(str);
case RMM:
return RmmSPInstruction.parseInstruction(str);
case MAPMM:
return MapmmSPInstruction.parseInstruction(str);
case MAPMMCHAIN:
return MapmmChainSPInstruction.parseInstruction(str);
case TSMM:
return TsmmSPInstruction.parseInstruction(str);
case TSMM2:
return Tsmm2SPInstruction.parseInstruction(str);
case PMM:
return PmmSPInstruction.parseInstruction(str);
case ZIPMM:
return ZipmmSPInstruction.parseInstruction(str);
case PMAPMM:
return PMapmmSPInstruction.parseInstruction(str);
case UaggOuterChain:
return UaggOuterChainSPInstruction.parseInstruction(str);
case AggregateUnary:
return AggregateUnarySPInstruction.parseInstruction(str);
case AggregateUnarySketch:
return AggregateUnarySketchSPInstruction.parseInstruction(str);
case AggregateTernary:
return AggregateTernarySPInstruction.parseInstruction(str);
case Dnn:
return DnnSPInstruction.parseInstruction(str);
case MatrixIndexing:
return IndexingSPInstruction.parseInstruction(str);
case Reorg:
return ReorgSPInstruction.parseInstruction(str);
case Binary:
return BinarySPInstruction.parseInstruction(str);
case Ternary:
return TernarySPInstruction.parseInstruction(str);
//ternary instructions
case Ctable:
return CtableSPInstruction.parseInstruction(str);
//quaternary instructions
case Quaternary:
return QuaternarySPInstruction.parseInstruction(str);
// Reblock instructions
case Reblock:
return ReblockSPInstruction.parseInstruction(str);
case CSVReblock:
return CSVReblockSPInstruction.parseInstruction(str);
case LIBSVMReblock:
return LIBSVMReblockSPInstruction.parseInstruction(str);
case Builtin:
parts = InstructionUtils.getInstructionPartsWithValueType(str);
if ( parts[0].equals(Opcodes.LOG.toString()) || parts[0].equals(Opcodes.LOGNZ.toString()) ) {
if ( parts.length == 3 ) {
// B=log(A), y=log(x)
return UnaryMatrixSPInstruction.parseInstruction(str);
} else if ( parts.length == 4 ) {
// B=log(A,10), y=log(x,10)
return BinarySPInstruction.parseInstruction(str);
}
}
else {
throw new DMLRuntimeException("Invalid Builtin Instruction: " + str );
}
case Unary:
parts = InstructionUtils.getInstructionPartsWithValueType(str);
CPOperand in = new CPOperand(parts[1]);
if(in.getDataType() == Types.DataType.MATRIX)
return UnaryMatrixSPInstruction.parseInstruction(str);
else
return UnaryFrameSPInstruction.parseInstruction(str);
case BuiltinNary:
return BuiltinNarySPInstruction.parseInstruction(str);
case ParameterizedBuiltin:
return ParameterizedBuiltinSPInstruction.parseInstruction(str);
case MultiReturnBuiltin:
return MultiReturnParameterizedBuiltinSPInstruction.parseInstruction(str);
case MatrixReshape:
return MatrixReshapeSPInstruction.parseInstruction(str);
case MAppend: //matrix/frame
return AppendMSPInstruction.parseInstruction(str);
case RAppend: //matrix/frame
return AppendRSPInstruction.parseInstruction(str);
case GAppend:
return AppendGSPInstruction.parseInstruction(str);
case GAlignedAppend:
return AppendGAlignedSPInstruction.parseInstruction(str);
case Rand:
return RandSPInstruction.parseInstruction(str);
case QSort:
return QuantileSortSPInstruction.parseInstruction(str);
case QPick:
return QuantilePickSPInstruction.parseInstruction(str);
case Write:
return WriteSPInstruction.parseInstruction(str);
case CumsumAggregate:
return CumulativeAggregateSPInstruction.parseInstruction(str);
case CumsumOffset:
return CumulativeOffsetSPInstruction.parseInstruction(str);
case CentralMoment:
return CentralMomentSPInstruction.parseInstruction(str);
case Covariance:
return CovarianceSPInstruction.parseInstruction(str);
case BinUaggChain:
return BinUaggChainSPInstruction.parseInstruction(str);
case Checkpoint:
return CheckpointSPInstruction.parseInstruction(str);
case Compression:
return CompressionSPInstruction.parseInstruction(str);
case DeCompression:
return DeCompressionSPInstruction.parseInstruction(str);
case SpoofFused:
return SpoofSPInstruction.parseInstruction(str);
case Cast:
return CastSPInstruction.parseInstruction(str);
default:
throw new DMLRuntimeException("Invalid SP Instruction Type: " + sptype );
}
}