Search in sources :

Example 1 with TaggedMatrixValue

use of org.apache.sysml.runtime.matrix.data.TaggedMatrixValue in project incubator-systemml by apache.

the class ReduceBase method processAggregateInstructions.

// process all the aggregate instructions for one group of values
protected void processAggregateInstructions(MatrixIndexes indexes, Iterator<TaggedMatrixValue> values, boolean imbededCorrection) throws IOException {
    try {
        while (values.hasNext()) {
            TaggedMatrixValue value = values.next();
            byte input = value.getTag();
            ArrayList<AggregateInstruction> instructions = agg_instructions.get(input);
            // if there is no specified aggregate operation on an input, by default apply sum
            if (instructions == null) {
                defaultAggIns.input = input;
                defaultAggIns.output = input;
                processAggregateHelp(indexes.getRowIndex(), indexes.getColumnIndex(), value.getBaseObject(), defaultAggIns, imbededCorrection);
            } else // otherwise, perform the specified aggregate instructions
            {
                for (AggregateInstruction ins : instructions) processAggregateHelp(indexes.getRowIndex(), indexes.getColumnIndex(), value.getBaseObject(), ins, imbededCorrection);
            }
        }
    } catch (Exception e) {
        throw new IOException(e);
    }
}
Also used : TaggedMatrixValue(org.apache.sysml.runtime.matrix.data.TaggedMatrixValue) IOException(java.io.IOException) AggregateInstruction(org.apache.sysml.runtime.instructions.mr.AggregateInstruction) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException) IOException(java.io.IOException)

Example 2 with TaggedMatrixValue

use of org.apache.sysml.runtime.matrix.data.TaggedMatrixValue in project systemml by apache.

the class ReduceBase method processAggregateInstructions.

// process all the aggregate instructions for one group of values
protected void processAggregateInstructions(MatrixIndexes indexes, Iterator<TaggedMatrixValue> values, boolean imbededCorrection) throws IOException {
    try {
        while (values.hasNext()) {
            TaggedMatrixValue value = values.next();
            byte input = value.getTag();
            ArrayList<AggregateInstruction> instructions = agg_instructions.get(input);
            // if there is no specified aggregate operation on an input, by default apply sum
            if (instructions == null) {
                defaultAggIns.input = input;
                defaultAggIns.output = input;
                processAggregateHelp(indexes.getRowIndex(), indexes.getColumnIndex(), value.getBaseObject(), defaultAggIns, imbededCorrection);
            } else // otherwise, perform the specified aggregate instructions
            {
                for (AggregateInstruction ins : instructions) processAggregateHelp(indexes.getRowIndex(), indexes.getColumnIndex(), value.getBaseObject(), ins, imbededCorrection);
            }
        }
    } catch (Exception e) {
        throw new IOException(e);
    }
}
Also used : TaggedMatrixValue(org.apache.sysml.runtime.matrix.data.TaggedMatrixValue) IOException(java.io.IOException) AggregateInstruction(org.apache.sysml.runtime.instructions.mr.AggregateInstruction) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)2 AggregateInstruction (org.apache.sysml.runtime.instructions.mr.AggregateInstruction)2 TaggedMatrixValue (org.apache.sysml.runtime.matrix.data.TaggedMatrixValue)2