[HOTFIX][SYSTEMML-1761] Fix wsloss special cases w/ sparse factors

This patch fixes null pointer exceptions of wsloss with sparse factors,
which implementations mistakenly access the non-existing weight matrix.

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

Branch: refs/heads/master
Commit: 8dcb487e4e4bb3b153690be351111f2ada1b58b1
Parents: 4184970
Author: Matthias Boehm <mboe...@gmail.com>
Authored: Wed Jul 26 21:48:33 2017 -0700
Committer: Matthias Boehm <mboe...@gmail.com>
Committed: Wed Jul 26 21:49:01 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/8dcb487e/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java 
b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
index c2af52d..fd9742e 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
@@ -2252,7 +2252,7 @@ public class LibMatrixMult
                else if( wt==WeightsType.POST_NZ )
                {
                        // approach: iterate over W, point-wise in order to 
exploit sparsity
-                       if( mW.sparse ) //SPARSE
+                       if( mX.sparse ) //SPARSE
                        {
                                SparseBlock x = mX.sparseBlock;
                                
@@ -2303,7 +2303,7 @@ public class LibMatrixMult
                        //parallel task computes sum(X^2)-sum(2*X*(U%*%t(V)))) 
and the last term
                        //sum((t(U)%*%U)*(t(V)%*%V)) is computed once via two 
tsmm operations.
                        
-                       if( mW.sparse ) { //SPARSE
+                       if( mX.sparse ) { //SPARSE
                                SparseBlock x = mX.sparseBlock;
                                for( int i=rl; i<ru; i++ ) {
                                        if( x.isEmpty(i) ) continue;

Reply via email to