Search in sources :

Example 41 with AggregateOperator

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

the class InstructionUtils method parseCumulativeAggregateUnaryOperator.

public static AggregateUnaryOperator parseCumulativeAggregateUnaryOperator(String opcode) {
    AggregateUnaryOperator aggun = null;
    if ("ucumack+".equals(opcode)) {
        AggregateOperator agg = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTROW);
        aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject());
    } else if ("ucumac*".equals(opcode)) {
        AggregateOperator agg = new AggregateOperator(0, Multiply.getMultiplyFnObject(), false, CorrectionLocationType.NONE);
        aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject());
    } else if ("ucumacmin".equals(opcode)) {
        AggregateOperator agg = new AggregateOperator(0, Builtin.getBuiltinFnObject("min"), false, CorrectionLocationType.NONE);
        aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject());
    } else if ("ucumacmax".equals(opcode)) {
        AggregateOperator agg = new AggregateOperator(0, Builtin.getBuiltinFnObject("max"), false, CorrectionLocationType.NONE);
        aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject());
    }
    return aggun;
}
Also used : AggregateUnaryOperator(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator) AggregateOperator(org.apache.sysml.runtime.matrix.operators.AggregateOperator)

Example 42 with AggregateOperator

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

the class ReduceBase method processAggregateHelp.

// process one aggregate instruction
private void processAggregateHelp(long row, long col, MatrixValue value, AggregateInstruction instruction, boolean imbededCorrection) {
    AggregateOperator aggOp = (AggregateOperator) instruction.getOperator();
    // there should be just one value in cache.
    IndexedMatrixValue out = cachedValues.getFirst(instruction.output);
    IndexedMatrixValue correction = null;
    if (// && !imbededCorrection)
    aggOp.correctionExists) {
        correction = correctionCache.getFirst(instruction.output);
    }
    if (out == null) {
        out = cachedValues.holdPlace(instruction.output, valueClass);
        out.getIndexes().setIndexes(row, col);
        // System.out.println("out: "+out);
        if (// && !imbededCorrection)
        aggOp.correctionExists) {
            if (correction == null)
                correction = correctionCache.holdPlace(instruction.output, valueClass);
            OperationsOnMatrixValues.startAggregation(out.getValue(), correction.getValue(), aggOp, value.getNumRows(), value.getNumColumns(), value.isInSparseFormat(), imbededCorrection);
        } else
            OperationsOnMatrixValues.startAggregation(out.getValue(), null, aggOp, value.getNumRows(), value.getNumColumns(), value.isInSparseFormat(), imbededCorrection);
    }
    if (// && !imbededCorrection)
    aggOp.correctionExists)
        OperationsOnMatrixValues.incrementalAggregation(out.getValue(), correction.getValue(), value, (AggregateOperator) instruction.getOperator(), imbededCorrection);
    else
        OperationsOnMatrixValues.incrementalAggregation(out.getValue(), null, value, (AggregateOperator) instruction.getOperator(), imbededCorrection);
}
Also used : AggregateOperator(org.apache.sysml.runtime.matrix.operators.AggregateOperator)

Aggregations

AggregateOperator (org.apache.sysml.runtime.matrix.operators.AggregateOperator)42 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)17 AggregateBinaryOperator (org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator)16 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)12 AggregateUnaryOperator (org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator)11 CPOperand (org.apache.sysml.runtime.instructions.cp.CPOperand)10 CorrectionLocationType (org.apache.sysml.lops.PartialAggregate.CorrectionLocationType)9 CompressedMatrixBlock (org.apache.sysml.runtime.compress.CompressedMatrixBlock)8 CM (org.apache.sysml.runtime.functionobjects.CM)8 CMOperator (org.apache.sysml.runtime.matrix.operators.CMOperator)7 KahanObject (org.apache.sysml.runtime.instructions.cp.KahanObject)5 WeightedCell (org.apache.sysml.runtime.matrix.data.WeightedCell)5 BinaryOperator (org.apache.sysml.runtime.matrix.operators.BinaryOperator)4 Operator (org.apache.sysml.runtime.matrix.operators.Operator)4 ArrayList (java.util.ArrayList)3 SparkAggType (org.apache.sysml.hops.AggBinaryOp.SparkAggType)3 SparkExecutionContext (org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext)3 CM_COV_Object (org.apache.sysml.runtime.instructions.cp.CM_COV_Object)3 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)3 IOException (java.io.IOException)2