commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1481590 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java
Date Sun, 12 May 2013 15:57:50 GMT
Author: tn
Date: Sun May 12 15:57:50 2013
New Revision: 1481590

URL: http://svn.apache.org/r1481590
Log:
Improve gray code calculation.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java?rev=1481590&r1=1481589&r2=1481590&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/SobolSequenceGenerator.java
Sun May 12 15:57:50 2013
@@ -277,7 +277,7 @@ public class SobolSequenceGenerator impl
             Arrays.fill(x, 0);
         } else {
             final int i = index - 1;
-            final long grayCode = i ^ (i / 2);
+            final long grayCode = i ^ (i >> 1); // compute the gray code of i = i XOR
floor(i / 2)
             for (int j = 0; j < dimension; j++) {
                 long result = 0;
                 for (int k = 1; k <= BITS; k++) {



Mime
View raw message