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/04/18 07:47:24 UTC
systemml git commit: [SYSTEMML-1029] Fix correctness sparse-sparse
CSR left indexing
Repository: systemml
Updated Branches:
refs/heads/master 36a06ab68 -> d1bf80ac5
[SYSTEMML-1029] Fix correctness sparse-sparse CSR left indexing
This patch fixes incorrect column indexes after sparse-sparse left
indexing into a CSR target matrix (e.g., in case of for/while update in
place variables). In detail, this fast path only applies to aligned
src-tgt indexes as is the case for row-wise indexing but not for general
range-based indexing.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/d1bf80ac
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/d1bf80ac
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/d1bf80ac
Branch: refs/heads/master
Commit: d1bf80ac501e1430876660cf5ed55b7e26aeb575
Parents: 36a06ab
Author: Matthias Boehm <mb...@gmail.com>
Authored: Wed Apr 18 00:44:38 2018 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Wed Apr 18 00:44:38 2018 -0700
----------------------------------------------------------------------
.../org/apache/sysml/runtime/matrix/data/MatrixBlock.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/d1bf80ac/src/main/java/org/apache/sysml/runtime/matrix/data/MatrixBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/MatrixBlock.java b/src/main/java/org/apache/sysml/runtime/matrix/data/MatrixBlock.java
index 5ce4963..f306a7a 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/data/MatrixBlock.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/data/MatrixBlock.java
@@ -3555,10 +3555,13 @@ public class MatrixBlock extends MatrixValue implements CacheBlock, Externalizab
}
else { //general case
//handle csr sparse blocks separately to avoid repeated shifting on column-wise access
- if( !result.isEmptyBlock(false) && result.sparse && result.sparseBlock instanceof SparseBlockCSR ) {
+ //(note that for sparse inputs this only applies to aligned column indexes)
+ if( !result.isEmptyBlock(false) && result.sparse && (!src.sparse || rl==0)
+ && result.sparseBlock instanceof SparseBlockCSR ) {
SparseBlockCSR sblock = (SparseBlockCSR) result.sparseBlock;
- if( src.sparse || src.isEmptyBlock(false) )
+ if( src.sparse || src.isEmptyBlock(false) ) {
sblock.setIndexRange(rl, ru+1, cl, cu+1, src.getSparseBlock());
+ }
else { //dense
for(int bi=0; bi<src.denseBlock.numBlocks(); bi++) {
int rpos = bi * src.denseBlock.blockSize();