use of org.apache.sysml.runtime.functionobjects.Multiply in project incubator-systemml by apache.
the class MatrixBlock method aggregateTernaryOperations.
public MatrixBlock aggregateTernaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret, AggregateTernaryOperator op, boolean inCP) {
// check input dimensions and operators
if (m1.rlen != m2.rlen || m1.clen != m2.clen || (m3 != null && (m2.rlen != m3.rlen || m2.clen != m3.clen)))
throw new DMLRuntimeException("Invalid dimensions for aggregate ternary (" + m1.rlen + "x" + m1.clen + ", " + m2.rlen + "x" + m2.clen + ", " + m3.rlen + "x" + m3.clen + ").");
if (!(op.aggOp.increOp.fn instanceof KahanPlus && op.binaryFn instanceof Multiply))
throw new DMLRuntimeException("Unsupported operator for aggregate ternary operations.");
// create output matrix block w/ corrections
int rl = (op.indexFn instanceof ReduceRow) ? 2 : 1;
int cl = (op.indexFn instanceof ReduceRow) ? m1.clen : 2;
if (ret == null)
ret = new MatrixBlock(rl, cl, false);
else
ret.reset(rl, cl, false);
// execute ternary aggregate function
if (op.getNumThreads() > 1)
ret = LibMatrixAgg.aggregateTernary(m1, m2, m3, ret, op, op.getNumThreads());
else
ret = LibMatrixAgg.aggregateTernary(m1, m2, m3, ret, op);
if (op.aggOp.correctionExists && inCP)
ret.dropLastRowsOrColumns(op.aggOp.correctionLocation);
return ret;
}
Aggregations