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;
}
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);
}
Aggregations