package umontreal.iro.lecuyer.hups;
/* *
 * Title:        

* Description:

* Copyright: Copyright (c)

* Company:

* @author * @version 1.0 */ /** * This class implements Korobov lattice sequences, defined as follows. * One selects a basis b and a (large) multiplier a. * For each integer k >=  0, we may consider the * n-point Korobov lattice with modulus n = bk and multiplier * * ã = a mod n. * Its points have the form *

*

*
* ui = (ai(1, a, a2,…) modn)/n = (ãi(1,ã,ã2,…) modn)/n *

* for * i = 0,..., n - 1. * For * k = 0, 1,..., we have an increasing sequence of lattices * contained in one another. * *

* These embedded lattices contain an infinite sequence of points that * can be enumerated as follows: *

*

*
* ui = ψb(i)(1, a, a2,…) mod 1. *

* where ψb(i) is the radical inverse function in base b, * defined in {@link RadicalInverse}. * The first n = bk points in this sequence are exactly the same as * the n points in, for each k >=  0. * */ public class KorobovLatticeSequence extends KorobovLattice { int base; // Base for radical inversion int inverse; // global variables for radical inverssion, int n; // since bloody JAVA cannot pass references // Method modPower is inherited from Rank1Lattice. /** * Constructs a new lattice sequence with base b and * generator = a. * * @param b number of points (modulus) is a power of b * * @param a multiplier a of this lattice sequence * * */ public KorobovLatticeSequence (int b, int a) { // Pas termine: ne fonctionne pas super (2, 3, 1); if (a < 1) throw new IllegalArgumentException ("KorobovLatticeSequence: Multiplier a must be >= 1"); // dim = Integer.MAX_VALUE; // numPoints = Integer.MAX_VALUE; base = b; throw new UnsupportedOperationException ("NOT FINISHED"); } // A very inefficient way of generating the points! public double getCoordinate (int i, int j) { int n; int inverse; if (i == 0) return 0.0; else if (j == 0) return radicalInverse (base, i); else { // integerRadicalInverse (i); n = 1; for (inverse = 0; i > 0; i /= base) { inverse = inverse * base + (i % base); n *= base; } return (double) ((inverse * modPower (genA, j, n)) % n) / (double) n; } } // ... has been unrolled in getCoordinate. private void integerRadicalInverse (int i) { // Attention: returns results in variables n and inverse. n = 1; for (inverse = 0; i > 0; i /= base) { inverse = inverse * base + (i % base); n *= base; } } }

Ads help maintain this website.