Repository: systemml Updated Branches: refs/heads/master 47e50af3f -> c382386a0
[SYSTEMML-1883] New xor builtin functions over scalars Closes #708. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/c382386a Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/c382386a Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/c382386a Branch: refs/heads/master Commit: c382386a0f8aa17cc8107ee0d0f51306c2710cd9 Parents: 47e50af Author: Janardhan Pulivarthi <[email protected]> Authored: Sun Dec 17 11:36:53 2017 -0800 Committer: Matthias Boehm <[email protected]> Committed: Sun Dec 17 11:43:08 2017 -0800 ---------------------------------------------------------------------- src/main/java/org/apache/sysml/hops/Hop.java | 6 +- src/main/java/org/apache/sysml/lops/Binary.java | 12 ++- .../org/apache/sysml/lops/BinaryScalar.java | 6 +- .../sysml/parser/BuiltinFunctionExpression.java | 4 +- .../org/apache/sysml/parser/DMLTranslator.java | 10 ++- .../org/apache/sysml/parser/Expression.java | 3 +- .../sysml/runtime/functionobjects/Builtin.java | 21 ++--- .../sysml/runtime/functionobjects/Xor.java | 44 ++++++++++ .../instructions/CPInstructionParser.java | 1 + .../runtime/instructions/InstructionUtils.java | 3 + .../matrix/operators/BinaryOperator.java | 6 +- .../functions/binary/scalar/XorTest.java | 89 ++++++++++++++++++++ .../scripts/functions/binary/scalar/XorTest.dml | 23 +++++ .../functions/binary/scalar/ZPackageSuite.java | 3 +- 14 files changed, 206 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/hops/Hop.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/Hop.java b/src/main/java/org/apache/sysml/hops/Hop.java index 350c64a..5ce3f4a 100644 --- a/src/main/java/org/apache/sysml/hops/Hop.java +++ b/src/main/java/org/apache/sysml/hops/Hop.java @@ -1077,7 +1077,7 @@ public abstract class Hop implements ParseInfo // Operations that require two operands public enum OpOp2 { PLUS, MINUS, MULT, DIV, MODULUS, INTDIV, LESS, LESSEQUAL, GREATER, GREATEREQUAL, EQUAL, NOTEQUAL, - MIN, MAX, AND, OR, LOG, POW, PRINT, CONCAT, QUANTILE, INTERQUANTILE, IQM, + MIN, MAX, AND, OR, XOR, LOG, POW, PRINT, CONCAT, QUANTILE, INTERQUANTILE, IQM, CENTRALMOMENT, COVARIANCE, CBIND, RBIND, SOLVE, MEDIAN, INVALID, //fused ML-specific operators for performance MINUS_NZ, //sparse-safe minus: X-(mean*ppred(X,0,!=)) @@ -1219,6 +1219,7 @@ public abstract class Hop implements ParseInfo HopsOpOp2LopsB.put(OpOp2.MIN, Binary.OperationTypes.MIN); HopsOpOp2LopsB.put(OpOp2.MAX, Binary.OperationTypes.MAX); HopsOpOp2LopsB.put(OpOp2.AND, Binary.OperationTypes.OR); + HopsOpOp2LopsB.put(OpOp2.XOR, Binary.OperationTypes.XOR); HopsOpOp2LopsB.put(OpOp2.OR, Binary.OperationTypes.AND); HopsOpOp2LopsB.put(OpOp2.SOLVE, Binary.OperationTypes.SOLVE); HopsOpOp2LopsB.put(OpOp2.POW, Binary.OperationTypes.POW); @@ -1244,6 +1245,7 @@ public abstract class Hop implements ParseInfo HopsOpOp2LopsBS.put(OpOp2.MAX, BinaryScalar.OperationTypes.MAX); HopsOpOp2LopsBS.put(OpOp2.AND, BinaryScalar.OperationTypes.AND); HopsOpOp2LopsBS.put(OpOp2.OR, BinaryScalar.OperationTypes.OR); + HopsOpOp2LopsBS.put(OpOp2.XOR, BinaryScalar.OperationTypes.XOR); HopsOpOp2LopsBS.put(OpOp2.LOG, BinaryScalar.OperationTypes.LOG); HopsOpOp2LopsBS.put(OpOp2.POW, BinaryScalar.OperationTypes.POW); HopsOpOp2LopsBS.put(OpOp2.PRINT, BinaryScalar.OperationTypes.PRINT); @@ -1442,6 +1444,7 @@ public abstract class Hop implements ParseInfo HopsOpOp2String.put(OpOp2.CBIND, "cbind"); HopsOpOp2String.put(OpOp2.RBIND, "rbind"); HopsOpOp2String.put(OpOp2.SOLVE, "solve"); + HopsOpOp2String.put(OpOp2.XOR, "xor"); } public static String getBinaryOpCode(OpOp2 op) { @@ -1528,6 +1531,7 @@ public abstract class Hop implements ParseInfo else if( "==".equals(op) ) return OpOp2.EQUAL; else if( "!=".equals(op) ) return OpOp2.NOTEQUAL; else if( "|".equals(op) ) return OpOp2.OR; + else if( "xor".equals(op) ) return OpOp2.XOR; else if( "&".equals(op) ) return OpOp2.AND; else if( "log".equals(op) ) return OpOp2.LOG; else if( "^".equals(op) ) return OpOp2.POW; http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/lops/Binary.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/Binary.java b/src/main/java/org/apache/sysml/lops/Binary.java index 711fd9c..8cf6e4b 100644 --- a/src/main/java/org/apache/sysml/lops/Binary.java +++ b/src/main/java/org/apache/sysml/lops/Binary.java @@ -35,7 +35,7 @@ public class Binary extends Lop public enum OperationTypes { ADD, SUBTRACT, MULTIPLY, DIVIDE, MINUS1_MULTIPLY, MODULUS, INTDIV, MATMULT, LESS_THAN, LESS_THAN_OR_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUALS, EQUALS, NOT_EQUALS, - AND, OR, + AND, OR, XOR, MAX, MIN, POW, SOLVE, NOTSUPPORTED } @@ -151,13 +151,17 @@ public class Binary extends Lop case NOT_EQUALS: return "!="; - /* Boolean */ + /* Boolean */ case AND: return "&&"; case OR: return "||"; - - + + /* Binary Builtin Function */ + case XOR: + return "xor"; + + /* Builtin Functions */ case MIN: return "min"; http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/lops/BinaryScalar.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/BinaryScalar.java b/src/main/java/org/apache/sysml/lops/BinaryScalar.java index a2c10a9..6b7903b 100644 --- a/src/main/java/org/apache/sysml/lops/BinaryScalar.java +++ b/src/main/java/org/apache/sysml/lops/BinaryScalar.java @@ -35,7 +35,7 @@ public class BinaryScalar extends Lop public enum OperationTypes { ADD, SUBTRACT, MULTIPLY, DIVIDE, MODULUS, INTDIV, LESS_THAN, LESS_THAN_OR_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUALS, EQUALS, NOT_EQUALS, - AND, OR, + AND, OR, XOR, LOG,POW,MAX,MIN,PRINT, IQSIZE, } @@ -145,6 +145,10 @@ public class BinaryScalar extends Lop return "&&"; case OR: return "||"; + + /* Boolean built in binary function */ + case XOR: + return "xor"; /* Builtin Functions */ case LOG: http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java index ab6fb54..cc14bfe 100644 --- a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java +++ b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java @@ -445,7 +445,8 @@ public class BuiltinFunctionExpression extends DataIdentifier output.setBlockDimensions (0, 0); output.setValueType(id.getValueType()); break; - + + case XOR: case MIN: case MAX: //min(X), min(X,s), min(s,X), min(s,r), min(X,Y) @@ -1342,6 +1343,7 @@ public class BuiltinFunctionExpression extends DataIdentifier case CEIL: case FLOOR: case MEDIAN: + case XOR: return true; default: return false; http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/parser/DMLTranslator.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DMLTranslator.java b/src/main/java/org/apache/sysml/parser/DMLTranslator.java index 71633c4..791db1c 100644 --- a/src/main/java/org/apache/sysml/parser/DMLTranslator.java +++ b/src/main/java/org/apache/sysml/parser/DMLTranslator.java @@ -683,7 +683,7 @@ public class DMLTranslator l.addToDag(dag); } - // Instructions for Lobs DAGs + // Instructions for Lops DAGs instruct = dag.getJobs(sb, config); rtpb.addInstructions(instruct); } @@ -2661,6 +2661,12 @@ public class DMLTranslator case CAST_AS_BOOLEAN: currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), ValueType.BOOLEAN, Hop.OpOp1.CAST_AS_BOOLEAN, expr); break; + + case XOR: + currBuiltinOp = new BinaryOp(target.getName(), target.getDataType(), + ValueType.BOOLEAN, Hop.OpOp2.XOR, expr, expr2); + break; + case ABS: case SIN: case COS: @@ -2671,7 +2677,7 @@ public class DMLTranslator case SINH: case COSH: case TANH: - case SIGN: + case SIGN: case SQRT: case EXP: case ROUND: http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/parser/Expression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/Expression.java b/src/main/java/org/apache/sysml/parser/Expression.java index fa68870..ddefd88 100644 --- a/src/main/java/org/apache/sysml/parser/Expression.java +++ b/src/main/java/org/apache/sysml/parser/Expression.java @@ -135,7 +135,8 @@ public abstract class Expression implements ParseInfo TANH, TRACE, TRANS, - VAR + VAR, + XOR } /** http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java b/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java index 20c1ab7..4310781 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java @@ -49,7 +49,9 @@ public class Builtin extends ValueFunction private static final long serialVersionUID = 3836744687789840574L; - public enum BuiltinCode { SIN, COS, TAN, SINH, COSH, TANH, ASIN, ACOS, ATAN, LOG, LOG_NZ, MIN, MAX, ABS, SIGN, SQRT, EXP, PLOGP, PRINT, PRINTF, NROW, NCOL, LENGTH, ROUND, MAXINDEX, MININDEX, STOP, CEIL, FLOOR, CUMSUM, CUMPROD, CUMMIN, CUMMAX, INVERSE, SPROP, SIGMOID, SELP } + public enum BuiltinCode { SIN, COS, TAN, SINH, COSH, TANH, ASIN, ACOS, ATAN, LOG, LOG_NZ, MIN, + MAX, ABS, SIGN, SQRT, EXP, PLOGP, PRINT, PRINTF, NROW, NCOL, LENGTH, ROUND, MAXINDEX, MININDEX, + STOP, CEIL, FLOOR, CUMSUM, CUMPROD, CUMMIN, CUMMAX, INVERSE, SPROP, SIGMOID, SELP } public BuiltinCode bFunc; private static final boolean FASTMATH = true; @@ -279,7 +281,7 @@ public class Builtin extends ValueFunction if ( selpObj == null ) selpObj = new Builtin(BuiltinCode.SELP); return selpObj; - + default: // Unknown code --> return null return null; @@ -398,9 +400,7 @@ public class Builtin extends ValueFunction return (Math.log(in1)/Math.log(in2)); case LOG_NZ: //faster in Math - return (in1==0) ? 0 : (Math.log(in1)/Math.log(in2)); - - + return (in1==0) ? 0 : (Math.log(in1)/Math.log(in2)); default: throw new DMLRuntimeException("Builtin.execute(): Unknown operation: " + bFunc); } @@ -415,7 +415,7 @@ public class Builtin extends ValueFunction */ public double execute2(double in1, double in2) { - switch(bFunc) { + switch(bFunc) { case MAX: case CUMMAX: //return (Double.compare(in1, in2) >= 0 ? in1 : in2); @@ -425,10 +425,9 @@ public class Builtin extends ValueFunction //return (Double.compare(in1, in2) <= 0 ? in1 : in2); return (in1 <= in2 ? in1 : in2); case MAXINDEX: - return (in1 >= in2) ? 1 : 0; + return (in1 >= in2) ? 1 : 0; case MININDEX: - return (in1 <= in2) ? 1 : 0; - + return (in1 <= in2) ? 1 : 0; default: // For performance reasons, avoid throwing an exception return -1; @@ -454,9 +453,7 @@ public class Builtin extends ValueFunction case LOG_NZ: //faster in Math return (in1==0) ? 0 : Math.log(in1)/Math.log(in2); - - - + default: throw new DMLRuntimeException("Builtin.execute(): Unknown operation: " + bFunc); } http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/runtime/functionobjects/Xor.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/Xor.java b/src/main/java/org/apache/sysml/runtime/functionobjects/Xor.java new file mode 100644 index 0000000..8fa666b --- /dev/null +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/Xor.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sysml.runtime.functionobjects; + +import java.io.Serializable; + +public class Xor extends ValueFunction implements Serializable +{ + private static final long serialVersionUID = -2847467729680510910L; + + private static Xor singleObj = null; + + private Xor() { + // nothing to do here + } + + public static Xor getXorFnObject() { + if ( singleObj == null ) + singleObj = new Xor(); + return singleObj; + } + + @Override + public boolean execute(boolean in1, boolean in2) { + return in1 != in2; + } +} http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java index edd1136..e3deefa 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java @@ -133,6 +133,7 @@ public class CPInstructionParser extends InstructionParser // Boolean Instruction Opcodes String2CPInstructionType.put( "&&" , CPType.BooleanBinary); String2CPInstructionType.put( "||" , CPType.BooleanBinary); + String2CPInstructionType.put( "xor" , CPType.BooleanBinary); String2CPInstructionType.put( "!" , CPType.BooleanUnary); http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java index c564e67..2f81357 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java @@ -72,6 +72,7 @@ import org.apache.sysml.runtime.functionobjects.ReduceAll; import org.apache.sysml.runtime.functionobjects.ReduceCol; import org.apache.sysml.runtime.functionobjects.ReduceDiag; import org.apache.sysml.runtime.functionobjects.ReduceRow; +import org.apache.sysml.runtime.functionobjects.Xor; import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.gpu.GPUInstruction.GPUINSTRUCTION_TYPE; import org.apache.sysml.runtime.instructions.mr.MRInstruction.MRINSTRUCTION_TYPE; @@ -499,6 +500,8 @@ public class InstructionUtils return new BinaryOperator(And.getAndFnObject()); else if(opcode.equalsIgnoreCase("||")) return new BinaryOperator(Or.getOrFnObject()); + else if(opcode.equalsIgnoreCase("xor")) + return new BinaryOperator(Xor.getXorFnObject()); else if(opcode.equalsIgnoreCase("+")) return new BinaryOperator(Plus.getPlusFnObject()); else if(opcode.equalsIgnoreCase("-")) http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/main/java/org/apache/sysml/runtime/matrix/operators/BinaryOperator.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/matrix/operators/BinaryOperator.java b/src/main/java/org/apache/sysml/runtime/matrix/operators/BinaryOperator.java index 2ff4497..7e95a42 100644 --- a/src/main/java/org/apache/sysml/runtime/matrix/operators/BinaryOperator.java +++ b/src/main/java/org/apache/sysml/runtime/matrix/operators/BinaryOperator.java @@ -43,6 +43,7 @@ import org.apache.sysml.runtime.functionobjects.Plus; import org.apache.sysml.runtime.functionobjects.PlusMultiply; import org.apache.sysml.runtime.functionobjects.Power; import org.apache.sysml.runtime.functionobjects.ValueFunction; +import org.apache.sysml.runtime.functionobjects.Xor; import org.apache.sysml.runtime.functionobjects.Builtin.BuiltinCode; public class BinaryOperator extends Operator implements Serializable @@ -53,8 +54,8 @@ public class BinaryOperator extends Operator implements Serializable public BinaryOperator(ValueFunction p) { //binaryop is sparse-safe iff (0 op 0) == 0 - super (p instanceof Plus || p instanceof Multiply - || p instanceof Minus || p instanceof And || p instanceof Or + super (p instanceof Plus || p instanceof Multiply || p instanceof Minus + || p instanceof And || p instanceof Or || p instanceof PlusMultiply || p instanceof MinusMultiply); fn = p; } @@ -82,6 +83,7 @@ public class BinaryOperator extends Operator implements Serializable else if( fn instanceof NotEquals ) return OpOp2.NOTEQUAL; else if( fn instanceof And ) return OpOp2.AND; else if( fn instanceof Or ) return OpOp2.OR; + else if( fn instanceof Xor ) return OpOp2.XOR; else if( fn instanceof Power ) return OpOp2.POW; else if( fn instanceof MinusNz ) return OpOp2.MINUS_NZ; else if( fn instanceof Builtin ) { http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/test/java/org/apache/sysml/test/integration/functions/binary/scalar/XorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/integration/functions/binary/scalar/XorTest.java b/src/test/java/org/apache/sysml/test/integration/functions/binary/scalar/XorTest.java new file mode 100644 index 0000000..c34ec66 --- /dev/null +++ b/src/test/java/org/apache/sysml/test/integration/functions/binary/scalar/XorTest.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.sysml.test.integration.functions.binary.scalar; + +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.sysml.runtime.util.MapReduceTool; +import org.apache.sysml.test.integration.AutomatedTestBase; +import org.apache.sysml.test.integration.TestConfiguration; + +/** + * The main purpose of this test is to verify all combinations of + * `xor` operands. + * + */ +public class XorTest extends AutomatedTestBase +{ + private final static String TEST_NAME1 = "XorTest"; + private final static String TEST_DIR = "functions/binary/scalar/"; + private static final String TEST_CLASS_DIR = TEST_DIR + XorTest.class.getSimpleName() + "/"; + + @Override + public void setUp() { + addTestConfiguration( TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "B" }) ); + } + + @Test + public void testXor1() { + runXor("TRUE", "FALSE", true); + } + + @Test + public void testXor2() { + runXor("TRUE", "TRUE", false); + } + + @Test + public void testXor3() { + runXor("FALSE", "FALSE", false); + } + + @Test + public void testXor4() { + runXor("FALSE", "TRUE", true); + } + + private void runXor( String op1, String op2, boolean trueCondition ) + { + String TEST_NAME = TEST_NAME1; + getAndLoadTestConfiguration(TEST_NAME); + + String HOME = SCRIPT_DIR + TEST_DIR; + fullDMLScriptName = HOME + TEST_NAME + ".dml"; + programArgs = new String[]{"-args", op1, op2, output("B") }; + + //run tests + runTest(true, false, null, -1); + + //compare result + try { + boolean retCondition = MapReduceTool.readBooleanFromHDFSFile(output("B")); + Assert.assertEquals(trueCondition, retCondition); + } + catch (IOException e) { + Assert.fail(e.getMessage()); + } + } +} http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/test/scripts/functions/binary/scalar/XorTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/scalar/XorTest.dml b/src/test/scripts/functions/binary/scalar/XorTest.dml new file mode 100644 index 0000000..fe7d0ab --- /dev/null +++ b/src/test/scripts/functions/binary/scalar/XorTest.dml @@ -0,0 +1,23 @@ +#------------------------------------------------------------- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#------------------------------------------------------------- + +B = xor($1, $2); +write(B, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/systemml/blob/c382386a/src/test_suites/java/org/apache/sysml/test/integration/functions/binary/scalar/ZPackageSuite.java ---------------------------------------------------------------------- diff --git a/src/test_suites/java/org/apache/sysml/test/integration/functions/binary/scalar/ZPackageSuite.java b/src/test_suites/java/org/apache/sysml/test/integration/functions/binary/scalar/ZPackageSuite.java index fd64652..d813edc 100644 --- a/src/test_suites/java/org/apache/sysml/test/integration/functions/binary/scalar/ZPackageSuite.java +++ b/src/test_suites/java/org/apache/sysml/test/integration/functions/binary/scalar/ZPackageSuite.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; MultiplicationTest.class, OrTest.class, PowerTest.class, - SubtractionTest.class + SubtractionTest.class, + XorTest.class, })
