http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java index bff774b..3d4c4c7 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java @@ -32,18 +32,16 @@ import org.apache.sysml.runtime.matrix.operators.CMOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.CMOperator.AggregateOperationTypes; - -public class GroupedAggregateInstruction extends UnaryMRInstructionBase -{ +public class GroupedAggregateInstruction extends UnaryMRInstructionBase { private boolean _weights = false; private int _ngroups = -1; private long _bclen = -1; - - public GroupedAggregateInstruction(Operator op, byte in, byte out, boolean weights, int ngroups, String istr) { + + private GroupedAggregateInstruction(Operator op, byte in, byte out, boolean weights, int ngroups, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.GroupedAggregate; instString = istr; - + _weights = weights; _ngroups = ngroups; }
http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java index 1efc5d4..0f90341 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java @@ -37,13 +37,10 @@ import org.apache.sysml.runtime.matrix.mapred.MRBaseForCommonInstructions; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class GroupedAggregateMInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer -{ +public class GroupedAggregateMInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer { private int _ngroups = -1; - - public GroupedAggregateMInstruction(Operator op, byte in1, byte in2, byte out, int ngroups, String istr) - { + + private GroupedAggregateMInstruction(Operator op, byte in1, byte in2, byte out, int ngroups, String istr) { super(op, in1, in2, out); _ngroups = ngroups; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java index a7614b5..217e452 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java @@ -30,17 +30,14 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; -public class MMTSJMRInstruction extends UnaryInstruction -{ - +public class MMTSJMRInstruction extends UnaryInstruction { private MMTSJType _type = null; - public MMTSJMRInstruction(Operator op, byte in, MMTSJType type, byte out, String istr) - { + private MMTSJMRInstruction(Operator op, byte in, MMTSJType type, byte out, String istr) { super(op, in, out, istr); mrtype = MRINSTRUCTION_TYPE.MMTSJ; instString = istr; - + _type = type; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java index ad98ad7..7d05010 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java @@ -27,22 +27,21 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; +public abstract class MRInstruction extends Instruction { + + public enum MRINSTRUCTION_TYPE { + INVALID, Append, Aggregate, ArithmeticBinary, ArithmeticBinary2, AggregateBinary, AggregateUnary, Rand, + Seq, CSVReblock, CSVWrite, Reblock, Reorg, Replicate, Unary, CombineBinary, CombineUnary, CombineTernary, + PickByCount, Partition, Ternary, Quaternary, CM_N_COV, MapGroupedAggregate, GroupedAggregate, RangeReIndex, + ZeroOut, MMTSJ, PMMJ, MatrixReshape, ParameterizedBuiltin, Sort, MapMultChain, CumsumAggregate, CumsumSplit, + CumsumOffset, BinUaggChain, UaggOuterChain, RemoveEmpty + }; -public abstract class MRInstruction extends Instruction -{ - - public enum MRINSTRUCTION_TYPE { INVALID, Append, Aggregate, ArithmeticBinary, ArithmeticBinary2, AggregateBinary, AggregateUnary, - Rand, Seq, CSVReblock, CSVWrite, - Reblock, Reorg, Replicate, Unary, CombineBinary, CombineUnary, CombineTernary, PickByCount, Partition, - Ternary, Quaternary, CM_N_COV, MapGroupedAggregate, GroupedAggregate, RangeReIndex, ZeroOut, MMTSJ, PMMJ, MatrixReshape, ParameterizedBuiltin, Sort, MapMultChain, - CumsumAggregate, CumsumSplit, CumsumOffset, BinUaggChain, UaggOuterChain, RemoveEmpty}; - - protected MRINSTRUCTION_TYPE mrtype; protected Operator optr; public byte output; - - public MRInstruction (Operator op, byte out) { + + protected MRInstruction(Operator op, byte out) { type = INSTRUCTION_TYPE.MAPREDUCE; optr = op; output = out; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java index f238b01..da5e9fd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java @@ -32,33 +32,32 @@ import org.apache.sysml.runtime.matrix.mapred.DistributedCacheInput; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.mapred.MRBaseForCommonInstructions; -public class MapMultChainInstruction extends MRInstruction implements IDistributedCacheConsumer -{ +public class MapMultChainInstruction extends MRInstruction implements IDistributedCacheConsumer { private ChainType _chainType = null; - private byte _input1 = -1; private byte _input2 = -1; - private byte _input3 = -1; - + private byte _input3 = -1; + /** * Two matrix inputs - type XtXv * - * @param type chain type - * @param in1 input byte 1 - * @param in2 input byte 2 - * @param out output byte - * @param istr instruction string + * @param type + * chain type + * @param in1 + * input byte 1 + * @param in2 + * input byte 2 + * @param out + * output byte + * @param istr + * instruction string */ - public MapMultChainInstruction(ChainType type, byte in1, byte in2, byte out, String istr) - { + private MapMultChainInstruction(ChainType type, byte in1, byte in2, byte out, String istr) { super(null, out); - _chainType = type; - _input1 = in1; _input2 = in2; _input3 = -1; - mrtype = MRINSTRUCTION_TYPE.MapMultChain; instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java index 4844a6e..5b2d295 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java @@ -31,25 +31,23 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.UtilFunctions; -public class MatrixReshapeMRInstruction extends UnaryInstruction -{ +public class MatrixReshapeMRInstruction extends UnaryInstruction { private boolean _byrow = false; - private MatrixCharacteristics _mcIn = null; private MatrixCharacteristics _mcOut = null; - - //MB: cache should be integrated with tempValues, but for n blocks + + // MB: cache should be integrated with tempValues, but for n blocks private ArrayList<IndexedMatrixValue> _cache = null; - - public MatrixReshapeMRInstruction(Operator op, byte in, long rows, long cols, boolean byrow, byte out, String istr) - { + + private MatrixReshapeMRInstruction(Operator op, byte in, long rows, long cols, boolean byrow, byte out, + String istr) { super(op, in, out, istr); mrtype = MRINSTRUCTION_TYPE.MMTSJ; instString = istr; _mcOut = new MatrixCharacteristics(rows, cols, -1, -1); _byrow = byrow; } - + public void setMatrixCharacteristics( MatrixCharacteristics mcIn, MatrixCharacteristics mcOut ) { _mcIn = mcIn; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java index b9737c8..e1a9c8b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java @@ -34,24 +34,21 @@ import org.apache.sysml.runtime.matrix.mapred.MRBaseForCommonInstructions; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.UtilFunctions; -public class PMMJMRInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer -{ - +public class PMMJMRInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer { private long _rlen = -1; private boolean _outputEmptyBlocks = true; - - - public PMMJMRInstruction(Operator op, byte in1, byte in2, byte out, long nrow, CacheType ctype, boolean outputEmpty, String istr) - { + + private PMMJMRInstruction(Operator op, byte in1, byte in2, byte out, long nrow, CacheType ctype, + boolean outputEmpty, String istr) { super(op, in1, in2, out); instString = istr; - + _rlen = nrow; _outputEmptyBlocks = outputEmpty; - - //NOTE: cache type only used by distributed cache input + + // NOTE: cache type only used by distributed cache input } - + public long getNumRows() { return _rlen; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java index a848597..797bb0d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java @@ -37,31 +37,30 @@ import org.apache.sysml.runtime.util.UtilFunctions; * Supported opcodes: replace. * */ -public class ParameterizedBuiltinMRInstruction extends UnaryInstruction -{ +public class ParameterizedBuiltinMRInstruction extends UnaryInstruction { String _opcode = null; - - //replace-specific attributes + + // replace-specific attributes private double _pattern; private double _replace; - - //rexpand-specific attributes + + // rexpand-specific attributes private double _max; private boolean _dirRows; private boolean _cast; private boolean _ignore; - - public ParameterizedBuiltinMRInstruction(Operator op, byte in, double pattern, double replace, byte out, String opcode, String istr) - { + + private ParameterizedBuiltinMRInstruction(Operator op, byte in, double pattern, double replace, byte out, + String opcode, String istr) { super(op, in, out, istr); instString = istr; _opcode = opcode; _pattern = pattern; _replace = replace; } - - public ParameterizedBuiltinMRInstruction(Operator op, byte in, double max, boolean dirRows, boolean cast, boolean ignore, byte out, String opcode, String istr) - { + + private ParameterizedBuiltinMRInstruction(Operator op, byte in, double max, boolean dirRows, boolean cast, + boolean ignore, byte out, String opcode, String istr) { super(op, in, out, istr); instString = istr; _opcode = opcode; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java index c1c0796..3ef0f53 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java @@ -27,43 +27,41 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; +public class PickByCountInstruction extends MRInstruction { -public class PickByCountInstruction extends MRInstruction -{ - public byte input1; // used for both valuepick and rangepick public byte input2; // used only for valuepick public double cst; // used only for rangepick - public boolean isValuePick=true; - + public boolean isValuePick = true; + /* - * Constructor for valuepick - * valuepick:::0:DOUBLE:::1:DOUBLE:::2:DOUBLE - * 0 is data matrix, 1 is the quantile matrix, 2 will have the resulting picked data items + * Constructor for valuepick valuepick:::0:DOUBLE:::1:DOUBLE:::2:DOUBLE 0 is + * data matrix, 1 is the quantile matrix, 2 will have the resulting picked + * data items */ - public PickByCountInstruction(Operator op, byte _in1, byte _in2, byte out, String istr) { + private PickByCountInstruction(Operator op, byte _in1, byte _in2, byte out, String istr) { super(op, out); input1 = _in1; input2 = _in2; cst = 0; mrtype = MRINSTRUCTION_TYPE.PickByCount; instString = istr; - isValuePick=true; + isValuePick = true; } /* - * Constructor for rangepick - * rangepick:::0:DOUBLE:::0.25:DOUBLE:::1:DOUBLE - * 0 is data matrix, 0.25 is the quantile that needs to be removed from both ends in the PDF, - * 1 will have the resulting picked data items between [Q_1-Q_3] + * Constructor for rangepick rangepick:::0:DOUBLE:::0.25:DOUBLE:::1:DOUBLE 0 + * is data matrix, 0.25 is the quantile that needs to be removed from both + * ends in the PDF, 1 will have the resulting picked data items between + * [Q_1-Q_3] */ - public PickByCountInstruction(Operator op, byte _in1, double _cst, byte out, String istr) { + private PickByCountInstruction(Operator op, byte _in1, double _cst, byte out, String istr) { super(op, out); input1 = _in1; cst = _cst; mrtype = MRINSTRUCTION_TYPE.PickByCount; instString = istr; - isValuePick=false; + isValuePick = false; } public static PickByCountInstruction parseInstruction ( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/PlusMultInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/PlusMultInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/PlusMultInstruction.java index 8190e8c..fac476d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/PlusMultInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/PlusMultInstruction.java @@ -28,10 +28,8 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class PlusMultInstruction extends BinaryInstruction -{ - public PlusMultInstruction(Operator op, byte in1, byte in2, byte out, String istr) { +public class PlusMultInstruction extends BinaryInstruction { + private PlusMultInstruction(Operator op, byte in1, byte in2, byte out, String istr) { super(op, in1, in2, out, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java index 1cd1750..327af32 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java @@ -47,31 +47,30 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.QuaternaryOperator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; -public class QuaternaryInstruction extends MRInstruction implements IDistributedCacheConsumer -{ +public class QuaternaryInstruction extends MRInstruction implements IDistributedCacheConsumer { private byte _input1 = -1; private byte _input2 = -1; - private byte _input3 = -1; + private byte _input3 = -1; private byte _input4 = -1; - + private boolean _cacheU = false; private boolean _cacheV = false; - public QuaternaryInstruction(Operator op, byte in1, byte in2, byte in3, byte in4, byte out, boolean cacheU, boolean cacheV, String istr) - { + private QuaternaryInstruction(Operator op, byte in1, byte in2, byte in3, byte in4, byte out, boolean cacheU, + boolean cacheV, String istr) { super(op, out); mrtype = MRINSTRUCTION_TYPE.Quaternary; instString = istr; - + _input1 = in1; _input2 = in2; _input3 = in3; _input4 = in4; - + _cacheU = cacheU; _cacheV = cacheV; } - + public byte getInput1() { return _input1; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java index ed0f883..07b0a46 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java @@ -27,19 +27,18 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class RandInstruction extends DataGenMRInstruction -{ +public class RandInstruction extends DataGenMRInstruction { private double minValue; private double maxValue; private double sparsity; private String probabilityDensityFunction; private String pdfParams; - - private long seed=0; - - public RandInstruction ( Operator op, byte in, byte out, long rows, long cols, int rpb, int cpb, double minValue, double maxValue, - double sparsity, long seed, String probabilityDensityFunction, String params, String baseDir, String istr ) { + + private long seed = 0; + + private RandInstruction(Operator op, byte in, byte out, long rows, long cols, int rpb, int cpb, double minValue, + double maxValue, double sparsity, long seed, String probabilityDensityFunction, String params, + String baseDir, String istr) { super(op, DataGenMethod.RAND, in, out, rows, cols, rpb, cpb, baseDir); mrtype = MRINSTRUCTION_TYPE.Rand; this.minValue = minValue; @@ -50,7 +49,7 @@ public class RandInstruction extends DataGenMRInstruction this.pdfParams = params; instString = istr; } - + public String getPdfParams() { return pdfParams; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java index 0354bc8..79d15ec 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java @@ -33,15 +33,14 @@ import org.apache.sysml.runtime.matrix.operators.ReIndexOperator; import org.apache.sysml.runtime.util.IndexRange; import org.apache.sysml.runtime.util.UtilFunctions; - -public class RangeBasedReIndexInstruction extends UnaryMRInstructionBase -{ +public class RangeBasedReIndexInstruction extends UnaryMRInstructionBase { private IndexRange _ixrange = null; - private boolean _forLeft = false; + private boolean _forLeft = false; private long _rlenLhs = -1; private long _clenLhs = -1; - - public RangeBasedReIndexInstruction(Operator op, byte in, byte out, IndexRange rng, boolean forleft, long rlen, long clen, String istr) { + + private RangeBasedReIndexInstruction(Operator op, byte in, byte out, IndexRange rng, boolean forleft, long rlen, + long clen, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.RangeReIndex; instString = istr; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java index 2bcca4a..c2a9ae4 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java @@ -26,22 +26,19 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class ReblockInstruction extends UnaryMRInstructionBase -{ - +public class ReblockInstruction extends UnaryMRInstructionBase { public int brlen; public int bclen; public boolean outputEmptyBlocks; - - public ReblockInstruction (Operator op, byte in, byte out, int br, int bc, boolean emptyBlocks, String istr) { + + protected ReblockInstruction(Operator op, byte in, byte out, int br, int bc, boolean emptyBlocks, String istr) { super(op, in, out); - brlen=br; - bclen=bc; + brlen = br; + bclen = bc; outputEmptyBlocks = emptyBlocks; instString = istr; } - + public static ReblockInstruction parseInstruction(String str) { Operator op = null; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java index 6642846..ab06a39 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java @@ -35,23 +35,18 @@ import org.apache.sysml.runtime.util.UtilFunctions; * Supported optcodes: rmempty. * */ -public class RemoveEmptyMRInstruction extends BinaryInstruction -{ - - - private long _len = -1; +public class RemoveEmptyMRInstruction extends BinaryInstruction { + private long _len = -1; private boolean _rmRows = true; - - - public RemoveEmptyMRInstruction(Operator op, byte in1, byte in2, long len, boolean rmRows, byte out, String istr) - { + + private RemoveEmptyMRInstruction(Operator op, byte in1, byte in2, long len, boolean rmRows, byte out, String istr) { super(op, in1, in2, out, istr); instString = istr; - + _len = len; _rmRows = rmRows; } - + public boolean isRemoveRows() { return _rmRows; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java index 6c6d50c..c9c5629 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java @@ -35,21 +35,18 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; - -public class ReorgInstruction extends UnaryMRInstructionBase -{ - - //required for diag (size-based type, load-balance-aware output of empty blocks) +public class ReorgInstruction extends UnaryMRInstructionBase { + // required for diag (size-based type, load-balance-aware output of empty + // blocks) private MatrixCharacteristics _mcIn = null; private boolean _outputEmptyBlocks = true; - - public ReorgInstruction(ReorgOperator op, byte in, byte out, String istr) - { + + private ReorgInstruction(ReorgOperator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.Reorg; instString = istr; } - + public void setInputMatrixCharacteristics( MatrixCharacteristics in ) { _mcIn = in; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java index 0a708a2..f34c6b6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java @@ -29,18 +29,15 @@ import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; -public class ReplicateInstruction extends UnaryMRInstructionBase -{ - +public class ReplicateInstruction extends UnaryMRInstructionBase { private boolean _repCols = true; - private long _lenM = -1; //clen/rlen - - public ReplicateInstruction(byte in, byte out, boolean repCols, long lenM, String istr) - { + private long _lenM = -1; // clen/rlen + + private ReplicateInstruction(byte in, byte out, boolean repCols, long lenM, String istr) { super(null, in, out); mrtype = MRINSTRUCTION_TYPE.Reorg; instString = istr; - + _repCols = repCols; _lenM = lenM; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java index f4abd22..4d31671 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java @@ -31,17 +31,14 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.ScalarOperator; +public class ScalarInstruction extends UnaryMRInstructionBase { -public class ScalarInstruction extends UnaryMRInstructionBase -{ - - public ScalarInstruction(ScalarOperator op, byte in, byte out, String istr) - { + private ScalarInstruction(ScalarOperator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.ArithmeticBinary; instString = istr; - - //value dependent safe-safeness (trigger re-evaluation sparse-safe) + + // value dependent safe-safeness (trigger re-evaluation sparse-safe) op.setConstant(op.getConstant()); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java index e650128..9b0a5f1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java @@ -27,16 +27,13 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class SeqInstruction extends DataGenMRInstruction -{ - +public class SeqInstruction extends DataGenMRInstruction { public double fromValue; public double toValue; public double incrValue; - - public SeqInstruction ( Operator op, byte in, byte out, long rows, long cols, int rpb, int cpb, double fromValue, double toValue, - double incrValue, String baseDir, String istr ) { + + private SeqInstruction(Operator op, byte in, byte out, long rows, long cols, int rpb, int cpb, double fromValue, + double toValue, double incrValue, String baseDir, String istr) { super(op, DataGenMethod.SEQ, in, out, rows, cols, rpb, cpb, baseDir); mrtype = MRINSTRUCTION_TYPE.Seq; this.fromValue = fromValue; @@ -44,7 +41,7 @@ public class SeqInstruction extends DataGenMRInstruction this.incrValue = incrValue; instString = istr; } - + public static SeqInstruction parseInstruction(String str) throws DMLRuntimeException { InstructionUtils.checkNumFields ( str, 10 ); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java index f0aeca7..31c541f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java @@ -32,12 +32,9 @@ import org.apache.sysml.runtime.matrix.data.OperationsOnMatrixValues; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; - -public class TernaryInstruction extends MRInstruction -{ - +public class TernaryInstruction extends MRInstruction { private OperationTypes _op; - + public byte input1; public byte input2; public byte input3; @@ -48,17 +45,25 @@ public class TernaryInstruction extends MRInstruction /** * Single matrix input * - * @param op operation type - * @param in1 input 1 (byte) - * @param scalar_in2 input 2 (double) - * @param scalar_in3 input 3 (double) - * @param out output - * @param outputDim1 output dimension 1 - * @param outputDim2 output dimension 2 - * @param istr instruction string + * @param op + * operation type + * @param in1 + * input 1 (byte) + * @param scalar_in2 + * input 2 (double) + * @param scalar_in3 + * input 3 (double) + * @param out + * output + * @param outputDim1 + * output dimension 1 + * @param outputDim2 + * output dimension 2 + * @param istr + * instruction string */ - public TernaryInstruction(OperationTypes op, byte in1, double scalar_in2, double scalar_in3, byte out, long outputDim1, long outputDim2, String istr) - { + private TernaryInstruction(OperationTypes op, byte in1, double scalar_in2, double scalar_in3, byte out, + long outputDim1, long outputDim2, String istr) { super(null, out); mrtype = MRINSTRUCTION_TYPE.Ternary; _op = op; @@ -69,21 +74,29 @@ public class TernaryInstruction extends MRInstruction _outputDim2 = outputDim2; instString = istr; } - + /** * Two matrix inputs * - * @param op operation type - * @param in1 input 1 (byte) - * @param in2 input 2 (byte) - * @param scalar_in3 input 3 (double) - * @param out output - * @param outputDim1 output dimension 1 - * @param outputDim2 output dimension 2 - * @param istr instruction string + * @param op + * operation type + * @param in1 + * input 1 (byte) + * @param in2 + * input 2 (byte) + * @param scalar_in3 + * input 3 (double) + * @param out + * output + * @param outputDim1 + * output dimension 1 + * @param outputDim2 + * output dimension 2 + * @param istr + * instruction string */ - public TernaryInstruction(OperationTypes op, byte in1, byte in2, double scalar_in3, byte out, long outputDim1, long outputDim2, String istr) - { + private TernaryInstruction(OperationTypes op, byte in1, byte in2, double scalar_in3, byte out, long outputDim1, + long outputDim2, String istr) { super(null, out); mrtype = MRINSTRUCTION_TYPE.Ternary; _op = op; @@ -94,21 +107,29 @@ public class TernaryInstruction extends MRInstruction _outputDim2 = outputDim2; instString = istr; } - + /** - * Two matrix input + * Two matrix input * - * @param op operation type - * @param in1 input 1 (byte) - * @param scalar_in2 input 2 (double) - * @param in3 input 3 (byte) - * @param out output - * @param outputDim1 output dimension 1 - * @param outputDim2 output dimension 2 - * @param istr instruction string + * @param op + * operation type + * @param in1 + * input 1 (byte) + * @param scalar_in2 + * input 2 (double) + * @param in3 + * input 3 (byte) + * @param out + * output + * @param outputDim1 + * output dimension 1 + * @param outputDim2 + * output dimension 2 + * @param istr + * instruction string */ - public TernaryInstruction(OperationTypes op, byte in1, double scalar_in2, byte in3, byte out, long outputDim1, long outputDim2, String istr) - { + private TernaryInstruction(OperationTypes op, byte in1, double scalar_in2, byte in3, byte out, long outputDim1, + long outputDim2, String istr) { super(null, out); mrtype = MRINSTRUCTION_TYPE.Ternary; _op = op; @@ -119,21 +140,29 @@ public class TernaryInstruction extends MRInstruction _outputDim2 = outputDim2; instString = istr; } - + /** * Three matrix inputs * - * @param op operation type - * @param in1 input 1 (byte) - * @param in2 input 2 (byte) - * @param in3 input 3 (byte) - * @param out output - * @param outputDim1 output dimension 1 - * @param outputDim2 output dimension 2 - * @param istr instruction string + * @param op + * operation type + * @param in1 + * input 1 (byte) + * @param in2 + * input 2 (byte) + * @param in3 + * input 3 (byte) + * @param out + * output + * @param outputDim1 + * output dimension 1 + * @param outputDim2 + * output dimension 2 + * @param istr + * instruction string */ - public TernaryInstruction(OperationTypes op, byte in1, byte in2, byte in3, byte out, long outputDim1, long outputDim2, String istr) - { + protected TernaryInstruction(OperationTypes op, byte in1, byte in2, byte in3, byte out, long outputDim1, + long outputDim2, String istr) { super(null, out); mrtype = MRINSTRUCTION_TYPE.Ternary; _op = op; @@ -144,7 +173,7 @@ public class TernaryInstruction extends MRInstruction _outputDim2 = outputDim2; instString = istr; } - + public long getOutputDim1() { return _outputDim1; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java index 128739e..c0c772c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java @@ -42,31 +42,30 @@ import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; -public class UaggOuterChainInstruction extends BinaryInstruction implements IDistributedCacheConsumer -{ - //operators +public class UaggOuterChainInstruction extends BinaryInstruction implements IDistributedCacheConsumer { + // operators private AggregateUnaryOperator _uaggOp = null; private AggregateOperator _aggOp = null; private BinaryOperator _bOp = null; - - //reused intermediates + + // reused intermediates private MatrixValue _tmpVal1 = null; private MatrixValue _tmpVal2 = null; - + private double[] _bv = null; private int[] _bvi = null; - public UaggOuterChainInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, byte in1, byte in2, byte out, String istr) - { + private UaggOuterChainInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, + byte in1, byte in2, byte out, String istr) { super(null, in1, in2, out, istr); - + _uaggOp = uaggop; _aggOp = aggop; _bOp = bop; - + _tmpVal1 = new MatrixBlock(); _tmpVal2 = new MatrixBlock(); - + mrtype = MRINSTRUCTION_TYPE.UaggOuterChain; instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java index 3626f5f..1b42eeb 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java @@ -31,17 +31,14 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; +public class UnaryInstruction extends UnaryMRInstructionBase { -public class UnaryInstruction extends UnaryMRInstructionBase -{ - - public UnaryInstruction(Operator op, byte in, byte out, String istr) - { + public UnaryInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.Unary; instString = istr; } - + public static UnaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { String opcode = InstructionUtils.getOpCode(str); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryMRInstructionBase.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryMRInstructionBase.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryMRInstructionBase.java index 6b4b773..8adf5ca 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryMRInstructionBase.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryMRInstructionBase.java @@ -21,17 +21,14 @@ package org.apache.sysml.runtime.instructions.mr; import org.apache.sysml.runtime.matrix.operators.Operator; -public abstract class UnaryMRInstructionBase extends MRInstruction -{ - +public abstract class UnaryMRInstructionBase extends MRInstruction { public byte input; - - public UnaryMRInstructionBase(Operator op, byte in, byte out) - { + + protected UnaryMRInstructionBase(Operator op, byte in, byte out) { super(op, out); - input=in; + input = in; } - + @Override public byte[] getInputIndexes() { return new byte[]{input}; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java index 3282ac9..047fa28 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java @@ -36,20 +36,18 @@ import org.apache.sysml.runtime.util.UtilFunctions; * ZeroOut with complementary=false is to zero out a subregion inside a matrix * ZeroOut with complementary=true is to select a subregion inside a matrix (zero out regions outside the selected range) */ -public class ZeroOutInstruction extends UnaryMRInstructionBase -{ - - public IndexRange indexRange=null; - private IndexRange tempRange=new IndexRange(-1, -1, -1, -1); - public boolean complementary=false; - - public ZeroOutInstruction(Operator op, byte in, byte out, IndexRange rng, String istr) { +public class ZeroOutInstruction extends UnaryMRInstructionBase { + public IndexRange indexRange = null; + private IndexRange tempRange = new IndexRange(-1, -1, -1, -1); + public boolean complementary = false; + + private ZeroOutInstruction(Operator op, byte in, byte out, IndexRange rng, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.ZeroOut; instString = istr; - indexRange=rng; + indexRange = rng; } - + public static ZeroOutInstruction parseInstruction ( String str ) throws DMLRuntimeException { InstructionUtils.checkNumFields ( str, 6 ); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java index 5822ff5..eb97266 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java @@ -39,11 +39,10 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.AggregateTernaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; -public class AggregateTernarySPInstruction extends ComputationSPInstruction -{ - public AggregateTernarySPInstruction(Operator op, CPOperand in1, CPOperand in2, - CPOperand in3, CPOperand out, String opcode, String istr ) - { +public class AggregateTernarySPInstruction extends ComputationSPInstruction { + + private AggregateTernarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + String opcode, String istr) { super(op, in1, in2, in3, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.AggregateTernary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java index 36f501b..2bbc077 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java @@ -43,13 +43,12 @@ import org.apache.sysml.runtime.matrix.data.OperationsOnMatrixValues; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; -public class AggregateUnarySPInstruction extends UnarySPInstruction -{ - +public class AggregateUnarySPInstruction extends UnarySPInstruction { private SparkAggType _aggtype = null; private AggregateOperator _aop = null; - - public AggregateUnarySPInstruction(AggregateUnaryOperator auop, AggregateOperator aop, CPOperand in, CPOperand out, SparkAggType aggtype, String opcode, String istr){ + + protected AggregateUnarySPInstruction(AggregateUnaryOperator auop, AggregateOperator aop, CPOperand in, + CPOperand out, SparkAggType aggtype, String opcode, String istr) { super(auop, in, out, opcode, istr); _aggtype = aggtype; _aop = aop; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java index b051a32..bc41c40 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java @@ -36,17 +36,16 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; -public class AppendGAlignedSPInstruction extends BinarySPInstruction -{ +public class AppendGAlignedSPInstruction extends BinarySPInstruction { private boolean _cbind = true; - - public AppendGAlignedSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, boolean cbind, String opcode, String istr) - { + + private AppendGAlignedSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + boolean cbind, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.GAppend; _cbind = cbind; } - + public static AppendGAlignedSPInstruction 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/AppendGSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java index 092af3b..831e707 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java @@ -42,17 +42,16 @@ 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 AppendGSPInstruction extends BinarySPInstruction -{ +public class AppendGSPInstruction extends BinarySPInstruction { private boolean _cbind = true; - - public AppendGSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand offset2, CPOperand out, boolean cbind, String opcode, String istr) - { + + private AppendGSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand offset2, + CPOperand out, boolean cbind, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.GAppend; _cbind = cbind; } - + public static AppendGSPInstruction 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/AppendMSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendMSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendMSPInstruction.java index ab70af2..d176ec3 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendMSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendMSPInstruction.java @@ -27,15 +27,14 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; -public abstract class AppendMSPInstruction extends BinarySPInstruction -{ +public abstract class AppendMSPInstruction extends BinarySPInstruction { protected CPOperand _offset = null; protected boolean _cbind = true; - - public AppendMSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand out, boolean cbind, String opcode, String istr) - { + + protected AppendMSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand out, + boolean cbind, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.MAppend; + _sptype = SPINSTRUCTION_TYPE.MAppend; _offset = offset; _cbind = cbind; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendRSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendRSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendRSPInstruction.java index b56b7d7..79e54f3 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendRSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendRSPInstruction.java @@ -26,13 +26,11 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; - -public abstract class AppendRSPInstruction extends BinarySPInstruction -{ +public abstract class AppendRSPInstruction extends BinarySPInstruction { protected boolean _cbind = true; - - public AppendRSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean cbind, String opcode, String istr) - { + + AppendRSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean cbind, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.RAppend; _cbind = cbind; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ArithmeticBinarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ArithmeticBinarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ArithmeticBinarySPInstruction.java index fc00bb5..ad309e6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ArithmeticBinarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ArithmeticBinarySPInstruction.java @@ -28,11 +28,10 @@ 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 ArithmeticBinarySPInstruction extends BinarySPInstruction -{ - - public ArithmeticBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) - { +public abstract class ArithmeticBinarySPInstruction extends BinarySPInstruction { + + ArithmeticBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.ArithmeticBinary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/BinUaggChainSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/BinUaggChainSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/BinUaggChainSPInstruction.java index a1b7d35..77da0db 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/BinUaggChainSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/BinUaggChainSPInstruction.java @@ -32,19 +32,15 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; - -public class BinUaggChainSPInstruction extends UnarySPInstruction -{ - - //operators +public class BinUaggChainSPInstruction extends UnarySPInstruction { + // operators private BinaryOperator _bOp = null; private AggregateUnaryOperator _uaggOp = null; - - public BinUaggChainSPInstruction(CPOperand in, CPOperand out, BinaryOperator bop, AggregateUnaryOperator uaggop, String opcode, String istr ) - { + + private BinUaggChainSPInstruction(CPOperand in, CPOperand out, BinaryOperator bop, AggregateUnaryOperator uaggop, + String opcode, String istr) { super(null, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.BinUaggChain; - _bOp = bop; _uaggOp = uaggop; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/BinarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/BinarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/BinarySPInstruction.java index ef9da23..2bd622a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/BinarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/BinarySPInstruction.java @@ -42,10 +42,10 @@ import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ScalarOperator; -public abstract class BinarySPInstruction extends ComputationSPInstruction -{ - - public BinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ){ +public abstract class BinarySPInstruction extends ComputationSPInstruction { + + protected BinarySPInstruction(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/BuiltinBinarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinBinarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinBinarySPInstruction.java index a5efea5..0bd28a1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinBinarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinBinarySPInstruction.java @@ -32,11 +32,10 @@ import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.RightScalarOperator; -public abstract class BuiltinBinarySPInstruction extends BinarySPInstruction -{ - - public BuiltinBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) - { +public abstract class BuiltinBinarySPInstruction extends BinarySPInstruction { + + protected BuiltinBinarySPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.BuiltinBinary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinUnarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinUnarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinUnarySPInstruction.java index aeddf96..8008404 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinUnarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/BuiltinUnarySPInstruction.java @@ -28,12 +28,9 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; +public abstract class BuiltinUnarySPInstruction extends UnarySPInstruction { -public abstract class BuiltinUnarySPInstruction extends UnarySPInstruction -{ - - public BuiltinUnarySPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr ) - { + protected BuiltinUnarySPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { super(op, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.BuiltinUnary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CSVReblockSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CSVReblockSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CSVReblockSPInstruction.java index 22fcddb..43dd327 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CSVReblockSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CSVReblockSPInstruction.java @@ -42,8 +42,7 @@ 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 CSVReblockSPInstruction extends UnarySPInstruction -{ +public class CSVReblockSPInstruction extends UnarySPInstruction { private int _brlen; private int _bclen; private boolean _hasHeader; @@ -51,10 +50,8 @@ public class CSVReblockSPInstruction extends UnarySPInstruction private boolean _fill; private double _fillValue; - public CSVReblockSPInstruction(Operator op, CPOperand in, CPOperand out, - int br, int bc, boolean hasHeader, String delim, boolean fill, - double fillValue, String opcode, String instr) - { + protected CSVReblockSPInstruction(Operator op, CPOperand in, CPOperand out, int br, int bc, boolean hasHeader, + String delim, boolean fill, double fillValue, String opcode, String instr) { super(op, in, out, opcode, instr); _brlen = br; _bclen = bc; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CastSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CastSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CastSPInstruction.java index 4fdd617..38ecc63 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CastSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CastSPInstruction.java @@ -37,14 +37,13 @@ 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 CastSPInstruction extends UnarySPInstruction { -public class CastSPInstruction extends UnarySPInstruction -{ - public CastSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { + private CastSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { super(op, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.Cast; } - + public static CastSPInstruction 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/CentralMomentSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CentralMomentSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CentralMomentSPInstruction.java index 4aa8ccc..82edf32 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CentralMomentSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CentralMomentSPInstruction.java @@ -41,12 +41,10 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.CMOperator; import org.apache.sysml.runtime.matrix.operators.CMOperator.AggregateOperationTypes; -public class CentralMomentSPInstruction extends UnarySPInstruction -{ - - public CentralMomentSPInstruction(CMOperator op, CPOperand in1, CPOperand in2, - CPOperand in3, CPOperand out, String opcode, String str) - { +public class CentralMomentSPInstruction extends UnarySPInstruction { + + private CentralMomentSPInstruction(CMOperator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + String opcode, String str) { super(op, in1, in2, in3, out, opcode, str); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CheckpointSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CheckpointSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CheckpointSPInstruction.java index e7c1c78..484cdaa 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CheckpointSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CheckpointSPInstruction.java @@ -43,19 +43,17 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.data.SparseBlock; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class CheckpointSPInstruction extends UnarySPInstruction -{ - //default storage level +public class CheckpointSPInstruction extends UnarySPInstruction { + // default storage level private StorageLevel _level = null; - - public CheckpointSPInstruction(Operator op, CPOperand in, CPOperand out, StorageLevel level, String opcode, String istr) { + + private CheckpointSPInstruction(Operator op, CPOperand in, CPOperand out, StorageLevel level, String opcode, + String istr) { super(op, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.Checkpoint; - _level = level; } - + public static CheckpointSPInstruction 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/CompressionSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CompressionSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CompressionSPInstruction.java index 02b4b4e..ac93266 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CompressionSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CompressionSPInstruction.java @@ -31,10 +31,9 @@ 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 CompressionSPInstruction extends UnarySPInstruction { -public class CompressionSPInstruction extends UnarySPInstruction -{ - public CompressionSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr){ + private CompressionSPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { super(op, in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.Reorg; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ComputationSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ComputationSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ComputationSPInstruction.java index 3d26b4c..d2d7416 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ComputationSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ComputationSPInstruction.java @@ -30,12 +30,11 @@ import org.apache.sysml.runtime.matrix.MatrixCharacteristics; import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class ComputationSPInstruction extends SPInstruction { - - public CPOperand output; public CPOperand input1, input2, input3; - - public ComputationSPInstruction ( Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) { + + protected ComputationSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, opcode, istr); input1 = in1; input2 = in2; @@ -43,7 +42,8 @@ public abstract class ComputationSPInstruction extends SPInstruction { output = out; } - public ComputationSPInstruction ( Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, String istr ) { + protected ComputationSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + String opcode, String istr) { super(op, opcode, istr); input1 = in1; input2 = in2; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java index c3101c2..5206f9f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java @@ -53,18 +53,16 @@ import scala.Tuple2; public class ConvolutionSPInstruction extends UnarySPInstruction { private CPOperand _in2; - private CPOperand _in3; + private CPOperand _in3; private ArrayList<CPOperand> _input_shape; private ArrayList<CPOperand> _filter_shape; private ArrayList<CPOperand> _stride = new ArrayList<CPOperand>(); private ArrayList<CPOperand> _padding = new ArrayList<CPOperand>(); - public ConvolutionSPInstruction(CPOperand in, CPOperand out, String opcode, - String istr, ArrayList<CPOperand> stride, - ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, + private ConvolutionSPInstruction(CPOperand in, CPOperand out, String opcode, String istr, + ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, ArrayList<CPOperand> filter_shape) { - super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, - opcode, istr); + super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.Convolution; _stride = stride; _padding = padding; @@ -72,12 +70,10 @@ public class ConvolutionSPInstruction extends UnarySPInstruction { _filter_shape = filter_shape; } - public ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand out, - String opcode, String istr, ArrayList<CPOperand> stride, - ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, + private ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand out, String opcode, String istr, + ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, ArrayList<CPOperand> filter_shape) { - super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, - opcode, istr); + super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, opcode, istr); _in2 = in2; _sptype = SPINSTRUCTION_TYPE.Convolution; _stride = stride; @@ -86,12 +82,10 @@ public class ConvolutionSPInstruction extends UnarySPInstruction { _filter_shape = filter_shape; } - public ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand in3, - CPOperand out, String opcode, String istr, - ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, - ArrayList<CPOperand> input_shape, ArrayList<CPOperand> filter_shape) { - super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, - opcode, istr); + private ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand in3, CPOperand out, String opcode, + String istr, ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, + ArrayList<CPOperand> filter_shape) { + super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, opcode, istr); _in2 = in2; _in3 = in3; _sptype = SPINSTRUCTION_TYPE.Convolution; @@ -101,10 +95,8 @@ public class ConvolutionSPInstruction extends UnarySPInstruction { _filter_shape = filter_shape; } - public ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand out, - String opcode, String istr) { - super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, - opcode, istr); + private ConvolutionSPInstruction(CPOperand in, CPOperand in2, CPOperand out, String opcode, String istr) { + super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, opcode, istr); _in2 = in2; _sptype = SPINSTRUCTION_TYPE.Convolution; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CovarianceSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CovarianceSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CovarianceSPInstruction.java index 7c4b7c4..07cf40d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CovarianceSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CovarianceSPInstruction.java @@ -39,18 +39,15 @@ import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.operators.COVOperator; -public class CovarianceSPInstruction extends BinarySPInstruction -{ - - public CovarianceSPInstruction(COVOperator op, CPOperand in, CPOperand in2, CPOperand out, - String opcode, String istr) - { +public class CovarianceSPInstruction extends BinarySPInstruction { + + private CovarianceSPInstruction(COVOperator op, CPOperand in, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, in, in2, out, opcode, istr); } - - public CovarianceSPInstruction(COVOperator op, CPOperand in, CPOperand in2, CPOperand in3, CPOperand out, - String opcode, String istr) - { + + private CovarianceSPInstruction(COVOperator op, CPOperand in, CPOperand in2, CPOperand in3, CPOperand out, + String opcode, String istr) { super(op, in, in2, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java index 4b46a96..e3cf9b6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java @@ -49,13 +49,11 @@ import org.apache.sysml.runtime.matrix.operators.Operator; * this would result in a degree of parallelism of 1. * */ -public class CpmmSPInstruction extends BinarySPInstruction -{ - +public class CpmmSPInstruction extends BinarySPInstruction { private SparkAggType _aggtype; - - public CpmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, SparkAggType aggtype, String opcode, String istr ) - { + + private CpmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, SparkAggType aggtype, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.CPMM; _aggtype = aggtype; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeAggregateSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeAggregateSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeAggregateSPInstruction.java index 0301d54..6d30254 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeAggregateSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeAggregateSPInstruction.java @@ -37,13 +37,12 @@ import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.data.OperationsOnMatrixValues; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; -public class CumulativeAggregateSPInstruction extends AggregateUnarySPInstruction -{ - - public CumulativeAggregateSPInstruction(AggregateUnaryOperator op, CPOperand in1, CPOperand out, String opcode, String istr ) - { +public class CumulativeAggregateSPInstruction extends AggregateUnarySPInstruction { + + private CumulativeAggregateSPInstruction(AggregateUnaryOperator op, CPOperand in1, CPOperand out, String opcode, + String istr) { super(op, null, in1, out, null, opcode, istr); - _sptype = SPINSTRUCTION_TYPE.CumsumAggregate; + _sptype = SPINSTRUCTION_TYPE.CumsumAggregate; } public static CumulativeAggregateSPInstruction parseInstruction( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeOffsetSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeOffsetSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeOffsetSPInstruction.java index ab0c3ed..65f5251 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeOffsetSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CumulativeOffsetSPInstruction.java @@ -43,36 +43,30 @@ import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; - -public class CumulativeOffsetSPInstruction extends BinarySPInstruction -{ - +public class CumulativeOffsetSPInstruction extends BinarySPInstruction { private BinaryOperator _bop = null; private UnaryOperator _uop = null; private double _initValue = 0; - - public CumulativeOffsetSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, double init, String opcode, String istr) - { + + private CumulativeOffsetSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, double init, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); _sptype = SPINSTRUCTION_TYPE.CumsumOffset; - - if( "bcumoffk+".equals(opcode) ) { + + if ("bcumoffk+".equals(opcode)) { _bop = new BinaryOperator(Plus.getPlusFnObject()); _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucumk+")); - } - else if( "bcumoff*".equals(opcode) ){ + } else if ("bcumoff*".equals(opcode)) { _bop = new BinaryOperator(Multiply.getMultiplyFnObject()); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucum*")); - } - else if( "bcumoffmin".equals(opcode) ){ + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucum*")); + } else if ("bcumoffmin".equals(opcode)) { _bop = new BinaryOperator(Builtin.getBuiltinFnObject("min")); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummin")); - } - else if( "bcumoffmax".equals(opcode) ){ + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummin")); + } else if ("bcumoffmax".equals(opcode)) { _bop = new BinaryOperator(Builtin.getBuiltinFnObject("max")); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummax")); + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummax")); } - + _initValue = init; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendMSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendMSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendMSPInstruction.java index 218a241..33f3e1b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendMSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendMSPInstruction.java @@ -36,13 +36,13 @@ import org.apache.sysml.runtime.instructions.spark.data.PartitionedBroadcast; import org.apache.sysml.runtime.matrix.data.FrameBlock; import org.apache.sysml.runtime.matrix.operators.Operator; -public class FrameAppendMSPInstruction extends AppendMSPInstruction -{ - public FrameAppendMSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand offset, CPOperand out, boolean cbind, String opcode, String istr) - { +public class FrameAppendMSPInstruction extends AppendMSPInstruction { + + protected FrameAppendMSPInstruction(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/FrameAppendRSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendRSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendRSPInstruction.java index 77a98b1..6819367 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendRSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameAppendRSPInstruction.java @@ -34,13 +34,13 @@ import org.apache.sysml.runtime.instructions.spark.utils.FrameRDDAggregateUtils; import org.apache.sysml.runtime.matrix.data.FrameBlock; import org.apache.sysml.runtime.matrix.operators.Operator; -public class FrameAppendRSPInstruction extends AppendRSPInstruction -{ - public FrameAppendRSPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, boolean cbind, String opcode, String istr) - { +public class FrameAppendRSPInstruction extends AppendRSPInstruction { + + protected FrameAppendRSPInstruction(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/FrameIndexingSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameIndexingSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameIndexingSPInstruction.java index e19b617..71178c3 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameIndexingSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/FrameIndexingSPInstruction.java @@ -47,35 +47,31 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.util.IndexRange; import org.apache.sysml.runtime.util.UtilFunctions; -public class FrameIndexingSPInstruction extends IndexingSPInstruction -{ - - /* - * This class implements the frame indexing functionality inside Spark. - * Example instructions: - * rangeReIndex:mVar1:Var2:Var3:Var4:Var5:mVar6 - * input=mVar1, output=mVar6, - * bounds = (Var2,Var3,Var4,Var5) - * rowindex_lower: Var2, rowindex_upper: Var3 - * colindex_lower: Var4, colindex_upper: Var5 - * leftIndex:mVar1:mVar2:Var3:Var4:Var5:Var6:mVar7 - * triggered by "mVar1[Var3:Var4, Var5:Var6] = mVar2" - * the result is stored in mVar7 - * - */ - public FrameIndexingSPInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, SparkAggType aggtype, String opcode, String istr) - { +/** + * This class implements the frame indexing functionality inside Spark. + * Example instructions: + * rangeReIndex:mVar1:Var2:Var3:Var4:Var5:mVar6 + * input=mVar1, output=mVar6, + * bounds = (Var2,Var3,Var4,Var5) + * rowindex_lower: Var2, rowindex_upper: Var3 + * colindex_lower: Var4, colindex_upper: Var5 + * leftIndex:mVar1:mVar2:Var3:Var4:Var5:Var6:mVar7 + * triggered by "mVar1[Var3:Var4, Var5:Var6] = mVar2" + * the result is stored in mVar7 + * + */ +public class FrameIndexingSPInstruction extends IndexingSPInstruction { + + protected FrameIndexingSPInstruction(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); } - - public FrameIndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, String opcode, String istr) - { + + protected FrameIndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, + CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, String opcode, String istr) { super(op, lhsInput, rhsInput, rl, ru, cl, cu, 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/IndexingSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/IndexingSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/IndexingSPInstruction.java index 8d20a05..0932cdd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/IndexingSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/IndexingSPInstruction.java @@ -28,28 +28,25 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.SimpleOperator; -public abstract class IndexingSPInstruction extends UnarySPInstruction -{ - - /* - * This class implements the matrix indexing functionality inside Spark. - * Example instructions: - * rangeReIndex:mVar1:Var2:Var3:Var4:Var5:mVar6 - * input=mVar1, output=mVar6, - * bounds = (Var2,Var3,Var4,Var5) - * rowindex_lower: Var2, rowindex_upper: Var3 - * colindex_lower: Var4, colindex_upper: Var5 - * leftIndex:mVar1:mVar2:Var3:Var4:Var5:Var6:mVar7 - * triggered by "mVar1[Var3:Var4, Var5:Var6] = mVar2" - * the result is stored in mVar7 - * - */ +/** + * This class implements the matrix indexing functionality inside Spark. + * Example instructions: + * rangeReIndex:mVar1:Var2:Var3:Var4:Var5:mVar6 + * input=mVar1, output=mVar6, + * bounds = (Var2,Var3,Var4,Var5) + * rowindex_lower: Var2, rowindex_upper: Var3 + * colindex_lower: Var4, colindex_upper: Var5 + * leftIndex:mVar1:mVar2:Var3:Var4:Var5:Var6:mVar7 + * triggered by "mVar1[Var3:Var4, Var5:Var6] = mVar2" + * the result is stored in mVar7 + * + */ +public abstract class IndexingSPInstruction extends UnarySPInstruction { protected CPOperand rowLower, rowUpper, colLower, colUpper; protected SparkAggType _aggType = null; - - public IndexingSPInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, SparkAggType aggtype, String opcode, String istr) - { + + IndexingSPInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, + CPOperand out, SparkAggType aggtype, String opcode, String istr) { super(op, in, out, opcode, istr); rowLower = rl; rowUpper = ru; @@ -58,17 +55,16 @@ public abstract class IndexingSPInstruction extends UnarySPInstruction _aggType = aggtype; } - - public IndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, - CPOperand out, String opcode, String istr) - { + + IndexingSPInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, CPOperand ru, CPOperand cl, + CPOperand cu, CPOperand out, String opcode, String istr) { super(op, lhsInput, rhsInput, out, opcode, istr); rowLower = rl; rowUpper = ru; colLower = cl; colUpper = cu; } - + public static IndexingSPInstruction parseInstruction ( String str ) throws DMLRuntimeException {
