You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2018/01/05 03:28:44 UTC

[2/3] systemml git commit: [SYSTEMML-1931] Generalized logical NOT to matrices, incl cleanups

http://git-wip-us.apache.org/repos/asf/systemml/blob/9067654e/src/main/java/org/apache/sysml/runtime/matrix/data/OperationsOnMatrixValues.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/OperationsOnMatrixValues.java b/src/main/java/org/apache/sysml/runtime/matrix/data/OperationsOnMatrixValues.java
index 1f72692..90a8d15 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/data/OperationsOnMatrixValues.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/data/OperationsOnMatrixValues.java
@@ -38,27 +38,12 @@ import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator;
 import org.apache.sysml.runtime.matrix.operators.BinaryOperator;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 import org.apache.sysml.runtime.matrix.operators.ReorgOperator;
-import org.apache.sysml.runtime.matrix.operators.ScalarOperator;
-import org.apache.sysml.runtime.matrix.operators.UnaryOperator;
 import org.apache.sysml.runtime.util.IndexRange;
 import org.apache.sysml.runtime.util.UtilFunctions;
 
 
 public class OperationsOnMatrixValues 
 {
-	
-	public static void performScalarIgnoreIndexes(MatrixValue valueIn, MatrixValue valueOut, ScalarOperator op) 
-		throws DMLRuntimeException
-	{
-		valueIn.scalarOperations(op, valueOut);
-	}
-	
-	public static void performUnaryIgnoreIndexes(MatrixValue valueIn, MatrixValue valueOut, UnaryOperator op) 
-		throws DMLRuntimeException
-	{
-		valueIn.unaryOperations(op, valueOut);
-	}
-
 	public static void performReorg(MatrixIndexes indexesIn, MatrixValue valueIn, MatrixIndexes indexesOut, 
 			         MatrixValue valueOut, ReorgOperator op, int startRow, int startColumn, int length) 
 		throws DMLRuntimeException

http://git-wip-us.apache.org/repos/asf/systemml/blob/9067654e/src/main/java/org/apache/sysml/runtime/matrix/operators/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/operators/UnaryOperator.java b/src/main/java/org/apache/sysml/runtime/matrix/operators/UnaryOperator.java
index 3b071e2..7f48252 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/operators/UnaryOperator.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/operators/UnaryOperator.java
@@ -36,13 +36,13 @@ public class UnaryOperator extends Operator
 	
 	public UnaryOperator(ValueFunction p, int numThreads) {
 		super(p instanceof Builtin &&
-			((Builtin)p).bFunc==Builtin.BuiltinCode.SIN || ((Builtin)p).bFunc==Builtin.BuiltinCode.TAN 
+			(((Builtin)p).bFunc==Builtin.BuiltinCode.SIN || ((Builtin)p).bFunc==Builtin.BuiltinCode.TAN 
 			// sinh and tanh are zero only at zero, else they are nnz
 			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.SINH || ((Builtin)p).bFunc==Builtin.BuiltinCode.TANH
 			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.ROUND || ((Builtin)p).bFunc==Builtin.BuiltinCode.ABS
 			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.SQRT || ((Builtin)p).bFunc==Builtin.BuiltinCode.SPROP
 			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.SELP || ((Builtin)p).bFunc==Builtin.BuiltinCode.LOG_NZ
-			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.SIGN );
+			|| ((Builtin)p).bFunc==Builtin.BuiltinCode.SIGN) );
 		fn = p;
 		k = numThreads;
 	}

http://git-wip-us.apache.org/repos/asf/systemml/blob/9067654e/src/test/java/org/apache/sysml/test/integration/functions/binary/matrix/ElementwiseLogicalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/binary/matrix/ElementwiseLogicalTest.java b/src/test/java/org/apache/sysml/test/integration/functions/binary/matrix/ElementwiseLogicalTest.java
index 0488a26..8b23300 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/binary/matrix/ElementwiseLogicalTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/binary/matrix/ElementwiseLogicalTest.java
@@ -49,8 +49,8 @@ public class ElementwiseLogicalTest extends AutomatedTestBase{
 
 	private final static int rows = 2100;
 	private final static int cols = 70;
-	private final static double sparsity1 = 0.9;//dense
-	private final static double sparsity2 = 0.1;//sparse
+	private final static double sparsity1 = 0.1;//sparse
+	private final static double sparsity2 = 0.9;//dense
 	private final static double eps = 1e-10;
 	
 	@Override
@@ -121,36 +121,35 @@ public class ElementwiseLogicalTest extends AutomatedTestBase{
 		runLogical(TEST_NAME2, true, ExecType.MR);
 	}
 
-//TODO support for unary not requires some more cleanups
-//	@Test
-//	public void testNotDenseCP() {
-//		runLogical(TEST_NAME3, false, ExecType.CP);
-//	}
-//	
-//	@Test
-//	public void testNotSparseCP() {
-//		runLogical(TEST_NAME3, true, ExecType.CP);
-//	}
-//	
-//	@Test
-//	public void testNotDenseSP() {
-//		runLogical(TEST_NAME3, false, ExecType.SPARK);
-//	}
-//	
-//	@Test
-//	public void testNotSparseSP() {
-//		runLogical(TEST_NAME3, true, ExecType.SPARK);
-//	}
-//	
-//	@Test
-//	public void testNotDenseMR() {
-//		runLogical(TEST_NAME3, false, ExecType.MR);
-//	}
-//	
-//	@Test
-//	public void testNotSparseMR() {
-//		runLogical(TEST_NAME3, true, ExecType.MR);
-//	}
+	@Test
+	public void testNotDenseCP() {
+		runLogical(TEST_NAME3, false, ExecType.CP);
+	}
+	
+	@Test
+	public void testNotSparseCP() {
+		runLogical(TEST_NAME3, true, ExecType.CP);
+	}
+	
+	@Test
+	public void testNotDenseSP() {
+		runLogical(TEST_NAME3, false, ExecType.SPARK);
+	}
+	
+	@Test
+	public void testNotSparseSP() {
+		runLogical(TEST_NAME3, true, ExecType.SPARK);
+	}
+	
+	@Test
+	public void testNotDenseMR() {
+		runLogical(TEST_NAME3, false, ExecType.MR);
+	}
+	
+	@Test
+	public void testNotSparseMR() {
+		runLogical(TEST_NAME3, true, ExecType.MR);
+	}
 	
 	@Test
 	public void testXorDenseCP() {