[SYSTEMDS-2665] Fix correctness ctable operator rexpand-rows
This patch fixes a correctness issue of the special rexpand-rows
operator as applied for the following slice finder expression
map = table(ID, seq(1,nrow(P)), max(ID), nrow(P)).
The cache-conscious implementation had an offset issue in case of
ncol>blocksize (1024). The fix is a one-line modification though.
diff --git a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixReorg.java b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixReorg.java
index a9f8001..c4c3425 100644
--- a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixReorg.java
+++ b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixReorg.java
@@ -674,7 +674,7 @@
if( rows )
ret.reset(lmax, in.rlen, true);
else //cols
- ret.reset(in.rlen, lmax, true);
+ ret.reset(in.rlen, lmax, true);
return ret;
}
@@ -1994,10 +1994,11 @@
//handle invalid values if not to be ignored
if( !ignore && val<=0 )
throw new DMLRuntimeException("Invalid input value <= 0 for ignore=false: "+val);
-
+
//set expanded value if matching
+ //note: tmpi populated with i+j indexes, then sorted
if( val == Math.floor(val) && val >= 1 && val <= max )
- ret.appendValue((int)(val-1), i+tmpi[j], 1);
+ ret.appendValue((int)(val-1), tmpi[j], 1);
}
}