Search in sources :

Example 11 with UnaryOperator

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

the class MatrixBuiltinSPInstruction method processInstruction.

@Override
public void processInstruction(ExecutionContext ec) throws DMLRuntimeException {
    SparkExecutionContext sec = (SparkExecutionContext) ec;
    //get input
    JavaPairRDD<MatrixIndexes, MatrixBlock> in = sec.getBinaryBlockRDDHandleForVariable(input1.getName());
    //execute unary builtin operation
    UnaryOperator uop = (UnaryOperator) _optr;
    JavaPairRDD<MatrixIndexes, MatrixBlock> out = in.mapValues(new RDDMatrixBuiltinUnaryOp(uop));
    //set output RDD
    updateUnaryOutputMatrixCharacteristics(sec);
    sec.setRDDHandleForVariable(output.getName(), out);
    sec.addLineageRDD(output.getName(), input1.getName());
}
Also used : MatrixBlock(org.apache.sysml.runtime.matrix.data.MatrixBlock) MatrixIndexes(org.apache.sysml.runtime.matrix.data.MatrixIndexes) SparkExecutionContext(org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext) UnaryOperator(org.apache.sysml.runtime.matrix.operators.UnaryOperator)

Example 12 with UnaryOperator

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

the class BuiltinUnarySPInstruction method parseInstruction.

public static BuiltinUnarySPInstruction parseInstruction(String str) throws DMLRuntimeException {
    CPOperand in = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
    CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
    String opcode = parseUnaryInstruction(str, in, out);
    ValueFunction func = Builtin.getBuiltinFnObject(opcode);
    return new MatrixBuiltinSPInstruction(new UnaryOperator(func), in, out, opcode, str);
}
Also used : ValueFunction(org.apache.sysml.runtime.functionobjects.ValueFunction) CPOperand(org.apache.sysml.runtime.instructions.cp.CPOperand) UnaryOperator(org.apache.sysml.runtime.matrix.operators.UnaryOperator)

Aggregations

UnaryOperator (org.apache.sysml.runtime.matrix.operators.UnaryOperator)12 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)5 ValueFunction (org.apache.sysml.runtime.functionobjects.ValueFunction)3 SparkExecutionContext (org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext)2 Equals (org.apache.sysml.runtime.functionobjects.Equals)2 GreaterThan (org.apache.sysml.runtime.functionobjects.GreaterThan)2 GreaterThanEquals (org.apache.sysml.runtime.functionobjects.GreaterThanEquals)2 LessThan (org.apache.sysml.runtime.functionobjects.LessThan)2 LessThanEquals (org.apache.sysml.runtime.functionobjects.LessThanEquals)2 NotEquals (org.apache.sysml.runtime.functionobjects.NotEquals)2 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)2 AggregateUnaryOperator (org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator)2 Method (java.lang.reflect.Method)1 DMLScriptException (org.apache.sysml.runtime.DMLScriptException)1 LibSpoofPrimitives (org.apache.sysml.runtime.codegen.LibSpoofPrimitives)1 CPOperand (org.apache.sysml.runtime.instructions.cp.CPOperand)1 SimpleOperator (org.apache.sysml.runtime.matrix.operators.SimpleOperator)1