Search in sources :

Example 26 with IJV

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

the class SpoofCellwise method executeCompressedRowAggMxx.

private long executeCompressedRowAggMxx(CompressedMatrixBlock a, SideInput[] b, double[] scalars, double[] c, int m, int n, boolean sparseSafe, int rl, int ru) {
    Arrays.fill(c, rl, ru, (_aggOp == AggOp.MIN) ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY);
    ValueFunction vfun = getAggFunction();
    long lnnz = 0;
    Iterator<IJV> iter = a.getIterator(rl, ru, !sparseSafe);
    while (iter.hasNext()) {
        IJV cell = iter.next();
        double val = genexec(cell.getV(), b, scalars, m, n, cell.getI(), cell.getJ());
        c[cell.getI()] = vfun.execute(c[cell.getI()], val);
    }
    for (int i = rl; i < ru; i++) lnnz += (c[i] != 0) ? 1 : 0;
    return lnnz;
}
Also used : ValueFunction(org.apache.sysml.runtime.functionobjects.ValueFunction) IJV(org.apache.sysml.runtime.matrix.data.IJV)

Example 27 with IJV

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

the class SpoofCellwise method executeCompressedColAggMxx.

private long executeCompressedColAggMxx(CompressedMatrixBlock a, SideInput[] b, double[] scalars, double[] c, int m, int n, boolean sparseSafe, int rl, int ru) {
    Arrays.fill(c, rl, ru, (_aggOp == AggOp.MIN) ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY);
    ValueFunction vfun = getAggFunction();
    long lnnz = 0;
    Iterator<IJV> iter = a.getIterator(rl, ru, !sparseSafe);
    while (iter.hasNext()) {
        IJV cell = iter.next();
        double val = genexec(cell.getV(), b, scalars, m, n, cell.getI(), cell.getJ());
        c[cell.getI()] = vfun.execute(c[cell.getI()], val);
    }
    for (int i = rl; i < ru; i++) lnnz += (c[i] != 0) ? 1 : 0;
    return lnnz;
}
Also used : ValueFunction(org.apache.sysml.runtime.functionobjects.ValueFunction) IJV(org.apache.sysml.runtime.matrix.data.IJV)

Example 28 with IJV

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

the class SpoofCellwise method executeCompressedRowAggSum.

private long executeCompressedRowAggSum(CompressedMatrixBlock a, SideInput[] b, double[] scalars, double[] c, int m, int n, boolean sparseSafe, int rl, int ru) {
    KahanFunction kplus = (KahanFunction) getAggFunction();
    KahanObject kbuff = new KahanObject(0, 0);
    long lnnz = 0;
    Iterator<IJV> iter = a.getIterator(rl, ru, !sparseSafe);
    while (iter.hasNext()) {
        IJV cell = iter.next();
        double val = genexec(cell.getV(), b, scalars, m, n, cell.getI(), cell.getJ());
        kbuff.set(c[cell.getI()], 0);
        kplus.execute2(kbuff, val);
        c[cell.getI()] = kbuff._sum;
    }
    for (int i = rl; i < ru; i++) lnnz += (c[i] != 0) ? 1 : 0;
    return lnnz;
}
Also used : IJV(org.apache.sysml.runtime.matrix.data.IJV) KahanFunction(org.apache.sysml.runtime.functionobjects.KahanFunction) KahanObject(org.apache.sysml.runtime.instructions.cp.KahanObject)

Example 29 with IJV

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

the class SpoofCellwise method executeCompressedAggMxx.

private double executeCompressedAggMxx(CompressedMatrixBlock a, SideInput[] b, double[] scalars, int m, int n, boolean sparseSafe, int rl, int ru) {
    // safe aggregation for min/max w/ handling of zero entries
    // note: sparse safe with zero value as min/max handled outside
    double ret = (_aggOp == AggOp.MIN) ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
    ValueFunction vfun = getAggFunction();
    Iterator<IJV> iter = a.getIterator(rl, ru, !sparseSafe);
    while (iter.hasNext()) {
        IJV cell = iter.next();
        double val = genexec(cell.getV(), b, scalars, m, n, cell.getI(), cell.getJ());
        ret = vfun.execute(ret, val);
    }
    return ret;
}
Also used : ValueFunction(org.apache.sysml.runtime.functionobjects.ValueFunction) IJV(org.apache.sysml.runtime.matrix.data.IJV)

Example 30 with IJV

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

the class SpoofMultiAggregate method executeCompressed.

private void executeCompressed(CompressedMatrixBlock a, SideInput[] b, double[] scalars, double[] c, int m, int n, int rl, int ru) {
    // core compressed aggregation operation
    Iterator<IJV> iter = a.getIterator(rl, ru, true);
    while (iter.hasNext()) {
        IJV cell = iter.next();
        genexec(cell.getV(), b, scalars, c, m, n, cell.getI(), cell.getJ());
    }
}
Also used : IJV(org.apache.sysml.runtime.matrix.data.IJV)

Aggregations

IJV (org.apache.sysml.runtime.matrix.data.IJV)43 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)12 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)7 BufferedWriter (java.io.BufferedWriter)6 OutputStreamWriter (java.io.OutputStreamWriter)6 FileSystem (org.apache.hadoop.fs.FileSystem)6 SequenceFile (org.apache.hadoop.io.SequenceFile)6 SparseBlock (org.apache.sysml.runtime.matrix.data.SparseBlock)6 File (java.io.File)5 Path (org.apache.hadoop.fs.Path)5 JobConf (org.apache.hadoop.mapred.JobConf)5 IOException (java.io.IOException)4 Iterator (java.util.Iterator)4 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)4 MatrixCell (org.apache.sysml.runtime.matrix.data.MatrixCell)4 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)4 ArrayList (java.util.ArrayList)3 KahanFunction (org.apache.sysml.runtime.functionobjects.KahanFunction)3 ValueFunction (org.apache.sysml.runtime.functionobjects.ValueFunction)3 KahanObject (org.apache.sysml.runtime.instructions.cp.KahanObject)3