[SYSTEMML-1520] Fix sparse output corruption of row-wise rexpand Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/149562ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/149562ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/149562ec
Branch: refs/heads/master Commit: 149562eca0bb1a438e34dc6e2d7993b44e2e612e Parents: 55e46e7 Author: Matthias Boehm <[email protected]> Authored: Fri Apr 14 02:24:13 2017 -0700 Committer: Matthias Boehm <[email protected]> Committed: Fri Apr 14 12:46:42 2017 -0700 ---------------------------------------------------------------------- .../org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/149562ec/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java index 9c6af97..dfd19aa 100644 --- a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java +++ b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixReorg.java @@ -1899,9 +1899,13 @@ public class LibMatrixReorg if( val == Math.floor(val) && val >= 1 && val <= max ) ret.appendValue((int)(val-1), i+tmpi[j], 1); } - } + //ensure valid output sparse representation + //(necessary due to cache-conscious processing w/ unstable sort) + if( ret.isInSparseFormat() ) + ret.sortSparseRows(); + return ret; } @@ -1940,7 +1944,7 @@ public class LibMatrixReorg { //copy value array from input matrix if( in.isEmptyBlock(false) ) { - Arrays.fill(tmp, 0, 0, len); + Arrays.fill(tmp, 0, len, 0); } else if( in.sparse ){ //SPARSE for( int i=0; i<len; i++ )
