Coverage Report

Created: 2024-08-18 16:21

/home/liu/actions-runner/_work/ccv/ccv/lib/3rdparty/sfmt/SFMT.h
Line
Count
Source (jump to first uncovered line)
1
#pragma once
2
/**
3
 * @file SFMT.h
4
 *
5
 * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom
6
 * number generator using C structure.
7
 *
8
 * @author Mutsuo Saito (Hiroshima University)
9
 * @author Makoto Matsumoto (The University of Tokyo)
10
 *
11
 * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
12
 * University.
13
 * Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima
14
 * University and The University of Tokyo.
15
 * All rights reserved.
16
 *
17
 * The 3-clause BSD License is applied to this software, see
18
 * 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 SFMTST_H
36
#define SFMTST_H
37
#if defined(__cplusplus)
38
extern "C" {
39
#endif
40
41
#include <stdio.h>
42
#include <assert.h>
43
44
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
45
  #include <inttypes.h>
46
#elif defined(_MSC_VER) || defined(__BORLANDC__)
47
  typedef unsigned int uint32_t;
48
  typedef unsigned __int64 uint64_t;
49
  #define inline __inline
50
#else
51
  #include <inttypes.h>
52
  #if defined(__GNUC__)
53
    #define inline __inline__
54
  #endif
55
#endif
56
57
#ifndef PRIu64
58
  #if defined(_MSC_VER) || defined(__BORLANDC__)
59
    #define PRIu64 "I64u"
60
    #define PRIx64 "I64x"
61
  #else
62
    #define PRIu64 "llu"
63
    #define PRIx64 "llx"
64
  #endif
65
#endif
66
67
#include "SFMT-params.h"
68
69
/*------------------------------------------
70
  128-bit SIMD like data type for standard C
71
  ------------------------------------------*/
72
#if defined(HAVE_ALTIVEC)
73
  #if !defined(__APPLE__)
74
    #include <altivec.h>
75
  #endif
76
/** 128-bit data structure */
77
union W128_T {
78
    vector unsigned int s;
79
    uint32_t u[4];
80
    uint64_t u64[2];
81
};
82
#elif defined(HAVE_SSE2)
83
  #include <emmintrin.h>
84
85
/** 128-bit data structure */
86
union W128_T {
87
    uint32_t u[4];
88
    uint64_t u64[2];
89
    __m128i si;
90
};
91
#else
92
/** 128-bit data structure */
93
union W128_T {
94
    uint32_t u[4];
95
    uint64_t u64[2];
96
};
97
#endif
98
99
/** 128-bit data type */
100
typedef union W128_T w128_t;
101
102
/**
103
 * SFMT internal state
104
 */
105
struct SFMT_T {
106
    /** the 128-bit internal state array */
107
    w128_t state[SFMT_N];
108
    /** index counter to the 32-bit internal state array */
109
    int idx;
110
};
111
112
typedef struct SFMT_T sfmt_t;
113
114
void sfmt_fill_array32(sfmt_t * sfmt, uint32_t * array, int size);
115
void sfmt_fill_array64(sfmt_t * sfmt, uint64_t * array, int size);
116
void sfmt_init_gen_rand(sfmt_t * sfmt, uint32_t seed);
117
void sfmt_init_by_array(sfmt_t * sfmt, uint32_t * init_key, int key_length);
118
const char * sfmt_get_idstring(sfmt_t * sfmt);
119
int sfmt_get_min_array_size32(sfmt_t * sfmt);
120
int sfmt_get_min_array_size64(sfmt_t * sfmt);
121
void sfmt_gen_rand_all(sfmt_t * sfmt);
122
void sfmt_genrand_shuffle(sfmt_t * sfmt, void *array, int size, int rsize);
123
124
#ifndef ONLY64
125
/**
126
 * This function generates and returns 32-bit pseudorandom number.
127
 * init_gen_rand or init_by_array must be called before this function.
128
 * @param sfmt SFMT internal state
129
 * @return 32-bit pseudorandom number
130
 */
131
1.65M
inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) {
132
1.65M
    uint32_t r;
133
1.65M
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
134
135
1.65M
    if (sfmt->idx >= SFMT_N32) {
136
150k
  sfmt_gen_rand_all(sfmt);
137
150k
  sfmt->idx = 0;
138
150k
    }
139
1.65M
    r = psfmt32[sfmt->idx++];
140
1.65M
    return r;
141
1.65M
}
util.tests.c:sfmt_genrand_uint32
Line
Count
Source
131
1.15k
inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) {
132
1.15k
    uint32_t r;
133
1.15k
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
134
135
1.15k
    if (sfmt->idx >= SFMT_N32) {
136
5
  sfmt_gen_rand_all(sfmt);
137
5
  sfmt->idx = 0;
138
5
    }
139
1.15k
    r = psfmt32[sfmt->idx++];
140
1.15k
    return r;
141
1.15k
}
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_uint32
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_uint32
Unexecuted instantiation: tape.tests.c:sfmt_genrand_uint32
SFMT.c:sfmt_genrand_uint32
Line
Count
Source
131
600k
inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) {
132
600k
    uint32_t r;
133
600k
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
134
135
600k
    if (sfmt->idx >= SFMT_N32) {
136
1
  sfmt_gen_rand_all(sfmt);
137
1
  sfmt->idx = 0;
138
1
    }
139
600k
    r = psfmt32[sfmt->idx++];
140
600k
    return r;
141
600k
}
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_uint32
ccv_nnc_stream.c:sfmt_genrand_uint32
Line
Count
Source
131
346
inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) {
132
346
    uint32_t r;
133
346
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
134
135
346
    if (sfmt->idx >= SFMT_N32) {
136
12
  sfmt_gen_rand_all(sfmt);
137
12
  sfmt->idx = 0;
138
12
    }
139
346
    r = psfmt32[sfmt->idx++];
140
346
    return r;
141
346
}
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_uint32
ccv_cnnp_dataframe_addons.c:sfmt_genrand_uint32
Line
Count
Source
131
1.05M
inline static uint32_t sfmt_genrand_uint32(sfmt_t * sfmt) {
132
1.05M
    uint32_t r;
133
1.05M
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
134
135
1.05M
    if (sfmt->idx >= SFMT_N32) {
136
150k
  sfmt_gen_rand_all(sfmt);
137
150k
  sfmt->idx = 0;
138
150k
    }
139
1.05M
    r = psfmt32[sfmt->idx++];
140
1.05M
    return r;
141
1.05M
}
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_uint32
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_uint32
142
#endif
143
/**
144
 * This function generates and returns 64-bit pseudorandom number.
145
 * init_gen_rand or init_by_array must be called before this function.
146
 * The function gen_rand64 should not be called after gen_rand32,
147
 * unless an initialization is again executed.
148
 * @param sfmt SFMT internal state
149
 * @return 64-bit pseudorandom number
150
 */
151
0
inline static uint64_t sfmt_genrand_uint64(sfmt_t * sfmt) {
152
0
#if defined(BIG_ENDIAN64) && !defined(ONLY64)
153
0
    uint32_t * psfmt32 = &sfmt->state[0].u[0];
154
0
    uint32_t r1, r2;
155
0
#else
156
0
    uint64_t r;
157
0
#endif
158
0
    uint64_t * psfmt64 = &sfmt->state[0].u64[0];
159
0
    assert(sfmt->idx % 2 == 0);
160
0
161
0
    if (sfmt->idx >= SFMT_N32) {
162
0
  sfmt_gen_rand_all(sfmt);
163
0
  sfmt->idx = 0;
164
0
    }
165
0
#if defined(BIG_ENDIAN64) && !defined(ONLY64)
166
0
    r1 = psfmt32[sfmt->idx];
167
0
    r2 = psfmt32[sfmt->idx + 1];
168
0
    sfmt->idx += 2;
169
0
    return ((uint64_t)r2 << 32) | r1;
170
0
#else
171
0
    r = psfmt64[sfmt->idx / 2];
172
0
    sfmt->idx += 2;
173
0
    return r;
174
0
#endif
175
0
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_uint64
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_uint64
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_uint64
Unexecuted instantiation: tape.tests.c:sfmt_genrand_uint64
Unexecuted instantiation: SFMT.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_uint64
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_uint64
176
177
/* =================================================
178
   The following real versions are due to Isaku Wada
179
   ================================================= */
180
/**
181
 * converts an unsigned 32-bit number to a double on [0,1]-real-interval.
182
 * @param v 32-bit unsigned integer
183
 * @return double on [0,1]-real-interval
184
 */
185
inline static double sfmt_to_real1(uint32_t v)
186
750k
{
187
750k
    return v * (1.0/4294967295.0);
188
    /* divided by 2^32-1 */
189
750k
}
Unexecuted instantiation: util.tests.c:sfmt_to_real1
Unexecuted instantiation: 3rdparty.tests.c:sfmt_to_real1
Unexecuted instantiation: while.backward.tests.c:sfmt_to_real1
Unexecuted instantiation: tape.tests.c:sfmt_to_real1
Unexecuted instantiation: SFMT.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_to_real1
ccv_cnnp_dataframe_addons.c:sfmt_to_real1
Line
Count
Source
186
750k
{
187
750k
    return v * (1.0/4294967295.0);
188
    /* divided by 2^32-1 */
189
750k
}
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_to_real1
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_to_real1
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_to_real1
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_to_real1
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_to_real1
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_to_real1
190
191
/**
192
 * generates a random number on [0,1]-real-interval
193
 * @param sfmt SFMT internal state
194
 * @return double on [0,1]-real-interval
195
 */
196
inline static double sfmt_genrand_real1(sfmt_t * sfmt)
197
750k
{
198
750k
    return sfmt_to_real1(sfmt_genrand_uint32(sfmt));
199
750k
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_real1
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_real1
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_real1
Unexecuted instantiation: tape.tests.c:sfmt_genrand_real1
Unexecuted instantiation: SFMT.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_real1
ccv_cnnp_dataframe_addons.c:sfmt_genrand_real1
Line
Count
Source
197
750k
{
198
750k
    return sfmt_to_real1(sfmt_genrand_uint32(sfmt));
199
750k
}
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_real1
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_real1
200
201
/**
202
 * converts an unsigned 32-bit integer to a double on [0,1)-real-interval.
203
 * @param v 32-bit unsigned integer
204
 * @return double on [0,1)-real-interval
205
 */
206
inline static double sfmt_to_real2(uint32_t v)
207
0
{
208
0
    return v * (1.0/4294967296.0);
209
0
    /* divided by 2^32 */
210
0
}
Unexecuted instantiation: util.tests.c:sfmt_to_real2
Unexecuted instantiation: 3rdparty.tests.c:sfmt_to_real2
Unexecuted instantiation: while.backward.tests.c:sfmt_to_real2
Unexecuted instantiation: tape.tests.c:sfmt_to_real2
Unexecuted instantiation: SFMT.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_to_real2
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_to_real2
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_to_real2
211
212
/**
213
 * generates a random number on [0,1)-real-interval
214
 * @param sfmt SFMT internal state
215
 * @return double on [0,1)-real-interval
216
 */
217
inline static double sfmt_genrand_real2(sfmt_t * sfmt)
218
0
{
219
0
    return sfmt_to_real2(sfmt_genrand_uint32(sfmt));
220
0
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_real2
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_real2
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_real2
Unexecuted instantiation: tape.tests.c:sfmt_genrand_real2
Unexecuted instantiation: SFMT.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_real2
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_real2
221
222
/**
223
 * converts an unsigned 32-bit integer to a double on (0,1)-real-interval.
224
 * @param v 32-bit unsigned integer
225
 * @return double on (0,1)-real-interval
226
 */
227
inline static double sfmt_to_real3(uint32_t v)
228
0
{
229
0
    return (((double)v) + 0.5)*(1.0/4294967296.0);
230
0
    /* divided by 2^32 */
231
0
}
Unexecuted instantiation: util.tests.c:sfmt_to_real3
Unexecuted instantiation: 3rdparty.tests.c:sfmt_to_real3
Unexecuted instantiation: while.backward.tests.c:sfmt_to_real3
Unexecuted instantiation: tape.tests.c:sfmt_to_real3
Unexecuted instantiation: SFMT.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_to_real3
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_to_real3
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_to_real3
232
233
/**
234
 * generates a random number on (0,1)-real-interval
235
 * @param sfmt SFMT internal state
236
 * @return double on (0,1)-real-interval
237
 */
238
inline static double sfmt_genrand_real3(sfmt_t * sfmt)
239
0
{
240
0
    return sfmt_to_real3(sfmt_genrand_uint32(sfmt));
241
0
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_real3
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_real3
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_real3
Unexecuted instantiation: tape.tests.c:sfmt_genrand_real3
Unexecuted instantiation: SFMT.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_real3
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_real3
242
243
/**
244
 * converts an unsigned 32-bit integer to double on [0,1)
245
 * with 53-bit resolution.
246
 * @param v 32-bit unsigned integer
247
 * @return double on [0,1)-real-interval with 53-bit resolution.
248
 */
249
inline static double sfmt_to_res53(uint64_t v)
250
0
{
251
0
    return v * (1.0/18446744073709551616.0L);
252
0
}
Unexecuted instantiation: util.tests.c:sfmt_to_res53
Unexecuted instantiation: 3rdparty.tests.c:sfmt_to_res53
Unexecuted instantiation: while.backward.tests.c:sfmt_to_res53
Unexecuted instantiation: tape.tests.c:sfmt_to_res53
Unexecuted instantiation: SFMT.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_to_res53
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_to_res53
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_to_res53
253
254
/**
255
 * generates a random number on [0,1) with 53-bit resolution
256
 * @param sfmt SFMT internal state
257
 * @return double on [0,1) with 53-bit resolution
258
 */
259
inline static double sfmt_genrand_res53(sfmt_t * sfmt)
260
0
{
261
0
    return sfmt_to_res53(sfmt_genrand_uint64(sfmt));
262
0
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_res53
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_res53
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_res53
Unexecuted instantiation: tape.tests.c:sfmt_genrand_res53
Unexecuted instantiation: SFMT.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_res53
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_res53
263
264
265
/* =================================================
266
   The following function are added by Saito.
267
   ================================================= */
268
/**
269
 * generates a random number on [0,1) with 53-bit resolution from two
270
 * 32 bit integers
271
 */
272
inline static double sfmt_to_res53_mix(uint32_t x, uint32_t y)
273
0
{
274
0
    return sfmt_to_res53(x | ((uint64_t)y << 32));
275
0
}
Unexecuted instantiation: util.tests.c:sfmt_to_res53_mix
Unexecuted instantiation: 3rdparty.tests.c:sfmt_to_res53_mix
Unexecuted instantiation: while.backward.tests.c:sfmt_to_res53_mix
Unexecuted instantiation: tape.tests.c:sfmt_to_res53_mix
Unexecuted instantiation: SFMT.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_to_res53_mix
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_to_res53_mix
276
277
/**
278
 * generates a random number on [0,1) with 53-bit resolution
279
 * using two 32bit integers.
280
 * @param sfmt SFMT internal state
281
 * @return double on [0,1) with 53-bit resolution
282
 */
283
inline static double sfmt_genrand_res53_mix(sfmt_t * sfmt)
284
0
{
285
0
    uint32_t x, y;
286
0
287
0
    x = sfmt_genrand_uint32(sfmt);
288
0
    y = sfmt_genrand_uint32(sfmt);
289
0
    return sfmt_to_res53_mix(x, y);
290
0
}
Unexecuted instantiation: util.tests.c:sfmt_genrand_res53_mix
Unexecuted instantiation: 3rdparty.tests.c:sfmt_genrand_res53_mix
Unexecuted instantiation: while.backward.tests.c:sfmt_genrand_res53_mix
Unexecuted instantiation: tape.tests.c:sfmt_genrand_res53_mix
Unexecuted instantiation: SFMT.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_cmd.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_tensor.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_tensor_io.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_stream.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_graph.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_graph_while.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_tensor_tape.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_graph_case_of.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_graph_run.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_model.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_model_io.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_model_core.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_model_addons.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_nnc_palettize.c:sfmt_genrand_res53_mix
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:sfmt_genrand_res53_mix
291
292
#if defined(__cplusplus)
293
}
294
#endif
295
296
#endif