This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 6a3ff8c633 [SYSTEMDS-3708] Minor runtime improvement of raGroupby
6a3ff8c633 is described below

commit 6a3ff8c63358910d8dae68e1a80f2fed36c0fb06
Author: Matthias Boehm <[email protected]>
AuthorDate: Sun Jun 30 10:31:49 2024 +0200

    [SYSTEMDS-3708] Minor runtime improvement of raGroupby
---
 scripts/builtin/raGroupby.dml | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/scripts/builtin/raGroupby.dml b/scripts/builtin/raGroupby.dml
index 35f5996616..1499bc0fcf 100644
--- a/scripts/builtin/raGroupby.dml
+++ b/scripts/builtin/raGroupby.dml
@@ -45,16 +45,7 @@ m_raGroupby = function (Matrix[Double] X, Integer col, 
String method="nested-loo
   numGroups = nrow(uniqueValues)
 
   # Determine the maximum number of rows in any group
-  maxRowsInGroup = 0
-  for(i in 1:numGroups){
-    groupValue = uniqueValues[i,1]
-    groupRows = ( X[,col] == groupValue )
-
-    groupSize = sum(groupRows)
-    if( groupSize > maxRowsInGroup ){
-      maxRowsInGroup = groupSize
-    }
-  }
+  maxRowsInGroup = max(table(X[,col],1));
 
   # Define a zero matrix to put the group data into
   Y=matrix(0,numGroups,maxRowsInGroup*(ncol(X)-1)+1)

Reply via email to