OSDN Git Service

65f166253105666cf5916a28310da06f9185d8f6
[psychlops/cpp.git] / psychlops / core / math / dSFMT2.0 / dSFMT.h
1 #pragma once
2 /**
3  * @file dSFMT.h
4  *
5  * @brief double precision SIMD oriented Fast Mersenne Twister(dSFMT)
6  * pseudorandom number generator based on IEEE 754 format.
7  *
8  * @author Mutsuo Saito (Hiroshima University)
9  * @author Makoto Matsumoto (Hiroshima University)
10  *
11  * Copyright (C) 2007, 2008 Mutsuo Saito, Makoto Matsumoto and
12  * Hiroshima University. All rights reserved.
13  * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto,
14  * Hiroshima University and The University of Tokyo.
15  * All rights reserved.
16  *
17  * The new BSD License is applied to this software.
18  * see LICENSE.txt
19  *
20  * @note We assume that your system has inttypes.h.  If your system
21  * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t,
22  * and you have to define PRIu64 and PRIx64 in this file as follows:
23  * @verbatim
24  typedef unsigned int uint32_t
25  typedef unsigned long long uint64_t
26  #define PRIu64 "llu"
27  #define PRIx64 "llx"
28 @endverbatim
29  * uint32_t must be exactly 32-bit unsigned integer type (no more, no
30  * less), and uint64_t must be exactly 64-bit unsigned integer type.
31  * PRIu64 and PRIx64 are used for printf function to print 64-bit
32  * unsigned int and 64-bit unsigned int in hexadecimal format.
33  */
34
35 #ifndef DSFMT_H
36 #define DSFMT_H
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif
40
41 #include <stdio.h>
42 #include <assert.h>
43
44 #if !defined(DSFMT_MEXP)
45 #ifdef __GNUC__
46   #warning "DSFMT_MEXP is not defined. I assume DSFMT_MEXP is 19937."
47 #endif
48   #define DSFMT_MEXP 19937
49 #endif
50 /*-----------------
51   BASIC DEFINITIONS
52   -----------------*/
53 /* Mersenne Exponent. The period of the sequence
54  *  is a multiple of 2^DSFMT_MEXP-1.
55  * #define DSFMT_MEXP 19937 */
56 /** DSFMT generator has an internal state array of 128-bit integers,
57  * and N is its size. */
58 #define DSFMT_N ((DSFMT_MEXP - 128) / 104 + 1)
59 /** N32 is the size of internal state array when regarded as an array
60  * of 32-bit integers.*/
61 #define DSFMT_N32 (DSFMT_N * 4)
62 /** N64 is the size of internal state array when regarded as an array
63  * of 64-bit integers.*/
64 #define DSFMT_N64 (DSFMT_N * 2)
65
66 #if !defined(DSFMT_BIG_ENDIAN)
67 #  if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN)
68 #    if __BYTE_ORDER == __BIG_ENDIAN
69 #      define DSFMT_BIG_ENDIAN 1
70 #    endif
71 #  elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN)
72 #    if _BYTE_ORDER == _BIG_ENDIAN
73 #      define DSFMT_BIG_ENDIAN 1
74 #    endif
75 #  elif defined(__BYTE_ORDER__) && defined(__BIG_ENDIAN__)
76 #    if __BYTE_ORDER__ == __BIG_ENDIAN__
77 #      define DSFMT_BIG_ENDIAN 1
78 #    endif
79 #  elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
80 #    if BYTE_ORDER == BIG_ENDIAN
81 #      define DSFMT_BIG_ENDIAN 1
82 #    endif
83 #  elif defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN) \
84     || defined(__BIG_ENDIAN__) || defined(BIG_ENDIAN)
85 #      define DSFMT_BIG_ENDIAN 1
86 #  endif
87 #endif
88
89 #if defined(DSFMT_BIG_ENDIAN) && defined(__amd64)
90 #  undef DSFMT_BIG_ENDIAN
91 #endif
92
93 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
94 #  include <inttypes.h>
95 #elif defined(_MSC_VER) || defined(__BORLANDC__)
96 #  if !defined(DSFMT_UINT32_DEFINED) && !defined(SFMT_UINT32_DEFINED)
97 typedef unsigned int uint32_t;
98 typedef unsigned __int64 uint64_t;
99 #    ifndef UINT64_C
100 #      define UINT64_C(v) (v ## ui64)
101 #    endif
102 #    define DSFMT_UINT32_DEFINED
103 #    if !defined(inline) && !defined(__cplusplus)
104 #      define inline __inline
105 #    endif
106 #  endif
107 #else
108 #  include <inttypes.h>
109 #  if !defined(inline) && !defined(__cplusplus)
110 #    if defined(__GNUC__)
111 #      define inline __inline__
112 #    else
113 #      define inline
114 #    endif
115 #  endif
116 #endif
117
118 #ifndef PRIu64
119 #  if defined(_MSC_VER) || defined(__BORLANDC__)
120 #    define PRIu64 "I64u"
121 #    define PRIx64 "I64x"
122 #  else
123 #    define PRIu64 "llu"
124 #    define PRIx64 "llx"
125 #  endif
126 #endif
127
128 #ifndef UINT64_C
129 #  define UINT64_C(v) (v ## ULL)
130 #endif
131
132 /*------------------------------------------
133   128-bit SIMD like data type for standard C
134   ------------------------------------------*/
135 #if defined(HAVE_ALTIVEC)
136 #  if !defined(__APPLE__)
137 #    include <altivec.h>
138 #  endif
139 /** 128-bit data structure */
140 union W128_T {
141     vector unsigned int s;
142     uint64_t u[2];
143     uint32_t u32[4];
144     double d[2];
145 };
146
147 #elif defined(HAVE_SSE2)
148 #  include <emmintrin.h>
149
150 /** 128-bit data structure */
151 union W128_T {
152     __m128i si;
153     __m128d sd;
154     uint64_t u[2];
155     uint32_t u32[4];
156     double d[2];
157 };
158 #else  /* standard C */
159 /** 128-bit data structure */
160 union W128_T {
161     uint64_t u[2];
162     uint32_t u32[4];
163     double d[2];
164 };
165 #endif
166
167 /** 128-bit data type */
168 typedef union W128_T w128_t;
169
170 /** the 128-bit internal state array */
171 struct DSFMT_T {
172     w128_t status[DSFMT_N + 1];
173     int idx;
174 };
175 typedef struct DSFMT_T dsfmt_t;
176
177 /** dsfmt internal state vector */
178 extern dsfmt_t dsfmt_global_data;
179 /** dsfmt mexp for check */
180 extern const int dsfmt_global_mexp;
181
182 void dsfmt_gen_rand_all(dsfmt_t *dsfmt);
183 void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size);
184 void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size);
185 void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size);
186 void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size);
187 void dsfmt_chk_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed, int mexp);
188 void dsfmt_chk_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
189                              int key_length, int mexp);
190 const char *dsfmt_get_idstring(void);
191 int dsfmt_get_min_array_size(void);
192
193 #if defined(__GNUC__)
194 #  define DSFMT_PRE_INLINE inline static
195 #  define DSFMT_PST_INLINE __attribute__((always_inline))
196 #elif defined(_MSC_VER) && _MSC_VER >= 1200
197 #  define DSFMT_PRE_INLINE __forceinline static
198 #  define DSFMT_PST_INLINE
199 #else
200 #  define DSFMT_PRE_INLINE inline static
201 #  define DSFMT_PST_INLINE
202 #endif
203 DSFMT_PRE_INLINE uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) DSFMT_PST_INLINE;
204 DSFMT_PRE_INLINE double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt)
205     DSFMT_PST_INLINE;
206 DSFMT_PRE_INLINE double dsfmt_genrand_close_open(dsfmt_t *dsfmt)
207     DSFMT_PST_INLINE;
208 DSFMT_PRE_INLINE double dsfmt_genrand_open_close(dsfmt_t *dsfmt)
209     DSFMT_PST_INLINE;
210 DSFMT_PRE_INLINE double dsfmt_genrand_open_open(dsfmt_t *dsfmt)
211     DSFMT_PST_INLINE;
212 DSFMT_PRE_INLINE uint32_t dsfmt_gv_genrand_uint32(void) DSFMT_PST_INLINE;
213 DSFMT_PRE_INLINE double dsfmt_gv_genrand_close1_open2(void) DSFMT_PST_INLINE;
214 DSFMT_PRE_INLINE double dsfmt_gv_genrand_close_open(void) DSFMT_PST_INLINE;
215 DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_close(void) DSFMT_PST_INLINE;
216 DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_open(void) DSFMT_PST_INLINE;
217 DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_close(double array[], int size)
218     DSFMT_PST_INLINE;
219 DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close_open(double array[], int size)
220     DSFMT_PST_INLINE;
221 DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_open(double array[], int size)
222     DSFMT_PST_INLINE;
223 DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close1_open2(double array[], int size)
224     DSFMT_PST_INLINE;
225 DSFMT_PRE_INLINE void dsfmt_gv_init_gen_rand(uint32_t seed) DSFMT_PST_INLINE;
226 DSFMT_PRE_INLINE void dsfmt_gv_init_by_array(uint32_t init_key[],
227                                              int key_length) DSFMT_PST_INLINE;
228 DSFMT_PRE_INLINE void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed)
229     DSFMT_PST_INLINE;
230 DSFMT_PRE_INLINE void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
231                                           int key_length) DSFMT_PST_INLINE;
232
233 /**
234  * This function generates and returns unsigned 32-bit integer.
235  * This is slower than SFMT, only for convenience usage.
236  * dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called
237  * before this function.
238  * @param dsfmt dsfmt internal state date
239  * @return double precision floating point pseudorandom number
240  */
241 inline static uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) {
242     uint32_t r;
243     uint64_t *psfmt64 = &dsfmt->status[0].u[0];
244
245     if (dsfmt->idx >= DSFMT_N64) {
246         dsfmt_gen_rand_all(dsfmt);
247         dsfmt->idx = 0;
248     }
249     r = psfmt64[dsfmt->idx++] & 0xffffffffU;
250     return r;
251 }
252
253 /**
254  * This function generates and returns double precision pseudorandom
255  * number which distributes uniformly in the range [1, 2).  This is
256  * the primitive and faster than generating numbers in other ranges.
257  * dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called
258  * before this function.
259  * @param dsfmt dsfmt internal state date
260  * @return double precision floating point pseudorandom number
261  */
262 inline static double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt) {
263     double r;
264     double *psfmt64 = &dsfmt->status[0].d[0];
265
266     if (dsfmt->idx >= DSFMT_N64) {
267         dsfmt_gen_rand_all(dsfmt);
268         dsfmt->idx = 0;
269     }
270     r = psfmt64[dsfmt->idx++];
271     return r;
272 }
273
274 /**
275  * This function generates and returns unsigned 32-bit integer.
276  * This is slower than SFMT, only for convenience usage.
277  * dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called
278  * before this function.  This function uses \b global variables.
279  * @return double precision floating point pseudorandom number
280  */
281 inline static uint32_t dsfmt_gv_genrand_uint32(void) {
282     return dsfmt_genrand_uint32(&dsfmt_global_data);
283 }
284
285 /**
286  * This function generates and returns double precision pseudorandom
287  * number which distributes uniformly in the range [1, 2).
288  * dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called
289  * before this function. This function uses \b global variables.
290  * @return double precision floating point pseudorandom number
291  */
292 inline static double dsfmt_gv_genrand_close1_open2(void) {
293     return dsfmt_genrand_close1_open2(&dsfmt_global_data);
294 }
295
296 /**
297  * This function generates and returns double precision pseudorandom
298  * number which distributes uniformly in the range [0, 1).
299  * dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called
300  * before this function.
301  * @param dsfmt dsfmt internal state date
302  * @return double precision floating point pseudorandom number
303  */
304 inline static double dsfmt_genrand_close_open(dsfmt_t *dsfmt) {
305     return dsfmt_genrand_close1_open2(dsfmt) - 1.0;
306 }
307
308 /**
309  * This function generates and returns double precision pseudorandom
310  * number which distributes uniformly in the range [0, 1).
311  * dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called
312  * before this function. This function uses \b global variables.
313  * @return double precision floating point pseudorandom number
314  */
315 inline static double dsfmt_gv_genrand_close_open(void) {
316     return dsfmt_gv_genrand_close1_open2() - 1.0;
317 }
318
319 /**
320  * This function generates and returns double precision pseudorandom
321  * number which distributes uniformly in the range (0, 1].
322  * dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called
323  * before this function.
324  * @param dsfmt dsfmt internal state date
325  * @return double precision floating point pseudorandom number
326  */
327 inline static double dsfmt_genrand_open_close(dsfmt_t *dsfmt) {
328     return 2.0 - dsfmt_genrand_close1_open2(dsfmt);
329 }
330
331 /**
332  * This function generates and returns double precision pseudorandom
333  * number which distributes uniformly in the range (0, 1].
334  * dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called
335  * before this function. This function uses \b global variables.
336  * @return double precision floating point pseudorandom number
337  */
338 inline static double dsfmt_gv_genrand_open_close(void) {
339     return 2.0 - dsfmt_gv_genrand_close1_open2();
340 }
341
342 /**
343  * This function generates and returns double precision pseudorandom
344  * number which distributes uniformly in the range (0, 1).
345  * dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called
346  * before this function.
347  * @param dsfmt dsfmt internal state date
348  * @return double precision floating point pseudorandom number
349  */
350 inline static double dsfmt_genrand_open_open(dsfmt_t *dsfmt) {
351     double *dsfmt64 = &dsfmt->status[0].d[0];
352     union {
353         double d;
354         uint64_t u;
355     } r;
356
357     if (dsfmt->idx >= DSFMT_N64) {
358         dsfmt_gen_rand_all(dsfmt);
359         dsfmt->idx = 0;
360     }
361     r.d = dsfmt64[dsfmt->idx++];
362     r.u |= 1;
363     return r.d - 1.0;
364 }
365
366 /**
367  * This function generates and returns double precision pseudorandom
368  * number which distributes uniformly in the range (0, 1).
369  * dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called
370  * before this function. This function uses \b global variables.
371  * @return double precision floating point pseudorandom number
372  */
373 inline static double dsfmt_gv_genrand_open_open(void) {
374     return dsfmt_genrand_open_open(&dsfmt_global_data);
375 }
376
377 /**
378  * This function generates double precision floating point
379  * pseudorandom numbers which distribute in the range [1, 2) to the
380  * specified array[] by one call. This function is the same as
381  * dsfmt_fill_array_close1_open2() except that this function uses
382  * \b global variables.
383  * @param array an array where pseudorandom numbers are filled
384  * by this function.
385  * @param size the number of pseudorandom numbers to be generated.
386  * see also \sa dsfmt_fill_array_close1_open2()
387  */
388 inline static void dsfmt_gv_fill_array_close1_open2(double array[], int size) {
389     dsfmt_fill_array_close1_open2(&dsfmt_global_data, array, size);
390 }
391
392 /**
393  * This function generates double precision floating point
394  * pseudorandom numbers which distribute in the range (0, 1] to the
395  * specified array[] by one call. This function is the same as
396  * dsfmt_gv_fill_array_close1_open2() except the distribution range.
397  * This function uses \b global variables.
398  * @param array an array where pseudorandom numbers are filled
399  * by this function.
400  * @param size the number of pseudorandom numbers to be generated.
401  * see also \sa dsfmt_fill_array_close1_open2() and \sa
402  * dsfmt_gv_fill_array_close1_open2()
403  */
404 inline static void dsfmt_gv_fill_array_open_close(double array[], int size) {
405     dsfmt_fill_array_open_close(&dsfmt_global_data, array, size);
406 }
407
408 /**
409  * This function generates double precision floating point
410  * pseudorandom numbers which distribute in the range [0, 1) to the
411  * specified array[] by one call. This function is the same as
412  * dsfmt_gv_fill_array_close1_open2() except the distribution range.
413  * This function uses \b global variables.
414  * @param array an array where pseudorandom numbers are filled
415  * by this function.
416  * @param size the number of pseudorandom numbers to be generated.
417  * see also \sa dsfmt_fill_array_close1_open2() \sa
418  * dsfmt_gv_fill_array_close1_open2()
419  */
420 inline static void dsfmt_gv_fill_array_close_open(double array[], int size) {
421     dsfmt_fill_array_close_open(&dsfmt_global_data, array, size);
422 }
423
424 /**
425  * This function generates double precision floating point
426  * pseudorandom numbers which distribute in the range (0, 1) to the
427  * specified array[] by one call. This function is the same as
428  * dsfmt_gv_fill_array_close1_open2() except the distribution range.
429  * This function uses \b global variables.
430  * @param array an array where pseudorandom numbers are filled
431  * by this function.
432  * @param size the number of pseudorandom numbers to be generated.
433  * see also \sa dsfmt_fill_array_close1_open2() \sa
434  * dsfmt_gv_fill_array_close1_open2()
435  */
436 inline static void dsfmt_gv_fill_array_open_open(double array[], int size) {
437     dsfmt_fill_array_open_open(&dsfmt_global_data, array, size);
438 }
439
440 /**
441  * This function initializes the internal state array with a 32-bit
442  * integer seed.
443  * @param dsfmt dsfmt state vector.
444  * @param seed a 32-bit integer used as the seed.
445  */
446 inline static void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed) {
447     dsfmt_chk_init_gen_rand(dsfmt, seed, DSFMT_MEXP);
448 }
449
450 /**
451  * This function initializes the internal state array with a 32-bit
452  * integer seed. This function uses \b global variables.
453  * @param seed a 32-bit integer used as the seed.
454  * see also \sa dsfmt_init_gen_rand()
455  */
456 inline static void dsfmt_gv_init_gen_rand(uint32_t seed) {
457     dsfmt_init_gen_rand(&dsfmt_global_data, seed);
458 }
459
460 /**
461  * This function initializes the internal state array,
462  * with an array of 32-bit integers used as the seeds.
463  * @param dsfmt dsfmt state vector
464  * @param init_key the array of 32-bit integers, used as a seed.
465  * @param key_length the length of init_key.
466  */
467 inline static void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
468                                        int key_length) {
469     dsfmt_chk_init_by_array(dsfmt, init_key, key_length, DSFMT_MEXP);
470 }
471
472 /**
473  * This function initializes the internal state array,
474  * with an array of 32-bit integers used as the seeds.
475  * This function uses \b global variables.
476  * @param init_key the array of 32-bit integers, used as a seed.
477  * @param key_length the length of init_key.
478  * see also \sa dsfmt_init_by_array()
479  */
480 inline static void dsfmt_gv_init_by_array(uint32_t init_key[], int key_length) {
481     dsfmt_init_by_array(&dsfmt_global_data, init_key, key_length);
482 }
483
484 #if !defined(DSFMT_DO_NOT_USE_OLD_NAMES)
485 DSFMT_PRE_INLINE const char *get_idstring(void) DSFMT_PST_INLINE;
486 DSFMT_PRE_INLINE int get_min_array_size(void) DSFMT_PST_INLINE;
487 DSFMT_PRE_INLINE void init_gen_rand(uint32_t seed) DSFMT_PST_INLINE;
488 DSFMT_PRE_INLINE void init_by_array(uint32_t init_key[], int key_length)
489     DSFMT_PST_INLINE;
490 DSFMT_PRE_INLINE double genrand_close1_open2(void) DSFMT_PST_INLINE;
491 DSFMT_PRE_INLINE double genrand_close_open(void) DSFMT_PST_INLINE;
492 DSFMT_PRE_INLINE double genrand_open_close(void) DSFMT_PST_INLINE;
493 DSFMT_PRE_INLINE double genrand_open_open(void) DSFMT_PST_INLINE;
494 DSFMT_PRE_INLINE void fill_array_open_close(double array[], int size)
495     DSFMT_PST_INLINE;
496 DSFMT_PRE_INLINE void fill_array_close_open(double array[], int size)
497     DSFMT_PST_INLINE;
498 DSFMT_PRE_INLINE void fill_array_open_open(double array[], int size)
499     DSFMT_PST_INLINE;
500 DSFMT_PRE_INLINE void fill_array_close1_open2(double array[], int size)
501     DSFMT_PST_INLINE;
502
503 /**
504  * This function is just the same as dsfmt_get_idstring().
505  * @return id string.
506  * see also \sa dsfmt_get_idstring()
507  */
508 inline static const char *get_idstring(void) {
509     return dsfmt_get_idstring();
510 }
511
512 /**
513  * This function is just the same as dsfmt_get_min_array_size().
514  * @return minimum size of array used for fill_array functions.
515  * see also \sa dsfmt_get_min_array_size()
516  */
517 inline static int get_min_array_size(void) {
518     return dsfmt_get_min_array_size();
519 }
520
521 /**
522  * This function is just the same as dsfmt_gv_init_gen_rand().
523  * @param seed a 32-bit integer used as the seed.
524  * see also \sa dsfmt_gv_init_gen_rand(), \sa dsfmt_init_gen_rand().
525  */
526 inline static void init_gen_rand(uint32_t seed) {
527     dsfmt_gv_init_gen_rand(seed);
528 }
529
530 /**
531  * This function is just the same as dsfmt_gv_init_by_array().
532  * @param init_key the array of 32-bit integers, used as a seed.
533  * @param key_length the length of init_key.
534  * see also \sa dsfmt_gv_init_by_array(), \sa dsfmt_init_by_array().
535  */
536 inline static void init_by_array(uint32_t init_key[], int key_length) {
537     dsfmt_gv_init_by_array(init_key, key_length);
538 }
539
540 /**
541  * This function is just the same as dsfmt_gv_genrand_close1_open2().
542  * @return double precision floating point number.
543  * see also \sa dsfmt_genrand_close1_open2() \sa
544  * dsfmt_gv_genrand_close1_open2()
545  */
546 inline static double genrand_close1_open2(void) {
547     return dsfmt_gv_genrand_close1_open2();
548 }
549
550 /**
551  * This function is just the same as dsfmt_gv_genrand_close_open().
552  * @return double precision floating point number.
553  * see also \sa dsfmt_genrand_close_open() \sa
554  * dsfmt_gv_genrand_close_open()
555  */
556 inline static double genrand_close_open(void) {
557     return dsfmt_gv_genrand_close_open();
558 }
559
560 /**
561  * This function is just the same as dsfmt_gv_genrand_open_close().
562  * @return double precision floating point number.
563  * see also \sa dsfmt_genrand_open_close() \sa
564  * dsfmt_gv_genrand_open_close()
565  */
566 inline static double genrand_open_close(void) {
567     return dsfmt_gv_genrand_open_close();
568 }
569
570 /**
571  * This function is just the same as dsfmt_gv_genrand_open_open().
572  * @return double precision floating point number.
573  * see also \sa dsfmt_genrand_open_open() \sa
574  * dsfmt_gv_genrand_open_open()
575  */
576 inline static double genrand_open_open(void) {
577     return dsfmt_gv_genrand_open_open();
578 }
579
580 /**
581  * This function is juset the same as dsfmt_gv_fill_array_open_close().
582  * @param array an array where pseudorandom numbers are filled
583  * by this function.
584  * @param size the number of pseudorandom numbers to be generated.
585  * see also \sa dsfmt_gv_fill_array_open_close(), \sa
586  * dsfmt_fill_array_close1_open2(), \sa
587  * dsfmt_gv_fill_array_close1_open2()
588  */
589 inline static void fill_array_open_close(double array[], int size) {
590     dsfmt_gv_fill_array_open_close(array, size);
591 }
592
593 /**
594  * This function is juset the same as dsfmt_gv_fill_array_close_open().
595  * @param array an array where pseudorandom numbers are filled
596  * by this function.
597  * @param size the number of pseudorandom numbers to be generated.
598  * see also \sa dsfmt_gv_fill_array_close_open(), \sa
599  * dsfmt_fill_array_close1_open2(), \sa
600  * dsfmt_gv_fill_array_close1_open2()
601  */
602 inline static void fill_array_close_open(double array[], int size) {
603     dsfmt_gv_fill_array_close_open(array, size);
604 }
605
606 /**
607  * This function is juset the same as dsfmt_gv_fill_array_open_open().
608  * @param array an array where pseudorandom numbers are filled
609  * by this function.
610  * @param size the number of pseudorandom numbers to be generated.
611  * see also \sa dsfmt_gv_fill_array_open_open(), \sa
612  * dsfmt_fill_array_close1_open2(), \sa
613  * dsfmt_gv_fill_array_close1_open2()
614  */
615 inline static void fill_array_open_open(double array[], int size) {
616     dsfmt_gv_fill_array_open_open(array, size);
617 }
618
619 /**
620  * This function is juset the same as dsfmt_gv_fill_array_close1_open2().
621  * @param array an array where pseudorandom numbers are filled
622  * by this function.
623  * @param size the number of pseudorandom numbers to be generated.
624  * see also \sa dsfmt_fill_array_close1_open2(), \sa
625  * dsfmt_gv_fill_array_close1_open2()
626  */
627 inline static void fill_array_close1_open2(double array[], int size) {
628     dsfmt_gv_fill_array_close1_open2(array, size);
629 }
630 #endif /* DSFMT_DO_NOT_USE_OLD_NAMES */
631
632 #if defined(__cplusplus)
633 }
634 #endif
635
636 #endif /* DSFMT_H */