MCPcopy Create free account
hub / github.com/numpy/numpy / random_wald

Function random_wald

numpy/random/src/distributions/distributions.c:839–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837}
838
839double random_wald(bitgen_t *bitgen_state, double mean, double scale) {
840 double U, X, Y;
841 double mu_2l;
842
843 mu_2l = mean / (2 * scale);
844 Y = random_standard_normal(bitgen_state);
845 Y = mean * Y * Y;
846 X = mean + mu_2l * (Y - sqrt(4 * scale * Y + Y * Y));
847 U = next_double(bitgen_state);
848 if (U <= mean / (mean + X)) {
849 return X;
850 } else {
851 return mean * mean / X;
852 }
853}
854
855double random_vonmises(bitgen_t *bitgen_state, double mu, double kappa) {
856 double s;

Callers

nothing calls this directly

Calls 3

random_standard_normalFunction · 0.85
next_doubleFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected