public class MersenneTwisterFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MersenneTwisterFactory.MaskNode |
class |
MersenneTwisterFactory.MTS |
static class |
MersenneTwisterFactory.Polynomial |
static class |
MersenneTwisterFactory.Vector |
Modifier and Type | Field and Description |
---|---|
protected long[] |
aaa |
protected long[] |
bitmask
********************************
|
static int |
CHECK32_REDU |
protected long[] |
cur_bitmask |
static int |
DEFAULT_ID_SIZE |
static int |
FOUND
*********************************************************
|
protected int[] |
gcur_maxlengs
for optimize_v_hard *
|
protected int |
ggap
difference between machine wordsize and dest wordsize *
|
protected long |
glower_mask
least significant RRR bits *
|
protected long |
gmax_b |
protected long |
gmax_c |
protected long |
greal_mask
upper WWW bitmask *
|
protected long |
gupper_mask
most significant (WWW - RRR) bits *
|
protected static MersenneTwisterFactory |
instance
Holds a default instance of the factory.
|
static int |
IRRED |
protected int[][] |
irredpolylist |
static int |
LIMIT_IRRED_DEG |
static int |
LIMIT_V_BEST_OPT
for get_tempering_parameter_hard *
|
static java.util.logging.Logger |
log |
protected long |
lower_mask |
static int |
LOWER_MASK |
static int |
LSB |
static int |
M |
protected long |
mask_b |
protected long |
mask_c |
static int |
MATRIX_A |
static int |
MAX_IRRED_DEG |
static int |
MAX_SEARCH
*****************************
|
private static long |
MAX_VALUE
The maximum value of a 32 bit unsigned int.
|
static int |
MIN_INFINITE |
protected int |
mmm |
protected long[][] |
modlist |
protected long[] |
mt |
protected int |
mti |
static int |
N |
static int |
NIRREDPOLY |
protected int |
nnn |
static int |
NONREDU |
static int |
NOT_FOUND |
static int |
NOT_REJECTED |
protected MersenneTwisterFactory.Polynomial[] |
preModPolys |
static int |
PRESCR_REDU |
static int |
REJECTED |
protected int |
rrr |
static int |
S00 |
static int |
S01 |
protected int |
shift_0 |
protected int |
shift_1 |
protected int |
shift_s |
protected int |
shift_t |
protected int |
sizeofA |
static int |
SSS
***********************************
|
static int |
TEMPERING_MASK_B |
static int |
TEMPERING_MASK_C |
static int |
TTT |
protected long |
upper_mask |
static int |
UPPER_MASK |
protected long |
upper_v_bits |
static int |
WORD_LEN
***********************************
|
protected long |
word_mask |
static int |
WORDLEN |
protected int |
www |
Constructor and Description |
---|
MersenneTwisterFactory(int seed)
Create a new instance with the given seed.
|
Modifier and Type | Method and Description |
---|---|
protected int |
_CheckPeriod_dc(long a,
int m,
int n,
int r,
int w) |
protected void |
_EndPrescreening_dc() |
protected long |
_genrand_dc() |
protected void |
_get_tempering_parameter_dc(MersenneTwisterFactory.MTS mts) |
protected void |
_get_tempering_parameter_hard_dc(MersenneTwisterFactory.MTS mts) |
protected void |
_InitCheck32_dc(int r,
int w) |
protected void |
_InitPrescreening_dc(int m,
int n,
int r,
int w) |
protected int |
_prescreening_dc(long aaa) |
protected void |
_sgenrand_dc(long seed)
Initializing the array with a seed
|
protected void |
add_i_to_j(MersenneTwisterFactory.Vector[] lattice,
int i,
int j,
int k)
add t^k*(i-th row) to j-th row
|
protected void |
add(MersenneTwisterFactory.Vector u,
MersenneTwisterFactory.Vector v)
adds v to u (then u will change)
|
MersenneTwisterFactory.MTS |
alloc_mt_struct(int n) |
protected MersenneTwisterFactory.MaskNode |
cons_MaskNode(MersenneTwisterFactory.MaskNode head,
long b,
long c,
int leng) |
void |
copy_params_of_mt_struct(MersenneTwisterFactory.MTS src,
MersenneTwisterFactory.MTS dst) |
private int |
countMaskNodeLevels(MersenneTwisterFactory.MaskNode mn)
For debugging.
|
MersenneTwisterDC |
createMT(int p,
int seed) |
MersenneTwisterDC |
createMT(int p,
int seed,
int id) |
MersenneTwisterDC[] |
createMTArray(int p,
int[] seeds) |
protected int |
degree_of_vector(MersenneTwisterFactory.Vector v)
returns the max degree of v
|
protected MersenneTwisterFactory.MaskNode |
delete_lower_MaskNodes(MersenneTwisterFactory.MaskNode head,
int l) |
protected void |
delete_MaskNodes(MersenneTwisterFactory.MaskNode head) |
void |
delete_mt_array(int i,
MersenneTwisterFactory.MTS[] mtss) |
protected void |
end_mt_search() |
protected void |
free_lattice(MersenneTwisterFactory.Vector[] lattice,
int v)
Sets the given Vector to null
|
void |
free_mt_struct(MersenneTwisterFactory.MTS mts) |
protected int |
get_irred_param(MersenneTwisterFactory.MTS mts,
int id,
int idw) |
protected MersenneTwisterFactory.MTS |
get_mt_parameter_id(int w,
int p,
int id) |
protected MersenneTwisterFactory.MTS |
get_mt_parameter(int w,
int p) |
MersenneTwisterFactory.MTS[] |
get_mt_parameters(int w,
int p,
int max_id) |
static MersenneTwisterFactory |
getInstance() |
protected void |
hakidasi(int k,
MersenneTwisterFactory.Vector[] lattice)
sweeps out k-th row with 0th ...
|
protected void |
init_dc(int seed) |
protected MersenneTwisterFactory.MTS |
init_mt_search(int w,
int p) |
protected void |
init_tempering(MersenneTwisterFactory.MTS mts) |
protected int |
IsReducible(long aaa,
long[] polylist)
REDU -- reducible aaa = (a_{w-1}a_{w-2}...a_1a_0
|
protected int |
lenstra(int v)
*******************************
|
protected long |
LSB(long x) |
protected MersenneTwisterFactory.Vector[] |
make_lattice(int v)
makes a initial lattice
|
protected void |
make_masks(int r,
int w,
MersenneTwisterFactory.MTS mts) |
protected MersenneTwisterFactory.Polynomial |
make_tntm(int n,
int m)
make the polynomial "t**n + t**m"
|
protected void |
makemodlist(MersenneTwisterFactory.Polynomial pl,
int nPoly) |
protected void |
MakepreModPolys(int mm,
int nn,
int rr,
int ww) |
protected MersenneTwisterFactory.Vector |
mult(MersenneTwisterFactory.Vector v,
int k)
Vector v is multiplied by t^k
|
protected MersenneTwisterFactory.Vector |
new_Vector()
*****************************
|
protected MersenneTwisterFactory.Polynomial |
NewPoly(int degree)
********************************
|
protected long |
nextA_id(int w,
int id,
int idw) |
protected long |
nextA(int w) |
protected void |
NextIrredPoly(MersenneTwisterFactory.Polynomial pl,
int nth)
**********************************************
|
protected MersenneTwisterFactory.MaskNode |
optimize_v_hard(int v,
MersenneTwisterFactory.MaskNode prev_masks)
(v-1) bitmasks of b,c
|
protected void |
optimize_v(long b,
long c,
int v)
(v-1) bitmasks of b,c
|
protected MersenneTwisterFactory.Polynomial |
PolynomialDup(MersenneTwisterFactory.Polynomial pl) |
protected void |
PolynomialMod(MersenneTwisterFactory.Polynomial wara,
MersenneTwisterFactory.Polynomial waru)
wara mod waru the result is stored in wara
|
protected MersenneTwisterFactory.Polynomial |
PolynomialMult(MersenneTwisterFactory.Polynomial p0,
MersenneTwisterFactory.Polynomial p1)
multiplication
|
int |
proper_mersenne_exponent(int p) |
protected void |
pull_max(int i,
int v,
MersenneTwisterFactory.Vector vec)
exchange columns so that i-th element of variable vec gives the norm of
vec
|
protected void |
pull_min_row(int i,
int v,
MersenneTwisterFactory.Vector[] lattice)
puts i-th row be the minimum one in i-th row ...
|
protected int |
push_mask(int l,
int v,
long b,
long c,
long[] bbb,
long[] ccc) |
protected int |
push_stack(long b,
long c,
int v,
long[] bbb,
long[] ccc) |
protected void |
show_distrib(MersenneTwisterFactory.MTS mts) |
protected long |
TEMPERING_SHIFT_L(long y) |
protected long |
TEMPERING_SHIFT_S(long y) |
protected long |
TEMPERING_SHIFT_T(long y) |
protected long |
TEMPERING_SHIFT_U(long y) |
protected long |
word2bit(MersenneTwisterFactory.Polynomial pl)
Pack Polynomial into a word
|
public static final java.util.logging.Logger log
private static final long MAX_VALUE
protected static MersenneTwisterFactory instance
public static final int CHECK32_REDU
public static final int IRRED
public static final int LSB
public static final int WORDLEN
protected long upper_mask
protected long lower_mask
protected long word_mask
public static final int SSS
public static final int TTT
public static final int S00
public static final int S01
public static final int LIMIT_V_BEST_OPT
public static final int WORD_LEN
public static final int MIN_INFINITE
protected long[] bitmask
protected long[] cur_bitmask
protected long mask_b
protected long mask_c
protected long upper_v_bits
protected int shift_0
protected int shift_1
protected int shift_s
protected int shift_t
protected int mmm
protected int nnn
protected int rrr
protected int www
protected long[] aaa
protected long gupper_mask
protected long glower_mask
protected long greal_mask
protected int ggap
protected int[] gcur_maxlengs
protected long gmax_b
protected long gmax_c
public static final int N
public static final int M
public static final int MATRIX_A
public static final int UPPER_MASK
public static final int LOWER_MASK
public static final int TEMPERING_MASK_B
public static final int TEMPERING_MASK_C
protected long[] mt
protected int mti
public static final int NOT_REJECTED
public static final int REJECTED
public static final int LIMIT_IRRED_DEG
public static final int NIRREDPOLY
public static final int MAX_IRRED_DEG
public static final int PRESCR_REDU
public static final int NONREDU
protected int[][] irredpolylist
protected int sizeofA
protected long[][] modlist
protected MersenneTwisterFactory.Polynomial[] preModPolys
public static final int MAX_SEARCH
public static final int FOUND
public static final int NOT_FOUND
public static final int DEFAULT_ID_SIZE
public MersenneTwisterFactory(int seed)
seed
- Given seedjava.lang.IllegalArgumentException
- if seed < 0public static MersenneTwisterFactory getInstance()
public MersenneTwisterDC createMT(int p, int seed)
p
- given period exponentseed
- given seedpublic MersenneTwisterDC createMT(int p, int seed, int id)
p
- given period exponentseed
- given seedid
- given stream idpublic MersenneTwisterDC[] createMTArray(int p, int[] seeds)
p
- given period exponentseeds
- array of seedsprotected void _InitCheck32_dc(int r, int w)
protected int _CheckPeriod_dc(long a, int m, int n, int r, int w)
protected long LSB(long x)
protected void _get_tempering_parameter_dc(MersenneTwisterFactory.MTS mts)
mts
- Given MTSprotected void _get_tempering_parameter_hard_dc(MersenneTwisterFactory.MTS mts)
private int countMaskNodeLevels(MersenneTwisterFactory.MaskNode mn)
mn
- Given MaskNodeprotected void init_tempering(MersenneTwisterFactory.MTS mts)
protected MersenneTwisterFactory.MaskNode optimize_v_hard(int v, MersenneTwisterFactory.MaskNode prev_masks)
v
- given number of MaskNodesprev_masks
- given previous MaskNodesprotected void optimize_v(long b, long c, int v)
b
- Given long valuec
- Given long valuev
- Given number of bitmasksprotected int push_stack(long b, long c, int v, long[] bbb, long[] ccc)
protected int push_mask(int l, int v, long b, long c, long[] bbb, long[] ccc)
protected int lenstra(int v)
protected MersenneTwisterFactory.Vector new_Vector()
protected void free_lattice(MersenneTwisterFactory.Vector[] lattice, int v)
protected MersenneTwisterFactory.Vector mult(MersenneTwisterFactory.Vector v, int k)
protected void add(MersenneTwisterFactory.Vector u, MersenneTwisterFactory.Vector v)
protected int degree_of_vector(MersenneTwisterFactory.Vector v)
protected void add_i_to_j(MersenneTwisterFactory.Vector[] lattice, int i, int j, int k)
lattice
- i
- j
- protected void pull_max(int i, int v, MersenneTwisterFactory.Vector vec)
i
- Given element of Vector to contain the normv
- ?vec
- Given Vectorprotected void pull_min_row(int i, int v, MersenneTwisterFactory.Vector[] lattice)
i
- given starting rowv
- given ending rowlattice
- Given array of Vectorsprotected void hakidasi(int k, MersenneTwisterFactory.Vector[] lattice)
k
- given rowlattice
- given array of Vectorsprotected MersenneTwisterFactory.Vector[] make_lattice(int v)
v
- protected MersenneTwisterFactory.MaskNode cons_MaskNode(MersenneTwisterFactory.MaskNode head, long b, long c, int leng)
head
- b
- c
- leng
- protected void delete_MaskNodes(MersenneTwisterFactory.MaskNode head)
protected MersenneTwisterFactory.MaskNode delete_lower_MaskNodes(MersenneTwisterFactory.MaskNode head, int l)
protected void show_distrib(MersenneTwisterFactory.MTS mts)
protected void init_dc(int seed)
protected long TEMPERING_SHIFT_U(long y)
protected long TEMPERING_SHIFT_S(long y)
protected long TEMPERING_SHIFT_T(long y)
protected long TEMPERING_SHIFT_L(long y)
protected void _sgenrand_dc(long seed)
seed
- Given seedprotected long _genrand_dc()
protected int _prescreening_dc(long aaa)
protected void _InitPrescreening_dc(int m, int n, int r, int w)
protected void _EndPrescreening_dc()
protected void NextIrredPoly(MersenneTwisterFactory.Polynomial pl, int nth)
pl
- Given Polynomialnth
- "nth" irreducible Polynomialprotected void makemodlist(MersenneTwisterFactory.Polynomial pl, int nPoly)
protected long word2bit(MersenneTwisterFactory.Polynomial pl)
pl
- given Polynomialprotected int IsReducible(long aaa, long[] polylist)
aaa
- polylist
- protected MersenneTwisterFactory.Polynomial NewPoly(int degree)
degree
- Given degreeprotected MersenneTwisterFactory.Polynomial PolynomialMult(MersenneTwisterFactory.Polynomial p0, MersenneTwisterFactory.Polynomial p1)
p0
- first Polynomialp1
- second Polynomialprotected void PolynomialMod(MersenneTwisterFactory.Polynomial wara, MersenneTwisterFactory.Polynomial waru)
wara
- first Polynomialwaru
- second Polynomialprotected MersenneTwisterFactory.Polynomial PolynomialDup(MersenneTwisterFactory.Polynomial pl)
protected MersenneTwisterFactory.Polynomial make_tntm(int n, int m)
n
- first exponentm
- second exponentprotected void MakepreModPolys(int mm, int nn, int rr, int ww)
protected int get_irred_param(MersenneTwisterFactory.MTS mts, int id, int idw)
protected long nextA(int w)
protected long nextA_id(int w, int id, int idw)
protected void make_masks(int r, int w, MersenneTwisterFactory.MTS mts)
protected MersenneTwisterFactory.MTS init_mt_search(int w, int p)
protected void end_mt_search()
protected MersenneTwisterFactory.MTS get_mt_parameter(int w, int p)
protected MersenneTwisterFactory.MTS get_mt_parameter_id(int w, int p, int id)
public MersenneTwisterFactory.MTS[] get_mt_parameters(int w, int p, int max_id)
public MersenneTwisterFactory.MTS alloc_mt_struct(int n)
public void free_mt_struct(MersenneTwisterFactory.MTS mts)
public void delete_mt_array(int i, MersenneTwisterFactory.MTS[] mtss)
public void copy_params_of_mt_struct(MersenneTwisterFactory.MTS src, MersenneTwisterFactory.MTS dst)
public int proper_mersenne_exponent(int p)