Search in sources :

Example 1 with ReIndexOperator

use of org.apache.sysml.runtime.matrix.operators.ReIndexOperator in project incubator-systemml by apache.

the class RangeBasedReIndexInstruction method parseInstruction.

public static RangeBasedReIndexInstruction parseInstruction(String str) {
    InstructionUtils.checkNumFields(str, 8);
    String[] parts = InstructionUtils.getInstructionParts(str);
    String opcode = parts[0];
    boolean forLeft = false;
    if (opcode.equalsIgnoreCase(RightIndex.OPCODE + "ForLeft"))
        forLeft = true;
    else if (!opcode.equalsIgnoreCase(RightIndex.OPCODE))
        throw new DMLRuntimeException("Unknown opcode while parsing a Select: " + str);
    byte in = Byte.parseByte(parts[1]);
    IndexRange rng = new IndexRange(UtilFunctions.parseToLong(parts[2]), UtilFunctions.parseToLong(parts[3]), UtilFunctions.parseToLong(parts[4]), UtilFunctions.parseToLong(parts[5]));
    byte out = Byte.parseByte(parts[6]);
    long rlen = Long.parseLong(parts[7]);
    long clen = Long.parseLong(parts[8]);
    return new RangeBasedReIndexInstruction(new ReIndexOperator(), in, out, rng, forLeft, rlen, clen, str);
}
Also used : IndexRange(org.apache.sysml.runtime.util.IndexRange) ReIndexOperator(org.apache.sysml.runtime.matrix.operators.ReIndexOperator) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException)

Example 2 with ReIndexOperator

use of org.apache.sysml.runtime.matrix.operators.ReIndexOperator in project systemml by apache.

the class RangeBasedReIndexInstruction method parseInstruction.

public static RangeBasedReIndexInstruction parseInstruction(String str) {
    InstructionUtils.checkNumFields(str, 8);
    String[] parts = InstructionUtils.getInstructionParts(str);
    String opcode = parts[0];
    boolean forLeft = false;
    if (opcode.equalsIgnoreCase(RightIndex.OPCODE + "ForLeft"))
        forLeft = true;
    else if (!opcode.equalsIgnoreCase(RightIndex.OPCODE))
        throw new DMLRuntimeException("Unknown opcode while parsing a Select: " + str);
    byte in = Byte.parseByte(parts[1]);
    IndexRange rng = new IndexRange(UtilFunctions.parseToLong(parts[2]), UtilFunctions.parseToLong(parts[3]), UtilFunctions.parseToLong(parts[4]), UtilFunctions.parseToLong(parts[5]));
    byte out = Byte.parseByte(parts[6]);
    long rlen = Long.parseLong(parts[7]);
    long clen = Long.parseLong(parts[8]);
    return new RangeBasedReIndexInstruction(new ReIndexOperator(), in, out, rng, forLeft, rlen, clen, str);
}
Also used : IndexRange(org.apache.sysml.runtime.util.IndexRange) ReIndexOperator(org.apache.sysml.runtime.matrix.operators.ReIndexOperator) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException)

Aggregations

DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)2 ReIndexOperator (org.apache.sysml.runtime.matrix.operators.ReIndexOperator)2 IndexRange (org.apache.sysml.runtime.util.IndexRange)2