Skip to content

Commit 02522a0

Browse files
committed
true count
1 parent 86dc7de commit 02522a0

File tree

1 file changed

+20
-8
lines changed
  • src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping

1 file changed

+20
-8
lines changed

src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping/AMapToData.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.commons.lang3.NotImplementedException;
3131
import org.apache.commons.logging.Log;
3232
import org.apache.commons.logging.LogFactory;
33+
import org.apache.sysds.runtime.DMLRuntimeException;
3334
import org.apache.sysds.runtime.compress.CompressedMatrixBlock;
3435
import org.apache.sysds.runtime.compress.DMLCompressionException;
3536
import org.apache.sysds.runtime.compress.colgroup.IMapToDataGroup;
@@ -1044,14 +1045,25 @@ public String toString() {
10441045
}
10451046

10461047
public AMapToData removeEmpty(final boolean[] selectV, final int rOut) {
1047-
final AMapToData ret = MapToFactory.create(rOut, getUnique());
1048-
final int s = size();
1049-
int t = 0;
1050-
for(int i = 0; i < s; i++)
1051-
if(selectV[i] == true)
1052-
ret.set(t++, getIndex(i));
1053-
1054-
return ret;
1048+
try{
1049+
1050+
final AMapToData ret = MapToFactory.create(rOut, getUnique());
1051+
final int s = size();
1052+
int t = 0;
1053+
for(int i = 0; i < s; i++)
1054+
if(selectV[i] == true)
1055+
ret.set(t++, getIndex(i));
1056+
1057+
return ret;
1058+
}
1059+
catch(ArrayIndexOutOfBoundsException e){
1060+
1061+
int trueCount = 0;
1062+
for(boolean a : selectV){
1063+
if(a) trueCount ++;
1064+
}
1065+
throw new DMLRuntimeException("actual number of true values " + trueCount + " vs argument " + rOut,e);
1066+
}
10551067
}
10561068

10571069
/**

0 commit comments

Comments
 (0)