Repository: systemml Updated Branches: refs/heads/master 62a02464a -> 55b734227
http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java index f5a6312..ca12349 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java @@ -39,41 +39,35 @@ import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MapmmChainSPInstruction extends SPInstruction -{ - +public class MapmmChainSPInstruction extends SPInstruction { private ChainType _chainType = null; - private CPOperand _input1 = null; private CPOperand _input2 = null; - private CPOperand _input3 = null; - private CPOperand _output = null; - - - public MapmmChainSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, - ChainType type, String opcode, String istr ) - { + private CPOperand _input3 = null; + private CPOperand _output = null; + + private MapmmChainSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, ChainType type, + String opcode, String istr) { super(op, opcode, istr); _sptype = SPINSTRUCTION_TYPE.MAPMMCHAIN; - + _input1 = in1; _input2 = in2; _output = out; - + _chainType = type; } - - public MapmmChainSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, - ChainType type, String opcode, String istr ) - { + + private MapmmChainSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + ChainType type, String opcode, String istr) { super(op, opcode, istr); _sptype = SPINSTRUCTION_TYPE.MAPMMCHAIN; - + _input1 = in1; _input2 = in2; _input3 = in3; _output = out; - + _chainType = type; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java index 14e04ee..9fa2a14 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java @@ -55,18 +55,16 @@ import org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MapmmSPInstruction extends BinarySPInstruction -{ +public class MapmmSPInstruction extends BinarySPInstruction { private CacheType _type = null; private boolean _outputEmpty = true; private SparkAggType _aggtype; - - public MapmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, CacheType type, - boolean outputEmpty, SparkAggType aggtype, String opcode, String istr ) - { + + private MapmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, CacheType type, + boolean outputEmpty, SparkAggType aggtype, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.MAPMM; - + _type = type; _outputEmpty = outputEmpty; _aggtype = aggtype; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendMSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendMSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendMSPInstruction.java index 0765873..e047457 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendMSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendMSPInstruction.java @@ -41,13 +41,13 @@ import org.apache.sysml.runtime.matrix.data.OperationsOnMatrixValues; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixAppendMSPInstruction extends AppendMSPInstruction -{ - public MatrixAppendMSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand out, boolean cbind, String opcode, String istr) - { +public class MatrixAppendMSPInstruction extends AppendMSPInstruction { + + protected MatrixAppendMSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand out, + boolean cbind, String opcode, String istr) { super(op, in1, in2, offset, out, cbind, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendRSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendRSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendRSPInstruction.java index e292e94..40358bf 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendRSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixAppendRSPInstruction.java @@ -32,13 +32,13 @@ import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixAppendRSPInstruction extends AppendRSPInstruction -{ - public MatrixAppendRSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean cbind, String opcode, String istr) - { +public class MatrixAppendRSPInstruction extends AppendRSPInstruction { + + protected MatrixAppendRSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean cbind, + String opcode, String istr) { super(op, in1, in2, out, cbind, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorArithmeticSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorArithmeticSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorArithmeticSPInstruction.java index f733402..51545c0 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorArithmeticSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorArithmeticSPInstruction.java @@ -25,24 +25,19 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixBVectorArithmeticSPInstruction extends ArithmeticBinarySPInstruction -{ - +public class MatrixBVectorArithmeticSPInstruction extends ArithmeticBinarySPInstruction { private VectorType _vtype = null; - - public MatrixBVectorArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, VectorType vtype, String opcode, String istr) - throws DMLRuntimeException - { + + protected MatrixBVectorArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + VectorType vtype, String opcode, String istr) throws DMLRuntimeException { super(op, in1, in2, out, opcode, istr); - _vtype = vtype; - - //sanity check opcodes - if (!( opcode.equalsIgnoreCase("map+") || opcode.equalsIgnoreCase("map-") || opcode.equalsIgnoreCase("map*") - ||opcode.equalsIgnoreCase("map/") || opcode.equalsIgnoreCase("map%%") || opcode.equalsIgnoreCase("map%/%") - ||opcode.equalsIgnoreCase("map^") || opcode.equalsIgnoreCase("map1-*")) ) - { - throw new DMLRuntimeException("Unknown opcode in MatrixBVectorArithmeticSPInstruction: " + toString()); + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("map+") || opcode.equalsIgnoreCase("map-") || opcode.equalsIgnoreCase("map*") + || opcode.equalsIgnoreCase("map/") || opcode.equalsIgnoreCase("map%%") + || opcode.equalsIgnoreCase("map%/%") || opcode.equalsIgnoreCase("map^") + || opcode.equalsIgnoreCase("map1-*"))) { + throw new DMLRuntimeException("Unknown opcode in MatrixBVectorArithmeticSPInstruction: " + toString()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorBuiltinSPInstruction.java index 404bf39..76b40e0 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorBuiltinSPInstruction.java @@ -26,21 +26,15 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixBVectorBuiltinSPInstruction extends BuiltinBinarySPInstruction -{ - +public class MatrixBVectorBuiltinSPInstruction extends BuiltinBinarySPInstruction { private VectorType _vtype = null; - - public MatrixBVectorBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, VectorType vtype, String opcode, String istr) - throws DMLRuntimeException - { + + protected MatrixBVectorBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + VectorType vtype, String opcode, String istr) throws DMLRuntimeException { super(op, in1, in2, out, opcode, istr); - _vtype = vtype; - - //sanity check opcodes - if(!( opcode.equalsIgnoreCase("mapmax") || opcode.equalsIgnoreCase("mapmin")) ) - { + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("mapmax") || opcode.equalsIgnoreCase("mapmin"))) { throw new DMLRuntimeException("Unknown opcode in MatrixBVectorBuiltinSPInstruction: " + toString()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorRelationalSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorRelationalSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorRelationalSPInstruction.java index 242b490..27cb813 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorRelationalSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBVectorRelationalSPInstruction.java @@ -26,22 +26,17 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixBVectorRelationalSPInstruction extends RelationalBinarySPInstruction -{ - +public class MatrixBVectorRelationalSPInstruction extends RelationalBinarySPInstruction { private VectorType _vtype = null; - - public MatrixBVectorRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, VectorType vtype, String opcode, String istr) - throws DMLRuntimeException - { + + protected MatrixBVectorRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + VectorType vtype, String opcode, String istr) throws DMLRuntimeException { super(op, in1, in2, out, opcode, istr); - _vtype = vtype; - - //sanity check opcodes - if(!( opcode.equalsIgnoreCase("map==") || opcode.equalsIgnoreCase("map!=") || opcode.equalsIgnoreCase("map<") - ||opcode.equalsIgnoreCase("map>") || opcode.equalsIgnoreCase("map<=") || opcode.equalsIgnoreCase("map>=")) ) - { + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("map==") || opcode.equalsIgnoreCase("map!=") || opcode.equalsIgnoreCase("map<") + || opcode.equalsIgnoreCase("map>") || opcode.equalsIgnoreCase("map<=") + || opcode.equalsIgnoreCase("map>="))) { throw new DMLRuntimeException("Unknown opcode in MatrixBVectorRelationalSPInstruction: " + toString()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBuiltinSPInstruction.java index 208500b..f6e6264 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixBuiltinSPInstruction.java @@ -30,10 +30,9 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; -public class MatrixBuiltinSPInstruction extends BuiltinUnarySPInstruction -{ - - public MatrixBuiltinSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { +public class MatrixBuiltinSPInstruction extends BuiltinUnarySPInstruction { + + protected MatrixBuiltinSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { super(op, in, out, opcode, instr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java index b8aab2c..b4a0aeb 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java @@ -71,24 +71,21 @@ import org.apache.sysml.runtime.util.UtilFunctions; * the result is stored in mVar7 * */ -public class MatrixIndexingSPInstruction extends IndexingSPInstruction -{ +public class MatrixIndexingSPInstruction extends IndexingSPInstruction { private final LixCacheType _type; - public MatrixIndexingSPInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, SparkAggType aggtype, String opcode, String istr) - { + protected MatrixIndexingSPInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, + CPOperand cu, CPOperand out, SparkAggType aggtype, String opcode, String istr) { super(op, in, rl, ru, cl, cu, out, aggtype, opcode, istr); _type = LixCacheType.NONE; } - - public MatrixIndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, LixCacheType type, String opcode, String istr) - { + + protected MatrixIndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, + CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, LixCacheType type, String opcode, String istr) { super(op, lhsInput, rhsInput, rl, ru, cl, cu, out, opcode, istr); _type = type; } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixArithmeticSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixArithmeticSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixArithmeticSPInstruction.java index e722a43..945ab85 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixArithmeticSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixArithmeticSPInstruction.java @@ -24,23 +24,20 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixMatrixArithmeticSPInstruction extends ArithmeticBinarySPInstruction -{ - - public MatrixMatrixArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) - throws DMLRuntimeException - { +public class MatrixMatrixArithmeticSPInstruction extends ArithmeticBinarySPInstruction { + + protected MatrixMatrixArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) throws DMLRuntimeException { super(op, in1, in2, out, opcode, istr); - - //sanity check opcodes - if ( !( opcode.equalsIgnoreCase("+") || opcode.equalsIgnoreCase("-") || opcode.equalsIgnoreCase("*") - || opcode.equalsIgnoreCase("/") || opcode.equalsIgnoreCase("%%") || opcode.equalsIgnoreCase("%/%") - || opcode.equalsIgnoreCase("^") || opcode.equalsIgnoreCase("1-*") ) ) - { + + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("+") || opcode.equalsIgnoreCase("-") || opcode.equalsIgnoreCase("*") + || opcode.equalsIgnoreCase("/") || opcode.equalsIgnoreCase("%%") || opcode.equalsIgnoreCase("%/%") + || opcode.equalsIgnoreCase("^") || opcode.equalsIgnoreCase("1-*"))) { throw new DMLRuntimeException("Unknown opcode in MatrixMatrixArithmeticSPInstruction: " + toString()); - } + } } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixBuiltinSPInstruction.java index 1ab995e..147f24e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixBuiltinSPInstruction.java @@ -24,14 +24,13 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixMatrixBuiltinSPInstruction extends BuiltinBinarySPInstruction -{ - - public MatrixMatrixBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) - { +public class MatrixMatrixBuiltinSPInstruction extends BuiltinBinarySPInstruction { + + protected MatrixMatrixBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixRelationalSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixRelationalSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixRelationalSPInstruction.java index ede6ad1..0494ecd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixRelationalSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixMatrixRelationalSPInstruction.java @@ -24,23 +24,19 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; +public class MatrixMatrixRelationalSPInstruction extends RelationalBinarySPInstruction { -public class MatrixMatrixRelationalSPInstruction extends RelationalBinarySPInstruction -{ - - public MatrixMatrixRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) - throws DMLRuntimeException - { + protected MatrixMatrixRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) throws DMLRuntimeException { super(op, in1, in2, out, opcode, istr); - - //sanity check opcodes - if (!( opcode.equalsIgnoreCase("==") || opcode.equalsIgnoreCase("!=") || opcode.equalsIgnoreCase("<") - || opcode.equalsIgnoreCase(">") || opcode.equalsIgnoreCase("<=") || opcode.equalsIgnoreCase(">="))) - { - throw new DMLRuntimeException("Unknown opcode in MatrixMatrixRelationalSPInstruction: " + toString()); - } + + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("==") || opcode.equalsIgnoreCase("!=") || opcode.equalsIgnoreCase("<") + || opcode.equalsIgnoreCase(">") || opcode.equalsIgnoreCase("<=") || opcode.equalsIgnoreCase(">="))) { + throw new DMLRuntimeException("Unknown opcode in MatrixMatrixRelationalSPInstruction: " + toString()); + } } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixReshapeSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixReshapeSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixReshapeSPInstruction.java index f937c8e..9769792 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixReshapeSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixReshapeSPInstruction.java @@ -42,18 +42,17 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixReshapeSPInstruction extends UnarySPInstruction -{ - +public class MatrixReshapeSPInstruction extends UnarySPInstruction { + private CPOperand _opRows = null; private CPOperand _opCols = null; private CPOperand _opByRow = null; - - public MatrixReshapeSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand in4, CPOperand out, String opcode, String istr) - { + + private MatrixReshapeSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand in4, + CPOperand out, String opcode, String istr) { super(op, in1, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.MatrixReshape; - + _opRows = in2; _opCols = in3; _opByRow = in4; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarArithmeticSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarArithmeticSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarArithmeticSPInstruction.java index bbe96ff..5b51893 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarArithmeticSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarArithmeticSPInstruction.java @@ -24,13 +24,13 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixScalarArithmeticSPInstruction extends ArithmeticBinarySPInstruction -{ - - public MatrixScalarArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { +public class MatrixScalarArithmeticSPInstruction extends ArithmeticBinarySPInstruction { + + protected MatrixScalarArithmeticSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarBuiltinSPInstruction.java index 024e31b..6077d42 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarBuiltinSPInstruction.java @@ -24,14 +24,13 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixScalarBuiltinSPInstruction extends BuiltinBinarySPInstruction -{ - - public MatrixScalarBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String instr) - { +public class MatrixScalarBuiltinSPInstruction extends BuiltinBinarySPInstruction { + + protected MatrixScalarBuiltinSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String instr) { super(op, in1, in2, out, opcode, instr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarRelationalSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarRelationalSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarRelationalSPInstruction.java index 9f8edcb..a7f5392 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarRelationalSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixScalarRelationalSPInstruction.java @@ -24,11 +24,10 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MatrixScalarRelationalSPInstruction extends RelationalBinarySPInstruction -{ - - public MatrixScalarRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) - { +public class MatrixScalarRelationalSPInstruction extends RelationalBinarySPInstruction { + + protected MatrixScalarRelationalSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/MultiReturnParameterizedBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MultiReturnParameterizedBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MultiReturnParameterizedBuiltinSPInstruction.java index 586d282..6436389 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MultiReturnParameterizedBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MultiReturnParameterizedBuiltinSPInstruction.java @@ -67,12 +67,11 @@ import org.apache.sysml.runtime.transform.meta.TfOffsetMap; import scala.Tuple2; - -public class MultiReturnParameterizedBuiltinSPInstruction extends ComputationSPInstruction -{ +public class MultiReturnParameterizedBuiltinSPInstruction extends ComputationSPInstruction { protected ArrayList<CPOperand> _outputs; - - public MultiReturnParameterizedBuiltinSPInstruction(Operator op, CPOperand input1, CPOperand input2, ArrayList<CPOperand> outputs, String opcode, String istr ) { + + private MultiReturnParameterizedBuiltinSPInstruction(Operator op, CPOperand input1, CPOperand input2, + ArrayList<CPOperand> outputs, String opcode, String istr) { super(op, input1, input2, outputs.get(0), opcode, istr); _sptype = SPINSTRUCTION_TYPE.MultiReturnBuiltin; _outputs = outputs; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/PMapmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/PMapmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/PMapmmSPInstruction.java index eceeabc..1fd690f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/PMapmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/PMapmmSPInstruction.java @@ -55,13 +55,10 @@ import org.apache.sysml.runtime.matrix.operators.Operator; * not integrated in automatic operator selection yet. * */ -public class PMapmmSPInstruction extends BinarySPInstruction -{ - private static final int NUM_ROWBLOCKS=4; - - public PMapmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, - String opcode, String istr ) - { +public class PMapmmSPInstruction extends BinarySPInstruction { + private static final int NUM_ROWBLOCKS = 4; + + private PMapmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.MAPMM; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java index 1d4b96b..216bdc1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java @@ -83,16 +83,13 @@ import org.apache.sysml.runtime.transform.meta.TfOffsetMap; import org.apache.sysml.runtime.util.DataConverter; import org.apache.sysml.runtime.util.UtilFunctions; - -public class ParameterizedBuiltinSPInstruction extends ComputationSPInstruction -{ - protected HashMap<String,String> params; - - //removeEmpty-specific attributes +public class ParameterizedBuiltinSPInstruction extends ComputationSPInstruction { + protected HashMap<String, String> params; + // removeEmpty-specific attributes private boolean _bRmEmptyBC = false; - - public ParameterizedBuiltinSPInstruction(Operator op, HashMap<String,String> paramsMap, CPOperand out, String opcode, String istr, boolean bRmEmptyBC ) - { + + private ParameterizedBuiltinSPInstruction(Operator op, HashMap<String, String> paramsMap, CPOperand out, + String opcode, String istr, boolean bRmEmptyBC) { super(op, null, null, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.ParameterizedBuiltin; params = paramsMap; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/PlusMultSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/PlusMultSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/PlusMultSPInstruction.java index c93ed0a..9504551 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/PlusMultSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/PlusMultSPInstruction.java @@ -30,21 +30,18 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.instructions.cp.ScalarObject; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; -public class PlusMultSPInstruction extends ArithmeticBinarySPInstruction -{ - public PlusMultSPInstruction(BinaryOperator op, CPOperand in1, CPOperand in2, - CPOperand in3, CPOperand out, String opcode, String str) throws DMLRuntimeException - { +public class PlusMultSPInstruction extends ArithmeticBinarySPInstruction { + private PlusMultSPInstruction(BinaryOperator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + String opcode, String str) throws DMLRuntimeException { super(op, in1, in2, out, opcode, str); - input3= in3; - - //sanity check opcodes - if ( !( opcode.equalsIgnoreCase("+*") || opcode.equalsIgnoreCase("-*") ) ) - { + input3 = in3; + + // sanity check opcodes + if (!(opcode.equalsIgnoreCase("+*") || opcode.equalsIgnoreCase("-*"))) { throw new DMLRuntimeException("Unknown opcode in PlusMultSPInstruction: " + toString()); - } + } } - + public static PlusMultSPInstruction parseInstruction(String str) throws DMLRuntimeException { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/PmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/PmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/PmmSPInstruction.java index 2e6b46e..850d4ea 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/PmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/PmmSPInstruction.java @@ -48,17 +48,14 @@ import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.UtilFunctions; -public class PmmSPInstruction extends BinarySPInstruction -{ - +public class PmmSPInstruction extends BinarySPInstruction { private CacheType _type = null; private CPOperand _nrow = null; - - public PmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, CPOperand nrow, - CacheType type, String opcode, String istr ) - { + + private PmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, CPOperand nrow, CacheType type, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.PMM; + _sptype = SPINSTRUCTION_TYPE.PMM; _type = type; _nrow = nrow; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantilePickSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantilePickSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantilePickSPInstruction.java index c9eff49..3fc12ea 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantilePickSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantilePickSPInstruction.java @@ -42,20 +42,21 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.UtilFunctions; -public class QuantilePickSPInstruction extends BinarySPInstruction -{ +public class QuantilePickSPInstruction extends BinarySPInstruction { private OperationTypes _type = null; - - public QuantilePickSPInstruction(Operator op, CPOperand in, CPOperand out, OperationTypes type, boolean inmem, String opcode, String istr){ + + private QuantilePickSPInstruction(Operator op, CPOperand in, CPOperand out, OperationTypes type, boolean inmem, + String opcode, String istr) { this(op, in, null, out, type, inmem, opcode, istr); } - - public QuantilePickSPInstruction(Operator op, CPOperand in, CPOperand in2, CPOperand out, OperationTypes type, boolean inmem, String opcode, String istr){ + + private QuantilePickSPInstruction(Operator op, CPOperand in, CPOperand in2, CPOperand out, OperationTypes type, + boolean inmem, String opcode, String istr) { super(op, in, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.QPick; - + _type = type; - //inmem ignored here + // inmem ignored here } public static QuantilePickSPInstruction parseInstruction ( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantileSortSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantileSortSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantileSortSPInstruction.java index 4be5fd0..6b31ba8 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantileSortSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuantileSortSPInstruction.java @@ -36,27 +36,26 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.SimpleOperator; -public class QuantileSortSPInstruction extends UnarySPInstruction -{ - - /* - * This class supports two variants of sort operation on a 1-dimensional input matrix. - * The two variants are <code> weighted </code> and <code> unweighted </code>. - * Example instructions: - * sort:mVar1:mVar2 (input=mVar1, output=mVar2) - * sort:mVar1:mVar2:mVar3 (input=mVar1, weights=mVar2, output=mVar3) - * - */ - - public QuantileSortSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr){ +/** + * This class supports two variants of sort operation on a 1-dimensional input matrix. + * The two variants are <code> weighted </code> and <code> unweighted </code>. + * Example instructions: + * sort:mVar1:mVar2 (input=mVar1, output=mVar2) + * sort:mVar1:mVar2:mVar3 (input=mVar1, weights=mVar2, output=mVar3) + * + */ +public class QuantileSortSPInstruction extends UnarySPInstruction { + + private QuantileSortSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { this(op, in, null, out, opcode, istr); } - - public QuantileSortSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr){ + + private QuantileSortSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.QSort; } - + public static QuantileSortSPInstruction parseInstruction ( String str ) throws DMLRuntimeException { CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/QuaternarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuaternarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuaternarySPInstruction.java index 711e3d0..907fa6f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/QuaternarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/QuaternarySPInstruction.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.instructions.spark; - import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; @@ -60,19 +59,17 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.QuaternaryOperator; -public class QuaternarySPInstruction extends ComputationSPInstruction -{ - +public class QuaternarySPInstruction extends ComputationSPInstruction { private CPOperand _input4 = null; private boolean _cacheU = false; private boolean _cacheV = false; - - public QuaternarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand in4, CPOperand out, boolean cacheU, boolean cacheV, String opcode, String str) - { + + private QuaternarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand in4, + CPOperand out, boolean cacheU, boolean cacheV, String opcode, String str) { super(op, in1, in2, in3, out, opcode, str); _sptype = SPINSTRUCTION_TYPE.Quaternary; _input4 = in4; - + _cacheU = cacheU; _cacheV = cacheV; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java index 9d89ae1..668a7d6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java @@ -66,13 +66,12 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.UtilFunctions; import org.apache.sysml.utils.Statistics; -public class RandSPInstruction extends UnarySPInstruction -{ - //internal configuration +public class RandSPInstruction extends UnarySPInstruction { + // internal configuration private static final long INMEMORY_NUMBLOCKS_THRESHOLD = 1024 * 1024; - + private DataGenMethod method = DataGenMethod.INVALID; - + private long rows; private long cols; private int rowsInBlock; @@ -82,21 +81,20 @@ public class RandSPInstruction extends UnarySPInstruction private double sparsity; private String pdf; private String pdfParams; - private long seed=0; + private long seed = 0; private String dir; private double seq_from; - private double seq_to; + private double seq_to; private double seq_incr; - - //sample specific attributes + + // sample specific attributes private boolean replace; - public RandSPInstruction (Operator op, DataGenMethod mthd, CPOperand in, CPOperand out, long rows, long cols, + private RandSPInstruction(Operator op, DataGenMethod mthd, CPOperand in, CPOperand out, long rows, long cols, int rpb, int cpb, double minValue, double maxValue, double sparsity, long seed, String dir, - String probabilityDensityFunction, String pdfParams, String opcode, String istr) - { + String probabilityDensityFunction, String pdfParams, String opcode, String istr) { super(op, in, out, opcode, istr); - + this.method = mthd; this.rows = rows; this.cols = cols; @@ -112,10 +110,8 @@ public class RandSPInstruction extends UnarySPInstruction } - public RandSPInstruction(Operator op, DataGenMethod mthd, CPOperand in, CPOperand out, - long rows, long cols, int rpb, int cpb, double seqFrom, - double seqTo, double seqIncr, String opcode, String istr) - { + private RandSPInstruction(Operator op, DataGenMethod mthd, CPOperand in, CPOperand out, long rows, long cols, + int rpb, int cpb, double seqFrom, double seqTo, double seqIncr, String opcode, String istr) { super(op, in, out, opcode, istr); this.method = mthd; this.rows = rows; @@ -127,10 +123,8 @@ public class RandSPInstruction extends UnarySPInstruction this.seq_incr = seqIncr; } - public RandSPInstruction(Operator op, DataGenMethod mthd, CPOperand in, - CPOperand out, long rows, long cols, int rpb, int cpb, - double maxValue, boolean replace, long seed, String opcode, - String istr) { + private RandSPInstruction(Operator op, DataGenMethod mthd, CPOperand in, CPOperand out, long rows, long cols, + int rpb, int cpb, double maxValue, boolean replace, long seed, String opcode, String istr) { super(op, in, out, opcode, istr); this.method = mthd; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ReblockSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ReblockSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ReblockSPInstruction.java index f99d47f..f97032b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ReblockSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ReblockSPInstruction.java @@ -46,21 +46,19 @@ import org.apache.sysml.runtime.matrix.data.MatrixCell; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; -public class ReblockSPInstruction extends UnarySPInstruction -{ - private int brlen; +public class ReblockSPInstruction extends UnarySPInstruction { + private int brlen; private int bclen; private boolean outputEmptyBlocks; - - public ReblockSPInstruction(Operator op, CPOperand in, CPOperand out, int br, int bc, boolean emptyBlocks, - String opcode, String instr) - { + + private ReblockSPInstruction(Operator op, CPOperand in, CPOperand out, int br, int bc, boolean emptyBlocks, + String opcode, String instr) { super(op, in, out, opcode, instr); - brlen=br; - bclen=bc; + brlen = br; + bclen = bc; outputEmptyBlocks = emptyBlocks; } - + public static ReblockSPInstruction parseInstruction(String str) throws DMLRuntimeException { String parts[] = InstructionUtils.getInstructionPartsWithValueType(str); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/RelationalBinarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/RelationalBinarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/RelationalBinarySPInstruction.java index 2c6956c..42e4de5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/RelationalBinarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/RelationalBinarySPInstruction.java @@ -29,13 +29,13 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class RelationalBinarySPInstruction extends BinarySPInstruction { - - public RelationalBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) - { + + protected RelationalBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.RelationalBinary; } - + public static RelationalBinarySPInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ReorgSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ReorgSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ReorgSPInstruction.java index ce1c584..b547310 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ReorgSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ReorgSPInstruction.java @@ -54,21 +54,20 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; import org.apache.sysml.runtime.util.UtilFunctions; -public class ReorgSPInstruction extends UnarySPInstruction -{ - - //sort-specific attributes (to enable variable attributes) - private CPOperand _col = null; - private CPOperand _desc = null; - private CPOperand _ixret = null; - private boolean _bSortIndInMem = false; - - public ReorgSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr){ +public class ReorgSPInstruction extends UnarySPInstruction { + // sort-specific attributes (to enable variable attributes) + private CPOperand _col = null; + private CPOperand _desc = null; + private CPOperand _ixret = null; + private boolean _bSortIndInMem = false; + + private ReorgSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { super(op, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.Reorg; } - - public ReorgSPInstruction(Operator op, CPOperand in, CPOperand col, CPOperand desc, CPOperand ixret, CPOperand out, String opcode, boolean bSortIndInMem, String istr){ + + private ReorgSPInstruction(Operator op, CPOperand in, CPOperand col, CPOperand desc, CPOperand ixret, CPOperand out, + String opcode, boolean bSortIndInMem, String istr) { this(op, in, out, opcode, istr); _col = col; _desc = desc; @@ -76,7 +75,7 @@ public class ReorgSPInstruction extends UnarySPInstruction _sptype = SPINSTRUCTION_TYPE.Reorg; _bSortIndInMem = bSortIndInMem; } - + public static ReorgSPInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/RmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/RmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/RmmSPInstruction.java index e1eb724..43ba34a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/RmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/RmmSPInstruction.java @@ -48,13 +48,11 @@ import org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; -public class RmmSPInstruction extends BinarySPInstruction -{ - - public RmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) - { +public class RmmSPInstruction extends BinarySPInstruction { + + private RmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.RMM; + _sptype = SPINSTRUCTION_TYPE.RMM; } public static RmmSPInstruction parseInstruction( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java index 17d1561..0261357 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java @@ -27,9 +27,8 @@ import org.apache.sysml.runtime.instructions.SPInstructionParser; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.Statistics; -public abstract class SPInstruction extends Instruction -{ - +public abstract class SPInstruction extends Instruction { + public enum SPINSTRUCTION_TYPE { MAPMM, MAPMMCHAIN, CPMM, RMM, TSMM, TSMM2, PMM, ZIPMM, PMAPMM, //matrix multiplication instructions MatrixIndexing, Reorg, ArithmeticBinary, RelationalBinary, AggregateUnary, AggregateTernary, Reblock, CSVReblock, @@ -40,26 +39,25 @@ public abstract class SPInstruction extends Instruction Write, SpoofFused, INVALID, Convolution }; - + protected SPINSTRUCTION_TYPE _sptype; protected Operator _optr; - protected boolean _requiresLabelUpdate = false; - - public SPInstruction(String opcode, String istr) { + + protected SPInstruction(String opcode, String istr) { type = INSTRUCTION_TYPE.SPARK; instString = istr; instOpcode = opcode; - - //update requirement for repeated usage + + // update requirement for repeated usage _requiresLabelUpdate = super.requiresLabelUpdate(); } - - public SPInstruction(Operator op, String opcode, String istr) { + + protected SPInstruction(Operator op, String opcode, String istr) { this(opcode, istr); _optr = op; } - + public SPINSTRUCTION_TYPE getSPInstructionType() { return _sptype; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java index 34041cf..2d609aa 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java @@ -66,14 +66,14 @@ import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import scala.Tuple2; -public class SpoofSPInstruction extends SPInstruction -{ +public class SpoofSPInstruction extends SPInstruction { private final Class<?> _class; private final byte[] _classBytes; private final CPOperand[] _in; private final CPOperand _out; - - public SpoofSPInstruction(Class<?> cls, byte[] classBytes, CPOperand[] in, CPOperand out, String opcode, String str) { + + private SpoofSPInstruction(Class<?> cls, byte[] classBytes, CPOperand[] in, CPOperand out, String opcode, + String str) { super(opcode, str); _class = cls; _classBytes = classBytes; @@ -81,7 +81,7 @@ public class SpoofSPInstruction extends SPInstruction _in = in; _out = out; } - + public static SpoofSPInstruction parseInstruction(String str) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java index 8bb62dc..e0c8d18 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java @@ -53,20 +53,17 @@ import org.apache.sysml.runtime.matrix.operators.SimpleOperator; import org.apache.sysml.runtime.util.LongLongDoubleHashMap.LLDoubleEntry; import org.apache.sysml.runtime.util.UtilFunctions; -public class TernarySPInstruction extends ComputationSPInstruction -{ - +public class TernarySPInstruction extends ComputationSPInstruction { private String _outDim1; private String _outDim2; - private boolean _dim1Literal; + private boolean _dim1Literal; private boolean _dim2Literal; private boolean _isExpand; private boolean _ignoreZeros; - - public TernarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, - String outputDim1, boolean dim1Literal,String outputDim2, boolean dim2Literal, - boolean isExpand, boolean ignoreZeros, String opcode, String istr ) - { + + private TernarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + String outputDim1, boolean dim1Literal, String outputDim2, boolean dim2Literal, boolean isExpand, + boolean ignoreZeros, String opcode, String istr) { super(op, in1, in2, in3, out, opcode, istr); _outDim1 = outputDim1; _dim1Literal = dim1Literal; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java index 26461a6..dd9d939 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java @@ -53,14 +53,12 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import scala.Tuple2; -public class Tsmm2SPInstruction extends UnarySPInstruction -{ +public class Tsmm2SPInstruction extends UnarySPInstruction { private MMTSJType _type = null; - - public Tsmm2SPInstruction(Operator op, CPOperand in1, CPOperand out, MMTSJType type, String opcode, String istr ) - { + + private Tsmm2SPInstruction(Operator op, CPOperand in1, CPOperand out, MMTSJType type, String opcode, String istr) { super(op, in1, out, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.TSMM2; + _sptype = SPINSTRUCTION_TYPE.TSMM2; _type = type; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java index 61a9130..1caaf17 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java @@ -36,15 +36,12 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import scala.Tuple2; -public class TsmmSPInstruction extends UnarySPInstruction -{ - +public class TsmmSPInstruction extends UnarySPInstruction { private MMTSJType _type = null; - - public TsmmSPInstruction(Operator op, CPOperand in1, CPOperand out, MMTSJType type, String opcode, String istr ) - { + + private TsmmSPInstruction(Operator op, CPOperand in1, CPOperand out, MMTSJType type, String opcode, String istr) { super(op, in1, out, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.TSMM; + _sptype = SPINSTRUCTION_TYPE.TSMM; _type = type; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java index a270706..51ea00b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java @@ -61,22 +61,21 @@ import org.apache.sysml.runtime.util.DataConverter; * 1. Array of type double: Matrix B is sorted at driver level and passed to every task for cases where operations are handled with special cases. e.g. <, RowSum * 2. PartitionedMatrixBlock: Any operations not implemented through this change goes through generic process, In that case, task takes Matrix B, in partitioned form and operate on it. */ -public class UaggOuterChainSPInstruction extends BinarySPInstruction -{ - //operators +public class UaggOuterChainSPInstruction extends BinarySPInstruction { + // operators private AggregateUnaryOperator _uaggOp = null; private AggregateOperator _aggOp = null; private BinaryOperator _bOp = null; - public UaggOuterChainSPInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) - { + private UaggOuterChainSPInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, + CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(bop, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.UaggOuterChain; - + _uaggOp = uaggop; _aggOp = aggop; _bOp = bop; - + _sptype = SPINSTRUCTION_TYPE.UaggOuterChain; instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java index 4d2bbd2..7cbf0d6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java @@ -24,21 +24,19 @@ import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; -public abstract class UnarySPInstruction extends ComputationSPInstruction -{ - - public UnarySPInstruction(Operator op, CPOperand in, CPOperand out, - String opcode, String instr) { - this (op, in, null, null, out, opcode, instr); +public abstract class UnarySPInstruction extends ComputationSPInstruction { + + protected UnarySPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { + this(op, in, null, null, out, opcode, instr); } - public UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, - String opcode, String instr) { - this (op, in1, in2, null, out, opcode, instr); + protected UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String instr) { + this(op, in1, in2, null, out, opcode, instr); } - public UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, - String opcode, String instr) { + protected UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, + String instr) { super(op, in1, in2, in3, out, opcode, instr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java index 8bfee87..6578b86 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java @@ -49,20 +49,19 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.data.OutputInfo; import org.apache.sysml.runtime.util.MapReduceTool; -public class WriteSPInstruction extends SPInstruction -{ - private CPOperand input1 = null; +public class WriteSPInstruction extends SPInstruction { + private CPOperand input1 = null; private CPOperand input2 = null; private CPOperand input3 = null; private CPOperand input4 = null; private FileFormatProperties formatProperties; - public WriteSPInstruction(CPOperand in1, CPOperand in2, CPOperand in3, String opcode, String str) { + private WriteSPInstruction(CPOperand in1, CPOperand in2, CPOperand in3, String opcode, String str) { super(opcode, str); input1 = in1; input2 = in2; input3 = in3; - + formatProperties = null; // set in case of csv } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java index e61e39b..5a6c22c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java @@ -41,17 +41,15 @@ import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; - -public class ZipmmSPInstruction extends BinarySPInstruction -{ - //internal flag to apply left-transpose rewrite or not +public class ZipmmSPInstruction extends BinarySPInstruction { + // internal flag to apply left-transpose rewrite or not private boolean _tRewrite = true; - - public ZipmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean tRewrite, String opcode, String istr ) - { + + private ZipmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean tRewrite, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.ZIPMM; - + _tRewrite = tRewrite; }
