[ 
https://issues.apache.org/jira/browse/MATH-1597?focusedWorklogId=618883&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-618883
 ]

ASF GitHub Bot logged work on MATH-1597:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Jul/21 05:58
            Start Date: 06/Jul/21 05:58
    Worklog Time Spent: 10m 
      Work Description: samyBadjoudj commented on a change in pull request #190:
URL: https://github.com/apache/commons-math/pull/190#discussion_r664255905



##########
File path: 
commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/quasirandom/SobolSequenceGeneratorTest.java
##########
@@ -92,16 +92,29 @@ public void testConstructor2() throws Exception{
     }
 
     @Test
-    public void testSkip() {
-        double[] result = generator.skipTo(5);
+    public void testJump() {
+        LowDiscrepancySequence copyOfSeq = generator.jump(5);
+        double[] result = copyOfSeq.get();
         Assert.assertArrayEquals(referenceValues[5], result, 1e-6);
-        Assert.assertEquals(6, generator.getNextIndex());
 
         for (int i = 6; i < referenceValues.length; i++) {
-            result = generator.get();
+            result = copyOfSeq.get();
             Assert.assertArrayEquals(referenceValues[i], result, 1e-6);
-            Assert.assertEquals(i + 1, generator.getNextIndex());
         }
     }
 
+    @Test(expected = NotPositiveException.class)
+    public void testJumpNegativeIndex() {
+        LowDiscrepancySequence copyOfSeq = generator.jump(-5);
+
+    }
+
+
+    @Test
+    public void testFirstSupplying() {
+        LowDiscrepancySequence sequence = new SobolSequenceGenerator(3);
+        Assert.assertArrayEquals(new double[]{0.0, 0.0, 0.0}, 
sequence.get(),1e-6);
+

Review comment:
       done




-- 
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: issues-unsubscr...@commons.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 618883)
    Time Spent: 1h  (was: 50m)

> Low-discrepancy sequence
> ------------------------
>
>                 Key: MATH-1597
>                 URL: https://issues.apache.org/jira/browse/MATH-1597
>             Project: Commons Math
>          Issue Type: Sub-task
>            Reporter: Gilles Sadowski
>            Priority: Minor
>             Fix For: 4.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Two low-discrepancy sequences are implemented in Commons Math (in package 
> {{o.a.c.math4.legacy.random}}:
> * {{SobolSequenceGenerator}}
> * {{HaltonSequenceGenerator}}
> They both provide several methods:
> * {{nextVector()}}
> * {{skipTo(int)}}
> * {{getNextIndex()}}
> of which only the first is part of their common API through the 
> {{RandomVectorGenerator}}.
> I propose to create an interface that would better represent the specific 
> concept (and avoid the confusion with pseudo-random generators):
> {code}
> public interface LowDiscrepancySequence extends Supplier<double[]> { /* ... 
> */}
> {code}
> Thus, instead of class {{SobolSequenceGenerator}} we'd have:
> {code}
> public class SobolSequence implements LowDiscrepancySequence {
>     // ...
> }
> {code}
> This functionality could be moved to a new {{o.a.c.m.legacy.quasirandom}} 
> package (?).
> Method {{skipTo}} could be replaced with an API similar to Commons RNG 
> {{JumpableUniformRandomProvider}} (?).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to