Baunsgaard commented on code in PR #2186:
URL: https://github.com/apache/systemds/pull/2186#discussion_r1932971186


##########
src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixDatagen.java:
##########
@@ -590,13 +615,22 @@ private static void genDense(MatrixBlock out, int clen, 
int blockrows, int block
        }
        
        private static void genFullyDense(DenseBlock c, int blockrows, int 
blockcols, int rowoffset, int coloffset, 
-               double min, double range, PRNGenerator valuePRNG)
+               double min, double range, IPRNGenerator valuePRNG, long[] ctr)
        {
-               for(int i = rowoffset; i < rowoffset+blockrows; i++) {
+               Iterator<Double> rngStream;
+               if (valuePRNG instanceof PRNGenerator) {
+                       rngStream = Stream.generate(() -> min + (range * 
((PRNGenerator) valuePRNG).nextDouble())).iterator();
+               } else if (valuePRNG instanceof CounterBasedPRNGenerator) {
+                       rngStream = 
Arrays.stream(((CounterBasedPRNGenerator)valuePRNG).getDoubles(ctr, blockrows * 
blockcols)).map(i -> min + (range * i)).iterator();

Review Comment:
   yup the stream looks nice, however, since it modifies old code, we need to 
be careful that the new code returns the same values as the previous.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to