10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_RANDOM_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_RANDOM_H 18 EIGEN_DEVICE_FUNC
uint64_t get_random_seed() {
31 int time = st.wSecond + 1000 * st.wMilliseconds;
38 uint64_t rnd = (rnd1 | rnd2 << 16) ^ time;
41 #elif defined __APPLE__ 52 clock_gettime(CLOCK_REALTIME, &ts);
62 *state = current * 6364136223846793005ULL + 0xda3e39cb94b95bdbULL;
64 return static_cast<unsigned>((current ^ (current >> 22)) >> (22 + (current >> 61)));
68 seed = seed ? seed : get_random_seed();
69 return seed * 6364136223846793005ULL + 0xda3e39cb94b95bdbULL;
77 unsigned rnd = PCG_XSH_RS_generator(state);
78 return static_cast<T>(rnd);
86 unsigned rnd = PCG_XSH_RS_generator(state);
87 result.
x =
static_cast<uint16_t>(rnd & 0x3ffu);
89 result.
x |= (
static_cast<uint16_t>(15) << 10);
103 const unsigned rnd = PCG_XSH_RS_generator(state);
104 result.raw = rnd & 0x7fffffu;
121 unsigned rnd1 = PCG_XSH_RS_generator(state) & 0xfffffu;
123 unsigned rnd2 = PCG_XSH_RS_generator(state);
132 std::complex<float> RandomToTypeUniform<std::complex<float> >(
uint64_t* state) {
137 std::complex<double> RandomToTypeUniform<std::complex<double> >(
uint64_t* state) {
149 m_state = PCG_XSH_RS_state(seed);
159 T result = RandomToTypeUniform<T>(&local_state);
169 for (
int j = 0;
j < packetSize; ++
j) {
170 values[
j] = RandomToTypeUniform<T>(&local_state);
173 return internal::pload<Packet>(
values);
180 template <
typename Scalar>
185 ((
sizeof(
Scalar) +
sizeof(
float) - 1) /
sizeof(
float)),
199 u = RandomToTypeUniform<T>(state);
200 v =
T(1.7156) * (RandomToTypeUniform<T>(state) -
T(0.5));
201 const T x = u -
T(0.449871);
203 q = x*x + y * (
T(0.196)*y -
T(0.25472)*
x);
204 }
while (q >
T(0.27597) &&
211 std::complex<float> RandomToTypeNormal<std::complex<float> >(
uint64_t* state) {
212 return std::complex<float>(RandomToTypeNormal<float>(state),
213 RandomToTypeNormal<float>(state));
216 std::complex<double> RandomToTypeNormal<std::complex<double> >(
uint64_t* state) {
217 return std::complex<double>(RandomToTypeNormal<double>(state),
218 RandomToTypeNormal<double>(state));
228 m_state = PCG_XSH_RS_state(seed);
238 T result = RandomToTypeNormal<T>(&local_state);
248 for (
int j = 0;
j < packetSize; ++
j) {
249 values[
j] = RandomToTypeNormal<T>(&local_state);
252 return internal::pload<Packet>(
values);
260 template <
typename Scalar>
276 #endif // EIGEN_CXX11_TENSOR_TENSOR_RANDOM_H
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(const NormalRandomGenerator &other)
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T RandomToTypeUniform(uint64_t *state)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(uint64_t seed=0)
unsigned __int64 uint64_t
Eigen::Triplet< double > T
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
EIGEN_DEVICE_FUNC const Scalar & q
A small structure to hold a non zero as a triplet (i,j,value).
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(Index i) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float RandomToTypeUniform< float >(uint64_t *state)
const mpreal random(unsigned int seed=0)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(Index i) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double RandomToTypeUniform< double >(uint64_t *state)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T log(const T &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T RandomToTypeNormal(uint64_t *state)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x