Skip to content

Commit 825f834

Browse files
committed
a bit of cleanup
1 parent a43fe21 commit 825f834

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,13 +1417,10 @@ else if( !sparse && denseBlock!=null ) //DENSE
14171417
* @return the number of non zeros
14181418
*/
14191419
public long recomputeNonZeros(int k) {
1420-
if(k <= 1)
1421-
return recomputeNonZeros();
1422-
if(sparse && sparseBlock!=null)
1420+
// fallback to single thread if k <= 1, small matrix, or sparse.
1421+
if(k <= 1 || ((long) rlen * clen < 10000) || (sparse && sparseBlock!=null))
14231422
return recomputeNonZeros();
14241423
else if(!sparse && denseBlock!=null){
1425-
if((long) rlen * clen < 10000)
1426-
return recomputeNonZeros();
14271424
final ExecutorService pool = CommonThreadPool.get(k);
14281425
try {
14291426
List<Future<Long>> f = new ArrayList<>();

0 commit comments

Comments
 (0)