Search in sources :

Example 16 with CorrectionLocationType

use of org.apache.sysml.lops.PartialAggregate.CorrectionLocationType in project systemml by apache.

the class AggregateUnarySPInstruction method parseInstruction.

public static AggregateUnarySPInstruction parseInstruction(String str) {
    String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
    InstructionUtils.checkNumFields(parts, 3);
    String opcode = parts[0];
    CPOperand in1 = new CPOperand(parts[1]);
    CPOperand out = new CPOperand(parts[2]);
    SparkAggType aggtype = SparkAggType.valueOf(parts[3]);
    String aopcode = InstructionUtils.deriveAggregateOperatorOpcode(opcode);
    CorrectionLocationType corrLoc = InstructionUtils.deriveAggregateOperatorCorrectionLocation(opcode);
    String corrExists = (corrLoc != CorrectionLocationType.NONE) ? "true" : "false";
    AggregateUnaryOperator aggun = InstructionUtils.parseBasicAggregateUnaryOperator(opcode);
    AggregateOperator aop = InstructionUtils.parseAggregateOperator(aopcode, corrExists, corrLoc.toString());
    return new AggregateUnarySPInstruction(SPType.AggregateUnary, aggun, aop, in1, out, aggtype, opcode, str);
}
Also used : SparkAggType(org.apache.sysml.hops.AggBinaryOp.SparkAggType) AggregateUnaryOperator(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator) AggregateOperator(org.apache.sysml.runtime.matrix.operators.AggregateOperator) CPOperand(org.apache.sysml.runtime.instructions.cp.CPOperand) CorrectionLocationType(org.apache.sysml.lops.PartialAggregate.CorrectionLocationType)

Example 17 with CorrectionLocationType

use of org.apache.sysml.lops.PartialAggregate.CorrectionLocationType in project systemml by apache.

the class UaggOuterChainSPInstruction method parseInstruction.

public static UaggOuterChainSPInstruction parseInstruction(String str) {
    String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
    String opcode = parts[0];
    if (opcode.equalsIgnoreCase(UAggOuterChain.OPCODE)) {
        AggregateUnaryOperator uaggop = InstructionUtils.parseBasicAggregateUnaryOperator(parts[1]);
        BinaryOperator bop = InstructionUtils.parseBinaryOperator(parts[2]);
        CPOperand in1 = new CPOperand(parts[3]);
        CPOperand in2 = new CPOperand(parts[4]);
        CPOperand out = new CPOperand(parts[5]);
        // derive aggregation operator from unary operator
        String aopcode = InstructionUtils.deriveAggregateOperatorOpcode(parts[1]);
        CorrectionLocationType corrLoc = InstructionUtils.deriveAggregateOperatorCorrectionLocation(parts[1]);
        String corrExists = (corrLoc != CorrectionLocationType.NONE) ? "true" : "false";
        AggregateOperator aop = InstructionUtils.parseAggregateOperator(aopcode, corrExists, corrLoc.toString());
        return new UaggOuterChainSPInstruction(bop, uaggop, aop, in1, in2, out, opcode, str);
    } else {
        throw new DMLRuntimeException("UaggOuterChainSPInstruction.parseInstruction():: Unknown opcode " + opcode);
    }
}
Also used : AggregateUnaryOperator(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator) AggregateOperator(org.apache.sysml.runtime.matrix.operators.AggregateOperator) CPOperand(org.apache.sysml.runtime.instructions.cp.CPOperand) BinaryOperator(org.apache.sysml.runtime.matrix.operators.BinaryOperator) CorrectionLocationType(org.apache.sysml.lops.PartialAggregate.CorrectionLocationType) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException)

Aggregations

CorrectionLocationType (org.apache.sysml.lops.PartialAggregate.CorrectionLocationType)17 AggregateOperator (org.apache.sysml.runtime.matrix.operators.AggregateOperator)17 AggregateUnaryOperator (org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator)13 BinaryOperator (org.apache.sysml.runtime.matrix.operators.BinaryOperator)6 CM (org.apache.sysml.runtime.functionobjects.CM)5 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)4 CPOperand (org.apache.sysml.runtime.instructions.cp.CPOperand)4 SparkAggType (org.apache.sysml.hops.AggBinaryOp.SparkAggType)2 IndexFunction (org.apache.sysml.runtime.functionobjects.IndexFunction)2 ReduceAll (org.apache.sysml.runtime.functionobjects.ReduceAll)2 AggregateTernaryOperator (org.apache.sysml.runtime.matrix.operators.AggregateTernaryOperator)2