MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / boxMullerTransform

Function boxMullerTransform

src/backend/cpu/kernel/random_engine.hpp:259–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257
258template<typename T>
259void boxMullerTransform(data_t<T> *const out1, data_t<T> *const out2,
260 const T r1, const T r2) {
261 /*
262 * The log of a real value x where 0 < x < 1 is negative.
263 */
264 using Tc = compute_t<T>;
265 Tc r = sqrt((Tc)(-2.0) * log(static_cast<Tc>(r2)));
266 Tc theta = PI_VAL * (static_cast<Tc>(r1));
267
268 *out1 = r * sin(theta);
269 *out2 = r * cos(theta);
270}
271
272void boxMullerTransform(uint val[4], double *temp) {
273 boxMullerTransform<double>(&temp[0], &temp[1], getDoubleNegative11(val, 0),

Callers 3

philoxNormalFunction · 0.70
threefryNormalFunction · 0.70
normalDistributionMTFunction · 0.70

Calls 10

sqrtFunction · 0.85
logFunction · 0.85
sinFunction · 0.85
cosFunction · 0.85
getDoubleNegative11Function · 0.70
getDouble01Function · 0.70
getFloatNegative11Function · 0.70
getFloat01Function · 0.70
getHalfNegative11Function · 0.70
getHalf01Function · 0.70

Tested by

no test coverage detected