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 2017/06/22 06:07:31 UTC

[2/2] systemml git commit: [SYSTEMML-1624] Fix correctness matrix-scalar pow (sparse-safeness)

[SYSTEMML-1624] Fix correctness matrix-scalar pow (sparse-safeness)

This patch a correctness issue of right matrix-scalar pow operations and
the special case pow(X,0). This right scalar operator was marked
statically sparse-safe although it should be conditionally sparse-safe
if the given constant is not equal 0.


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/f516e4bd
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/f516e4bd
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/f516e4bd

Branch: refs/heads/master
Commit: f516e4bdc9af606d2112564901ebb2e27467569d
Parents: ea805c8
Author: Matthias Boehm <mb...@gmail.com>
Authored: Wed Jun 21 23:07:52 2017 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Wed Jun 21 23:07:52 2017 -0700

----------------------------------------------------------------------
 .../runtime/matrix/operators/RightScalarOperator.java     | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/f516e4bd/src/main/java/org/apache/sysml/runtime/matrix/operators/RightScalarOperator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/operators/RightScalarOperator.java b/src/main/java/org/apache/sysml/runtime/matrix/operators/RightScalarOperator.java
index 9e87bcd..5a75c32 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/operators/RightScalarOperator.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/operators/RightScalarOperator.java
@@ -52,18 +52,12 @@ public class RightScalarOperator extends ScalarOperator
 			|| (fn instanceof GreaterThanEquals && _constant>0)
 			|| (fn instanceof LessThan && _constant<=0)
 			|| (fn instanceof LessThanEquals && _constant<0)
-			|| (fn instanceof Divide && _constant!=0));
+			|| (fn instanceof Divide && _constant!=0)
+			|| (fn instanceof Power && _constant!=0));
 	}
 	
 	@Override
 	public double executeScalar(double in) throws DMLRuntimeException {
 		return fn.execute(in, _constant);
 	}
-	
-	@Override
-	protected boolean isSparseSafeStatic() {
-		//add power as only rhs op sparse safe (1^0=1 but 0^1=0).
-		return (super.isSparseSafeStatic() 
-			|| fn instanceof Power);
-	}
 }