|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.hups.RadicalInverse
public class RadicalInverse
This class implements basic methods for working with radical inverses of integers in an arbitrary basis b. These methods are used in classes that implement point sets and sequences based on the van der Corput sequence (the Hammersley nets and the Halton sequence, for example).
We recall that for a k-digit integer i whose digital b-ary expansion is
Note that ψb(i) cannot always be represented exactly as a floating-point number on the computer (e.g., if b is not a power of two). For an exact representation, one can use the integer
It is common practice to permute locally the values of the van der Corput sequence. One way of doing this is to apply a permutation to the digits of i before computing ψb(i). That is, for a permutation π of the digits {0,..., b - 1},
The permutation π can be deterministic or random. One (deterministic)
possibility implemented here is the Faure permutation σb of
{0,..., b - 1} defined as follows.
For b = 2, take
σ = I, the identical permutation. For even
b = 2c > 2, take
σ[i] | = | 2τ[i] i = 0, 1,…, c - 1 | |
σ[i + c] | = | 2τ[i] + 1 i = 0, 1,…, c - 1 |
σ[c] | = | c | |
σ[i] | = | τ[i], if 0 <= τ[i] < c | |
σ[i] | = | τ[i] + 1, if c <= τ[i] < 2c |
σ[i] | = | τ[i - 1], if 0 <= τ[i - 1] < c | |
σ[i] | = | τ[i - 1] + 1, if c <= τ[i - 1] < 2c |
Constructor Summary | |
---|---|
RadicalInverse(int b,
double x0)
Initializes the base of this object to b and its first value of x to x0. |
Method Summary | |
---|---|
static void |
getFaureLemieuxPermutation(int coordinate,
int[] pi)
Computes the permutations as proposed in σb of the set {0,…, b - 1} and puts it in array pi. |
static void |
getFaurePermutation(int b,
int[] pi)
Computes the Faure permutation σb of the set {0,…, b - 1} and puts it in array pi. |
static int[] |
getPrimes(int n)
Provides an elementary method for obtaining the first n prime numbers larger than 1. |
static int |
integerRadicalInverse(int b,
int i)
Computes the integer radical inverse of i in base b, equal to bkψb(i) if i has k b-ary digits. |
double |
nextRadicalInverse()
A fast method that incrementally computes the radical inverse xi+1 in base b from xi = ψb(i), using addition with rigthward carry as described in Wang and Hickernell. |
static double |
nextRadicalInverse(double invb,
double x)
A fast method that incrementally computes the radical inverse xi+1 in base b from xi = x = ψb(i), using addition with rigthward carry. |
static int |
nextRadicalInverseDigits(int b,
int k,
int[] idigits)
Given the k digits of the integer radical inverse of i in bdigits, in base b, this method replaces them by the digits of the integer radical inverse of i + 1 and returns their number. |
static double |
permutedRadicalInverse(int b,
int[] pi,
long i)
Computes the radical inverse of i in base b, where the digits are permuted using the permutation π. |
static double |
radicalInverse(int b,
long i)
Computes the radical inverse of i in base b. |
static int |
radicalInverseInteger(int b,
double x)
Computes the radical inverse of x in base b. |
static long |
radicalInverseLong(int b,
double x)
Computes the radical inverse of x in base b. |
static void |
reverseDigits(int k,
int[] bdigits,
int[] idigits)
Given the k b-ary digits of i in bdigits, returns the k digits of the integer radical inverse of i in idigits. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RadicalInverse(int b, double x0)
b
- Basex0
- Initial value of xMethod Detail |
---|
public static int[] getPrimes(int n)
n
- number of prime numbers to return
public static double radicalInverse(int b, long i)
b
- base used for the operationi
- the value for which the radical inverse will be computed
public static int radicalInverseInteger(int b, double x)
b
- base used for the operationx
- the value for which the radical inverse will be computed
public static long radicalInverseLong(int b, double x)
b
- base used for the operationx
- the value for which the radical inverse will be computed
public static double nextRadicalInverse(double invb, double x)
radicalInverse
every once in a while (i.e. in every few
thousand calls).
invb
- 1/b where b is the basex
- the inverse xi
public double nextRadicalInverse()
radicalInverse
once in every 1000 calls.
public static void reverseDigits(int k, int[] bdigits, int[] idigits)
k
- number of digits in arraysbdigits
- digits in original orderidigits
- digits in reverse orderpublic static int integerRadicalInverse(int b, int i)
b
- base used for the operationi
- the value for which the integer radical inverse will be computed
public static int nextRadicalInverseDigits(int b, int k, int[] idigits)
b
- basek
- initial number of digits in arraysidigits
- digits of integer radical inverse
public static void getFaureLemieuxPermutation(int coordinate, int[] pi)
coordinate
- the coordinatepi
- an array of size at least b,
to be filled with the permutationpublic static void getFaurePermutation(int b, int[] pi)
b
- the basepi
- an array of size at least b,
to be filled with the permutationpublic static double permutedRadicalInverse(int b, int[] pi, long i)
b
- base b used for the operationpi
- an array of length at least b containing the permutation
used during the computationi
- the value for which the radical inverse will be computed
|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |