use of org.apache.sysml.runtime.codegen.SpoofRowwise.RowType in project incubator-systemml by apache.
the class SpoofSPInstruction method updateOutputMatrixCharacteristics.
private void updateOutputMatrixCharacteristics(SparkExecutionContext sec, SpoofOperator op) {
if (op instanceof SpoofCellwise) {
MatrixCharacteristics mcIn = sec.getMatrixCharacteristics(_in[0].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
if (((SpoofCellwise) op).getCellType() == CellType.ROW_AGG)
mcOut.set(mcIn.getRows(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (((SpoofCellwise) op).getCellType() == CellType.NO_AGG)
mcOut.set(mcIn);
} else if (op instanceof SpoofOuterProduct) {
// X
MatrixCharacteristics mcIn1 = sec.getMatrixCharacteristics(_in[0].getName());
// U
MatrixCharacteristics mcIn2 = sec.getMatrixCharacteristics(_in[1].getName());
// V
MatrixCharacteristics mcIn3 = sec.getMatrixCharacteristics(_in[2].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
OutProdType type = ((SpoofOuterProduct) op).getOuterProdType();
if (type == OutProdType.CELLWISE_OUTER_PRODUCT)
mcOut.set(mcIn1.getRows(), mcIn1.getCols(), mcIn1.getRowsPerBlock(), mcIn1.getColsPerBlock());
else if (type == OutProdType.LEFT_OUTER_PRODUCT)
mcOut.set(mcIn3.getRows(), mcIn3.getCols(), mcIn3.getRowsPerBlock(), mcIn3.getColsPerBlock());
else if (type == OutProdType.RIGHT_OUTER_PRODUCT)
mcOut.set(mcIn2.getRows(), mcIn2.getCols(), mcIn2.getRowsPerBlock(), mcIn2.getColsPerBlock());
} else if (op instanceof SpoofRowwise) {
MatrixCharacteristics mcIn = sec.getMatrixCharacteristics(_in[0].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
RowType type = ((SpoofRowwise) op).getRowType();
if (type == RowType.NO_AGG)
mcOut.set(mcIn);
else if (type == RowType.ROW_AGG)
mcOut.set(mcIn.getRows(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (type == RowType.COL_AGG)
mcOut.set(1, mcIn.getCols(), mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (type == RowType.COL_AGG_T)
mcOut.set(mcIn.getCols(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
}
}
use of org.apache.sysml.runtime.codegen.SpoofRowwise.RowType in project systemml by apache.
the class SpoofSPInstruction method updateOutputMatrixCharacteristics.
private void updateOutputMatrixCharacteristics(SparkExecutionContext sec, SpoofOperator op) {
if (op instanceof SpoofCellwise) {
MatrixCharacteristics mcIn = sec.getMatrixCharacteristics(_in[0].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
if (((SpoofCellwise) op).getCellType() == CellType.ROW_AGG)
mcOut.set(mcIn.getRows(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (((SpoofCellwise) op).getCellType() == CellType.NO_AGG)
mcOut.set(mcIn);
} else if (op instanceof SpoofOuterProduct) {
// X
MatrixCharacteristics mcIn1 = sec.getMatrixCharacteristics(_in[0].getName());
// U
MatrixCharacteristics mcIn2 = sec.getMatrixCharacteristics(_in[1].getName());
// V
MatrixCharacteristics mcIn3 = sec.getMatrixCharacteristics(_in[2].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
OutProdType type = ((SpoofOuterProduct) op).getOuterProdType();
if (type == OutProdType.CELLWISE_OUTER_PRODUCT)
mcOut.set(mcIn1.getRows(), mcIn1.getCols(), mcIn1.getRowsPerBlock(), mcIn1.getColsPerBlock());
else if (type == OutProdType.LEFT_OUTER_PRODUCT)
mcOut.set(mcIn3.getRows(), mcIn3.getCols(), mcIn3.getRowsPerBlock(), mcIn3.getColsPerBlock());
else if (type == OutProdType.RIGHT_OUTER_PRODUCT)
mcOut.set(mcIn2.getRows(), mcIn2.getCols(), mcIn2.getRowsPerBlock(), mcIn2.getColsPerBlock());
} else if (op instanceof SpoofRowwise) {
MatrixCharacteristics mcIn = sec.getMatrixCharacteristics(_in[0].getName());
MatrixCharacteristics mcOut = sec.getMatrixCharacteristics(_out.getName());
RowType type = ((SpoofRowwise) op).getRowType();
if (type == RowType.NO_AGG)
mcOut.set(mcIn);
else if (type == RowType.ROW_AGG)
mcOut.set(mcIn.getRows(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (type == RowType.COL_AGG)
mcOut.set(1, mcIn.getCols(), mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
else if (type == RowType.COL_AGG_T)
mcOut.set(mcIn.getCols(), 1, mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
}
}
Aggregations