INGOR
Loading...
Searching...
No Matches
ytRNG_dSFMT-params.h
1/*
2 ytRNG_dSMFT-params.h : Random number generator
3
4 This is the wrapper source code of the dSFMT for ytLib.
5
6 dSFMT ORIGINAL LICENSE
7
8 Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
9 University.
10 Copyright (c) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima University
11 and The University of Tokyo.
12 All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are
16 met:
17
18 * Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20 * Redistributions in binary form must reproduce the above
21 copyright notice, this list of conditions and the following
22 disclaimer in the documentation and/or other materials provided
23 with the distribution.
24 * Neither the names of Hiroshima University, The University of
25 Tokyo nor the names of its contributors may be used to endorse
26 or promote products derived from this software without specific
27 prior written permission.
28
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40*/
41
42#ifndef __YTLIB_RNG_DSFMT_PARAMS_H
43#define __YTLIB_RNG_DSFMT_PARAMS_H
44
45#include "ytRNG_dSFMT.h"
46
47/*----------------------
48 the parameters of DSFMT
49 following definitions are in dSFMT-paramsXXXX.h file.
50 ----------------------*/
74#define DSFMT_LOW_MASK UINT64_C(0x000FFFFFFFFFFFFF)
75#define DSFMT_HIGH_CONST UINT64_C(0x3FF0000000000000)
76#define DSFMT_SR 12
77
78/* for sse2 */
79#if defined(HAVE_SSE2)
80 #define SSE2_SHUFF 0x1b
81#elif defined(HAVE_ALTIVEC)
82 #if defined(__APPLE__) /* For OSX */
83 #define ALTI_SR (vector unsigned char)(4)
84 #define ALTI_SR_PERM \
85 (vector unsigned char)(15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14)
86 #define ALTI_SR_MSK \
87 (vector unsigned int)(0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU)
88 #define ALTI_PERM \
89 (vector unsigned char)(12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3)
90 #else
91 #define ALTI_SR {4}
92 #define ALTI_SR_PERM {15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14}
93 #define ALTI_SR_MSK {0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU}
94 #define ALTI_PERM {12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3}
95 #endif
96#endif
97
98#if DSFMT_MEXP == 521
99 #include "dSFMT-params521.h"
100#elif DSFMT_MEXP == 1279
101 #include "dSFMT-params1279.h"
102#elif DSFMT_MEXP == 2203
103 #include "dSFMT-params2203.h"
104#elif DSFMT_MEXP == 4253
105 #include "dSFMT-params4253.h"
106#elif DSFMT_MEXP == 11213
107 #include "dSFMT-params11213.h"
108#elif DSFMT_MEXP == 19937
109 #include "ytRNG_dSFMT-params19937.h"
110#elif DSFMT_MEXP == 44497
111 #include "dSFMT-params44497.h"
112#elif DSFMT_MEXP == 86243
113 #include "dSFMT-params86243.h"
114#elif DSFMT_MEXP == 132049
115 #include "dSFMT-params132049.h"
116#elif DSFMT_MEXP == 216091
117 #include "dSFMT-params216091.h"
118#else
119#ifdef __GNUC__
120 #error "DSFMT_MEXP is not valid."
121 #undef DSFMT_MEXP
122#else
123 #undef DSFMT_MEXP
124#endif
125
126#endif
127
128#endif /* __YTLIB_RNG_DSFMT_PARAMS_H */