diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 17:26:31 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 17:26:31 +0000 |
commit | 8e2654541c6eae0f308908f501cccbc86b2f9101 (patch) | |
tree | bfcfe3b282c8fb659832bf86a841ce76852094ad /numpy/random | |
parent | ddaed649c23bbd0ad36cdafdfe9cd92397ce69e3 (diff) | |
download | numpy-8e2654541c6eae0f308908f501cccbc86b2f9101.tar.gz |
Moved scipy directory to numpy
Diffstat (limited to 'numpy/random')
-rw-r--r-- | numpy/random/__init__.py | 17 | ||||
-rw-r--r-- | numpy/random/info.py | 56 | ||||
-rw-r--r-- | numpy/random/mtrand/Python.pxi | 24 | ||||
-rw-r--r-- | numpy/random/mtrand/distributions.c | 845 | ||||
-rw-r--r-- | numpy/random/mtrand/distributions.h | 185 | ||||
-rw-r--r-- | numpy/random/mtrand/generate_mtrand_c.py | 38 | ||||
-rw-r--r-- | numpy/random/mtrand/initarray.c | 134 | ||||
-rw-r--r-- | numpy/random/mtrand/initarray.h | 6 | ||||
-rw-r--r-- | numpy/random/mtrand/mtrand.c | 5990 | ||||
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 972 | ||||
-rw-r--r-- | numpy/random/mtrand/randomkit.c | 355 | ||||
-rw-r--r-- | numpy/random/mtrand/randomkit.h | 189 | ||||
-rw-r--r-- | numpy/random/mtrand/scipy.pxi | 52 | ||||
-rw-r--r-- | numpy/random/setup.py | 24 |
14 files changed, 8887 insertions, 0 deletions
diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py new file mode 100644 index 000000000..39607f993 --- /dev/null +++ b/numpy/random/__init__.py @@ -0,0 +1,17 @@ +# To get sub-modules +from info import __doc__, __all__ +from mtrand import * + +# Some aliases: +ranf = random = sample = random_sample +__all__.extend(['ranf','random','sample']) + +def __RandomState_ctor(): + """Return a RandomState instance. + + This function exists solely to assist (un)pickling. + """ + return RandomState() + +from scipy.testing import ScipyTest +test = ScipyTest().test diff --git a/numpy/random/info.py b/numpy/random/info.py new file mode 100644 index 000000000..44864495e --- /dev/null +++ b/numpy/random/info.py @@ -0,0 +1,56 @@ +"""\ +Core Random Tools +================= + +""" + +depends = ['base'] +global_symbols = ['rand','randn'] + +__all__ = [ + 'beta', + 'binomial', + 'bytes', + 'chisquare', + 'exponential', + 'f', + 'gamma', + 'geometric', + 'get_state', + 'gumbel', + 'hypergeometric', + 'laplace', + 'logistic', + 'lognormal', + 'logseries', + 'multinomial', + 'multivariate_normal', + 'negative_binomial', + 'noncentral_chisquare', + 'noncentral_f', + 'normal', + 'pareto', + 'permutation', + 'poisson', + 'power', + 'rand', + 'randint', + 'randn', + 'random_integers', + 'random_sample', + 'rayleigh', + 'seed', + 'set_state', + 'shuffle', + 'standard_cauchy', + 'standard_exponential', + 'standard_gamma', + 'standard_normal', + 'standard_t', + 'triangular', + 'uniform', + 'vonmises', + 'wald', + 'weibull', + 'zipf' +] diff --git a/numpy/random/mtrand/Python.pxi b/numpy/random/mtrand/Python.pxi new file mode 100644 index 000000000..d82b6dc4f --- /dev/null +++ b/numpy/random/mtrand/Python.pxi @@ -0,0 +1,24 @@ +# :Author: Robert Kern +# :Copyright: 2004, Enthought, Inc. +# :License: BSD Style + + +cdef extern from "Python.h": + ctypedef int size_t + char* PyString_AsString(object string) + object PyString_FromString(char* c_string) + + void* PyMem_Malloc(size_t n) + void* PyMem_Realloc(void* buf, size_t n) + void PyMem_Free(void* buf) + + void Py_DECREF(object obj) + void Py_XDECREF(object obj) + void Py_INCREF(object obj) + void Py_XINCREF(object obj) + +cdef extern from "string.h": + void *memcpy(void *s1, void *s2, int n) + +cdef extern from "math.h": + double fabs(double x) diff --git a/numpy/random/mtrand/distributions.c b/numpy/random/mtrand/distributions.c new file mode 100644 index 000000000..3f5ff2355 --- /dev/null +++ b/numpy/random/mtrand/distributions.c @@ -0,0 +1,845 @@ +/* Copyright 2005 Robert Kern (robert.kern@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* The implementations of rk_hypergeometric_hyp(), rk_hypergeometric_hrua(), + * and rk_triangular() were adapted from Ivan Frohne's rv.py which has this + * license: + * + * Copyright 1998 by Ivan Frohne; Wasilla, Alaska, U.S.A. + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation for any purpose, free of charge, is granted subject to the + * following conditions: + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the software. + * + * THE SOFTWARE AND DOCUMENTATION IS PROVIDED WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR + * OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM OR DAMAGES IN A CONTRACT + * ACTION, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR ITS DOCUMENTATION. + */ + +#include <math.h> +#include "distributions.h" +#include <stdio.h> + +#ifndef min +#define min(x,y) ((x<y)?x:y) +#define max(x,y) ((x>y)?x:y) +#endif + +/* log-gamma function to support some of these distributions. The + * algorithm comes from SPECFUN by Shanjie Zhang and Jianming Jin and their + * book "Computation of Special Functions", 1996, John Wiley & Sons, Inc. + */ +extern double loggam(double x); +double loggam(double x) +{ + double x0, x2, xp, gl, gl0; + long k, n; + + static double a[10] = {8.333333333333333e-02,-2.777777777777778e-03, + 7.936507936507937e-04,-5.952380952380952e-04, + 8.417508417508418e-04,-1.917526917526918e-03, + 6.410256410256410e-03,-2.955065359477124e-02, + 1.796443723688307e-01,-1.39243221690590e+00}; + x0 = x; + n = 0; + if ((x == 1.0) || (x == 2.0)) + { + return 0.0; + } + else if (x <= 7.0) + { + n = (long)(7 - x); + x0 = x + n; + } + x2 = 1.0/(x0*x0); + xp = 2*M_PI; + gl0 = a[9]; + for (k=8; k>=0; k--) + { + gl0 *= x2; + gl0 += a[k]; + } + gl = gl0/x0 + 0.5*log(xp) + (x0-0.5)*log(x0) - x0; + if (x <= 7.0) + { + for (k=1; k<=n; k++) + { + gl -= log(x0-1.0); + x0 -= 1.0; + } + } + return gl; +} + +double rk_normal(rk_state *state, double loc, double scale) +{ + return loc + scale*rk_gauss(state); +} + +double rk_standard_exponential(rk_state *state) +{ + /* We use -log(1-U) since U is [0, 1) */ + return -log(1.0 - rk_double(state)); +} + +double rk_exponential(rk_state *state, double scale) +{ + return scale * rk_standard_exponential(state); +} + +double rk_uniform(rk_state *state, double loc, double scale) +{ + return loc + scale*rk_double(state); +} + +double rk_standard_gamma(rk_state *state, double shape) +{ + double b, c; + double U, V, X, Y; + + if (shape == 1.0) + { + return rk_standard_exponential(state); + } + else if (shape < 1.0) + { + for (;;) + { + U = rk_double(state); + V = rk_standard_exponential(state); + if (U <= 1.0 - shape) + { + X = pow(U, 1./shape); + if (X <= V) + { + return X; + } + } + else + { + Y = -log((1-U)/shape); + X = pow(1.0 - shape + shape*Y, 1./shape); + if (X <= (V + Y)) + { + return X; + } + } + } + } + else + { + b = shape - 1./3.; + c = 1./sqrt(9*b); + for (;;) + { + do + { + X = rk_gauss(state); + V = 1.0 + c*X; + } while (V <= 0.0); + + V = V*V*V; + U = rk_double(state); + if (U < 1.0 - 0.0331*(X*X)*(X*X)) return (b*V); + if (log(U) < 0.5*X*X + b*(1. - V + log(V))) return (b*V); + } + } +} + +double rk_gamma(rk_state *state, double shape, double scale) +{ + return scale * rk_standard_gamma(state, shape); +} + +double rk_beta(rk_state *state, double a, double b) +{ + double Ga, Gb; + + if ((a <= 1.0) && (b <= 1.0)) + { + double U, V, X, Y; + /* Use Jonk's algorithm */ + + while (1) + { + U = rk_double(state); + V = rk_double(state); + X = pow(U, 1.0/a); + Y = pow(V, 1.0/b); + + if ((X + Y) <= 1.0) + { + return X; + } + } + } + else + { + Ga = rk_standard_gamma(state, a); + Gb = rk_standard_gamma(state, b); + return Ga/(Ga + Gb); + } +} + +double rk_chisquare(rk_state *state, double df) +{ + return 2.0*rk_standard_gamma(state, df/2.0); +} + +double rk_noncentral_chisquare(rk_state *state, double df, double nonc) +{ + double Chi2, N; + + Chi2 = rk_chisquare(state, df-1); + N = rk_gauss(state) + sqrt(nonc); + return Chi2 + N*N; +} + +double rk_f(rk_state *state, double dfnum, double dfden) +{ + return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden); +} + +double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc) +{ + return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) / + (rk_chisquare(state, dfden)*dfnum)); +} + +long rk_binomial_btpe(rk_state *state, long n, double p) +{ + double r,q,fm,p1,xm,xl,xr,c,laml,lamr,p2,p3,p4; + double a,u,v,s,F,rho,t,A,nrq,x1,x2,f1,f2,z,z2,w,w2,x; + long m,y,k,i; + + if (!(state->has_binomial) || + (state->nsave != n) || + (state->psave != p)) + { + /* initialize */ + state->nsave = n; + state->psave = p; + state->has_binomial = 1; + state->r = r = min(p, 1.0-p); + state->q = q = 1.0 - r; + state->fm = fm = n*r+r; + state->m = m = (long)floor(state->fm); + state->p1 = p1 = floor(2.195*sqrt(n*r*q)-4.6*q) + 0.5; + state->xm = xm = m + 0.5; + state->xl = xl = xm - p1; + state->xr = xr = xm + p1; + state->c = c = 0.134 + 20.5/(15.3 + m); + a = (fm - xl)/(fm-xl*r); + state->laml = laml = a*(1.0 + a/2.0); + a = (xr - fm)/(xr*q); + state->lamr = lamr = a*(1.0 + a/2.0); + state->p2 = p2 = p1*(1.0 + 2.0*c); + state->p3 = p3 = p2 + c/laml; + state->p4 = p4 = p3 + c/lamr; + } + else + { + r = state->r; + q = state->q; + fm = state->fm; + m = state->m; + p1 = state->p1; + xm = state->xm; + xl = state->xl; + xr = state->xr; + c = state->c; + laml = state->laml; + lamr = state->lamr; + p2 = state->p2; + p3 = state->p3; + p4 = state->p4; + } + + /* sigh ... */ + Step10: + nrq = n*r*q; + u = rk_double(state)*p4; + v = rk_double(state); + if (u > p1) goto Step20; + y = (long)floor(xm - p1*v + u); + goto Step60; + + Step20: + if (u > p2) goto Step30; + x = xl + (u - p1)/c; + v = v*c + 1.0 - fabs(m - x + 0.5)/p1; + if (v > 1.0) goto Step10; + y = (long)floor(x); + goto Step50; + + Step30: + if (u > p3) goto Step40; + y = (long)floor(xl + log(v)/laml); + if (y < 0) goto Step10; + v = v*(u-p2)*laml; + goto Step50; + + Step40: + y = (int)floor(xr - log(v)/lamr); + if (y > n) goto Step10; + v = v*(u-p3)*lamr; + + Step50: + k = fabs(y - m); + if ((k > 20) && (k < ((nrq)/2.0 - 1))) goto Step52; + + s = r/q; + a = s*(n+1); + F = 1.0; + if (m < y) + { + for (i=m; i<=y; i++) + { + F *= (a/i - s); + } + } + else if (m > y) + { + for (i=y; i<=m; i++) + { + F /= (a/i - s); + } + } + else + { + if (v > F) goto Step10; + goto Step60; + } + + Step52: + rho = (k/(nrq))*((k*(k/3.0 + 0.625) + 0.16666666666666666)/nrq + 0.5); + t = -k*k/(2*nrq); + A = log(v); + if (A < (t - rho)) goto Step60; + if (A > (t + rho)) goto Step10; + + x1 = y+1; + f1 = m+1; + z = n+1-m; + w = n-y+1; + x2 = x1*x1; + f2 = f1*f1; + z2 = z*z; + w2 = w*w; + if (A > (xm*log(f1/x1) + + (n-m+0.5)*log(z/w) + + (y-m)*log(w*r/(x1*q)) + + (13680.-(462.-(132.-(99.-140./f2)/f2)/f2)/f2)/f1/166320. + + (13680.-(462.-(132.-(99.-140./z2)/z2)/z2)/z2)/z/166320. + + (13680.-(462.-(132.-(99.-140./x2)/x2)/x2)/x2)/x1/166320. + + (13680.-(462.-(132.-(99.-140./w2)/w2)/w2)/w2)/w/166320.)) + { + goto Step10; + } + + Step60: + if (p > 0.5) + { + y = n - y; + } + + return y; +} + +long rk_binomial_inversion(rk_state *state, long n, double p) +{ + double q, qn, np, px, U; + long X, bound; + + if (!(state->has_binomial) || + (state->nsave != n) || + (state->psave != p)) + { + state->nsave = n; + state->psave = p; + state->has_binomial = 1; + state->q = q = 1.0 - p; + state->r = qn = exp(n * log(q)); + state->c = np = n*p; + state->m = bound = min(n, np + 10.0*sqrt(np)); + } else + { + q = state->q; + qn = state->r; + np = state->c; + bound = state->m; + } + X = 0; + px = qn; + U = rk_double(state); + while (U > px) + { + X++; + if (X > bound) + { + X = 0; + px = qn; + U = rk_double(state); + } else + { + U -= px; + px = ((n-X+1) * p * px)/(X*q); + } + } + return X; +} + +long rk_binomial(rk_state *state, long n, double p) +{ + double q; + + if (p <= 0.5) + { + if (p*n <= 30.0) + { + return rk_binomial_inversion(state, n, p); + } + else + { + return rk_binomial_btpe(state, n, p); + } + } + else + { + q = 1.0-p; + if (q*n <= 30.0) + { + return n - rk_binomial_inversion(state, n, q); + } + else + { + return n - rk_binomial_btpe(state, n, q); + } + } + +} + +long rk_negative_binomial(rk_state *state, long n, double p) +{ + double Y; + + Y = rk_gamma(state, n, (1-p)/p); + return rk_poisson(state, Y); +} + +long rk_poisson_mult(rk_state *state, double lam) +{ + long X; + double prod, U, enlam; + + enlam = exp(-lam); + X = 0; + prod = 1.0; + while (1) + { + U = rk_double(state); + prod *= U; + if (prod > enlam) + { + X += 1; + } + else + { + return X; + } + } +} + +#define LS2PI 0.91893853320467267 +#define TWELFTH 0.083333333333333333333333 +long rk_poisson_ptrs(rk_state *state, double lam) +{ + long k; + double U, V, slam, loglam, a, b, invalpha, vr, us; + + slam = sqrt(lam); + loglam = log(lam); + b = 0.931 + 2.53*slam; + a = -0.059 + 0.02483*b; + invalpha = 1.1239 + 1.1328/(b-3.4); + vr = 0.9277 - 3.6224/(b-2); + + while (1) + { + U = rk_double(state) - 0.5; + V = rk_double(state); + us = 0.5 - fabs(U); + k = (long)floor((2*a/us + b)*U + lam + 0.43); + if ((us >= 0.07) && (V <= vr)) + { + return k; + } + if ((k < 0) || + ((us < 0.013) && (V > us))) + { + continue; + } + if ((log(V) + log(invalpha) - log(a/(us*us)+b)) <= + (-lam + k*loglam - loggam(k+1))) + { + return k; + } + + + } + +} + +long rk_poisson(rk_state *state, double lam) +{ + if (lam >= 10) + { + return rk_poisson_ptrs(state, lam); + } + else + { + return rk_poisson_mult(state, lam); + } +} + +double rk_standard_cauchy(rk_state *state) +{ + return rk_gauss(state) / rk_gauss(state); +} + +double rk_standard_t(rk_state *state, double df) +{ + double N, G, X; + + N = rk_gauss(state); + G = rk_standard_gamma(state, df/2); + X = sqrt(df/2)*N/sqrt(G); + return X; +} + +double rk_vonmises(rk_state *state, double mu, double kappa) +{ + double r, rho, s; + double U, V, W, Y, Z; + double result, mod; + + if (kappa < 1e-8) + { + return M_PI * (2*rk_double(state)-1); + } + else + { + r = 1 + sqrt(1 + 4*kappa*kappa); + rho = (r - sqrt(2*r))/(2*kappa); + s = (1 + rho*rho)/(2*rho); + + while (1) + { + U = 2*rk_double(state) - 1; + V = 2*rk_double(state) - 1; + Z = cos(M_PI*U); + W = (1 + s*Z)/(s + Z); + Y = kappa * (s - W); + if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0)) + { + break; + } + } + + if (U < 0) + { + result = acos(W); + } + else + { + result = -acos(W); + } + result += mu + M_PI; + mod = fmod(result, 2*M_PI); + if (mod && (mod < 0)) + { + mod += 2*M_PI; + } + return mod - M_PI; + } +} + +double rk_pareto(rk_state *state, double a) +{ + return exp(rk_standard_exponential(state)/a) - 1; +} + +double rk_weibull(rk_state *state, double a) +{ + return pow(rk_standard_exponential(state), 1./a); +} + +double rk_power(rk_state *state, double a) +{ + return pow(1 - exp(-rk_standard_exponential(state)), 1./a); +} + +double rk_laplace(rk_state *state, double loc, double scale) +{ + double U; + + U = rk_double(state); + if (U < 0.5) + { + U = loc + scale * log(U + U); + } else + { + U = loc - scale * log(2.0 - U - U); + } + return U; +} + +double rk_gumbel(rk_state *state, double loc, double scale) +{ + double U; + + U = 1.0 - rk_double(state); + return loc - scale * log(-log(U)); +} + +double rk_logistic(rk_state *state, double loc, double scale) +{ + double U; + + U = rk_double(state); + return loc + scale * log(U/(1.0 - U)); +} + +double rk_lognormal(rk_state *state, double mean, double sigma) +{ + return exp(rk_normal(state, mean, sigma)); +} + +double rk_rayleigh(rk_state *state, double mode) +{ + return mode*sqrt(-2.0 * log(1.0 - rk_double(state))); +} + +double rk_wald(rk_state *state, double mean, double scale) +{ + double U, X, Y; + double mu_2l; + + mu_2l = mean / (2*scale); + Y = rk_gauss(state); + Y = mean*Y*Y; + X = mean + mu_2l*(Y - sqrt(4*scale*Y + Y*Y)); + U = rk_double(state); + if (U <= mean/(mean+X)) + { + return X; + } else + { + return mean*mean/X; + } +} + +long rk_zipf(rk_state *state, double a) +{ + double T, U, V; + long X; + double b; + + b = pow(2.0, a-1.0); + do + { + U = rk_double(state); + V = rk_double(state); + X = (long)floor(pow(U, -1.0/(a-1.0))); + T = pow(1.0 + 1.0/X, a-1.0); + } while ((V *X*(T-1.0)/(b-1.0)) > (T/b)); + return X; +} + +long rk_geometric_search(rk_state *state, double p) +{ + double U; + long X; + double sum, prod, q; + + X = 1; + sum = prod = p; + q = 1.0 - p; + U = rk_double(state); + while (U > sum) + { + prod *= q; + sum += prod; + X++; + } + return X; +} + +long rk_geometric_inversion(rk_state *state, double p) +{ + return (long)ceil(log(1.0-rk_double(state))/log(1.0-p)); +} + +long rk_geometric(rk_state *state, double p) +{ + if (p >= 0.333333333333333333333333) + { + return rk_geometric_search(state, p); + } else + { + return rk_geometric_inversion(state, p); + } +} + +long rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample) +{ + long d1, K, Z; + double d2, U, Y; + + d1 = bad + good - sample; + d2 = (double)min(bad, good); + + Y = d2; + K = sample; + while (Y > 0.0) + { + U = rk_double(state); + Y -= (long)floor(U + Y/(d1 + K)); + K--; + if (K == 0) break; + } + Z = (long)(d2 - Y); + if (bad > good) Z = sample - Z; + return Z; +} + +/* D1 = 2*sqrt(2/e) */ +/* D2 = 3 - 2*sqrt(3/e) */ +#define D1 1.7155277699214135 +#define D2 0.8989161620588988 +long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample) +{ + long mingoodbad, maxgoodbad, popsize, m, d9; + double d4, d5, d6, d7, d8, d10, d11; + long Z; + double T, W, X, Y; + + mingoodbad = min(good, bad); + popsize = good + bad; + maxgoodbad = max(good, bad); + m = min(sample, popsize - sample); + d4 = ((double)mingoodbad) / popsize; + d5 = 1.0 - d4; + d6 = m*d4 + 0.5; + d7 = sqrt((popsize - m) * sample * d4 *d5 / (popsize-1) + 0.5); + d8 = D1*d7 + D2; + d9 = (long)floor((double)((m+1)*(mingoodbad+1))/(popsize+2)); + d10 = (loggam(d9+1) + loggam(mingoodbad-d9+1) + loggam(m-d9+1) + + loggam(maxgoodbad-m+d9+1)); + d11 = min(min(m, mingoodbad)+1.0, floor(d6+16*d7)); + /* 16 for 16-decimal-digit precision in D1 and D2 */ + + while (1) + { + X = rk_double(state); + Y = rk_double(state); + W = d6 + d8*(Y- 0.5)/X; + + /* fast rejection: */ + if ((W < 0.0) || (W >= d11)) continue; + + Z = (long)floor(W); + T = d10 - (loggam(Z+1) + loggam(mingoodbad-Z+1) + loggam(m-Z+1) + + loggam(maxgoodbad-m+Z+1)); + + /* fast acceptance: */ + if ((X*(4.0-X)-3.0) <= T) break; + + /* fast rejection: */ + if (X*(X-T) >= 1) continue; + + if (2.0*log(X) <= T) break; /* acceptance */ + } + + /* this is a correction to HRUA* by Ivan Frohne in rv.py */ + if (bad > good) Z = m - Z; + + /* another fix from rv.py to allow sample to exceed popsize/2 */ + if (m < sample) Z = bad - Z; + + return Z; +} +#undef D1 +#undef D2 + +long rk_hypergeometric(rk_state *state, long good, long bad, long sample) +{ + if (sample > 10) + { + return rk_hypergeometric_hrua(state, good, bad, sample); + } else + { + return rk_hypergeometric_hyp(state, good, bad, sample); + } +} + +double rk_triangular(rk_state *state, double left, double mode, double right) +{ + double base, leftbase, ratio, leftprod, rightprod; + double U; + + base = right - left; + leftbase = mode - left; + ratio = leftbase / base; + leftprod = leftbase*base; + rightprod = (right - mode)*base; + + U = rk_double(state); + if (U <= ratio) + { + return left + sqrt(U*leftprod); + } else + { + return right - sqrt((1.0 - U) * rightprod); + } +} + +long rk_logseries(rk_state *state, double p) +{ + double q, r, U, V; + + r = log(1.0 - p); + + V = rk_double(state); + if (V >= p) return 1; + U = rk_double(state); + q = 1.0 - exp(r*U); + if (V <= q*q) return (long)floor(1 + log(V)/log(q)); + if (V <= q) return 1; + return 2; +} diff --git a/numpy/random/mtrand/distributions.h b/numpy/random/mtrand/distributions.h new file mode 100644 index 000000000..0d6de639d --- /dev/null +++ b/numpy/random/mtrand/distributions.h @@ -0,0 +1,185 @@ +/* Copyright 2005 Robert Kern (robert.kern@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _RK_DISTR_ +#define _RK_DISTR_ + +#include "randomkit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* References: + * + * Devroye, Luc. _Non-Uniform Random Variate Generation_. + * Springer-Verlag, New York, 1986. + * http://cgm.cs.mcgill.ca/~luc/rnbookindex.html + * + * Kachitvichyanukul, V. and Schmeiser, B. W. Binomial Random Variate + * Generation. Communications of the ACM, 31, 2 (February, 1988) 216. + * + * Hoermann, W. The Transformed Rejection Method for Generating Poisson Random + * Variables. Insurance: Mathematics and Economics, (to appear) + * http://citeseer.csail.mit.edu/151115.html + * + * Marsaglia, G. and Tsang, W. W. A Simple Method for Generating Gamma + * Variables. ACM Transactions on Mathematical Software, Vol. 26, No. 3, + * September 2000, Pages 363–372. + */ + +/* Normal distribution with mean=loc and standard deviation=scale. */ +extern double rk_normal(rk_state *state, double loc, double scale); + +/* Standard exponential distribution (mean=1) computed by inversion of the + * CDF. */ +extern double rk_standard_exponential(rk_state *state); + +/* Exponential distribution with mean=scale. */ +extern double rk_exponential(rk_state *state, double scale); + +/* Uniform distribution on interval [loc, loc+scale). */ +extern double rk_uniform(rk_state *state, double loc, double scale); + +/* Standard gamma distribution with shape parameter. + * When shape < 1, the algorithm given by (Devroye p. 304) is used. + * When shape == 1, a Exponential variate is generated. + * When shape > 1, the small and fast method of (Marsaglia and Tsang 2000) + * is used. + */ +extern double rk_standard_gamma(rk_state *state, double shape); + +/* Gamma distribution with shape and scale. */ +extern double rk_gamma(rk_state *state, double shape, double scale); + +/* Beta distribution computed by combining two gamma variates (Devroye p. 432). + */ +extern double rk_beta(rk_state *state, double a, double b); + +/* Chi^2 distribution computed by transforming a gamma variate (it being a + * special case Gamma(df/2, 2)). */ +extern double rk_chisquare(rk_state *state, double df); + +/* Noncentral Chi^2 distribution computed by modifying a Chi^2 variate. */ +extern double rk_noncentral_chisquare(rk_state *state, double df, double nonc); + +/* F distribution computed by taking the ratio of two Chi^2 variates. */ +extern double rk_f(rk_state *state, double dfnum, double dfden); + +/* Noncentral F distribution computed by taking the ratio of a noncentral Chi^2 + * and a Chi^2 variate. */ +extern double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc); + +/* Binomial distribution with n Bernoulli trials with success probability p. + * When n*p <= 30, the "Second waiting time method" given by (Devroye p. 525) is + * used. Otherwise, the BTPE algorithm of (Kachitvichyanukul and Schmeiser 1988) + * is used. */ +extern long rk_binomial(rk_state *state, long n, double p); + +/* Binomial distribution using BTPE. */ +extern long rk_binomial_btpe(rk_state *state, long n, double p); + +/* Binomial distribution using inversion and chop-down */ +extern long rk_binomial_inversion(rk_state *state, long n, double p); + +/* Negative binomial distribution computed by generating a Gamma(n, (1-p)/p) + * variate Y and returning a Poisson(Y) variate (Devroye p. 543). */ +extern long rk_negative_binomial(rk_state *state, long n, double p); + +/* Poisson distribution with mean=lam. + * When lam < 10, a basic algorithm using repeated multiplications of uniform + * variates is used (Devroye p. 504). + * When lam >= 10, algorithm PTRS from (Hoermann 1992) is used. + */ +extern long rk_poisson(rk_state *state, double lam); + +/* Poisson distribution computed by repeated multiplication of uniform variates. + */ +extern long rk_poisson_mult(rk_state *state, double lam); + +/* Poisson distribution computer by the PTRS algorithm. */ +extern long rk_poisson_ptrs(rk_state *state, double lam); + +/* Standard Cauchy distribution computed by dividing standard gaussians + * (Devroye p. 451). */ +extern double rk_standard_cauchy(rk_state *state); + +/* Standard t-distribution with df degrees of freedom (Devroye p. 445 as + * corrected in the Errata). */ +extern double rk_standard_t(rk_state *state, double df); + +/* von Mises circular distribution with center mu and shape kappa on [-pi,pi] + * (Devroye p. 476 as corrected in the Errata). */ +extern double rk_vonmises(rk_state *state, double mu, double kappa); + +/* Pareto distribution via inversion (Devroye p. 262) */ +extern double rk_pareto(rk_state *state, double a); + +/* Weibull distribution via inversion (Devroye p. 262) */ +extern double rk_weibull(rk_state *state, double a); + +/* Power distribution via inversion (Devroye p. 262) */ +extern double rk_power(rk_state *state, double a); + +/* Laplace distribution */ +extern double rk_laplace(rk_state *state, double loc, double scale); + +/* Gumbel distribution */ +extern double rk_gumbel(rk_state *state, double loc, double scale); + +/* Logistic distribution */ +extern double rk_logistic(rk_state *state, double loc, double scale); + +/* Log-normal distribution */ +extern double rk_lognormal(rk_state *state, double mean, double sigma); + +/* Rayleigh distribution */ +extern double rk_rayleigh(rk_state *state, double mode); + +/* Wald distribution */ +extern double rk_wald(rk_state *state, double mean, double scale); + +/* Zipf distribution */ +extern long rk_zipf(rk_state *state, double a); + +/* Geometric distribution */ +extern long rk_geometric(rk_state *state, double p); +extern long rk_geometric_search(rk_state *state, double p); +extern long rk_geometric_inversion(rk_state *state, double p); + +/* Hypergeometric distribution */ +extern long rk_hypergeometric(rk_state *state, long good, long bad, long sample); +extern long rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample); +extern long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample); + +/* Triangular distribution */ +extern double rk_triangular(rk_state *state, double left, double mode, double right); + +/* Logarithmic series distribution */ +extern long rk_logseries(rk_state *state, double p); + +#ifdef __cplusplus +} +#endif + + +#endif /* _RK_DISTR_ */ diff --git a/numpy/random/mtrand/generate_mtrand_c.py b/numpy/random/mtrand/generate_mtrand_c.py new file mode 100644 index 000000000..3f440985f --- /dev/null +++ b/numpy/random/mtrand/generate_mtrand_c.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import sys +import re +import os + +unused_internal_funcs = ['__Pyx_PrintItem', + '__Pyx_PrintNewline', + '__Pyx_ReRaise', + '__Pyx_GetExcValue', + '__Pyx_ArgTypeTest', + '__Pyx_TypeTest', + '__Pyx_SetVtable', + '__Pyx_GetVtable', + '__Pyx_CreateClass'] + +if __name__ == '__main__': + os.system('pyrexc mtrand.pyx') + mtrand_c = open('mtrand.c', 'r') + processed = open('mtrand_pp.c', 'w') + unused_funcs_str = '(' + '|'.join(unused_internal_funcs) + ')' + uifpat = re.compile(r'static \w+ \*?'+unused_funcs_str+r'.*/\*proto\*/') + for linenum, line in enumerate(mtrand_c): + m = re.match(r'^(\s+arrayObject\w*\s*=\s*[(])[(]PyObject\s*[*][)]', + line) + if m: + line = '%s(PyArrayObject *)%s' % (m.group(1), line[m.end():]) + m = uifpat.match(line) + if m: + line = '' + m = re.search(unused_funcs_str, line) + if m: + print >>sys.stderr, \ + "%s was declared unused, but is used at line %d" % (m.group(), + linenum+1) + processed.write(line) + mtrand_c.close() + processed.close() + os.rename('mtrand_pp.c', 'mtrand.c') diff --git a/numpy/random/mtrand/initarray.c b/numpy/random/mtrand/initarray.c new file mode 100644 index 000000000..9bf0ef286 --- /dev/null +++ b/numpy/random/mtrand/initarray.c @@ -0,0 +1,134 @@ +/* These function have been adapted from Python 2.4.1's _randommodule.c + + The following changes have been made to it in 2005 by Robert Kern: + + * init_by_array has been declared extern, has a void return, and uses the + rk_state structure to hold its data. + + The original file has the following verbatim comments: + + ------------------------------------------------------------------ + The code in this module was based on a download from: + http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html + + It was modified in 2002 by Raymond Hettinger as follows: + + * the principal computational lines untouched except for tabbing. + + * renamed genrand_res53() to random_random() and wrapped + in python calling/return code. + + * genrand_int32() and the helper functions, init_genrand() + and init_by_array(), were declared static, wrapped in + Python calling/return code. also, their global data + references were replaced with structure references. + + * unused functions from the original were deleted. + new, original C python code was added to implement the + Random() interface. + + The following are the verbatim comments from the original code: + + A C-program for MT19937, with initialization improved 2002/1/26. + Coded by Takuji Nishimura and Makoto Matsumoto. + + Before using, initialize the state by using init_genrand(seed) + or init_by_array(init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp +*/ + +#include "initarray.h" + +static void +init_genrand(rk_state *self, unsigned long s); + +/* initializes mt[RK_STATE_LEN] with a seed */ +static void +init_genrand(rk_state *self, unsigned long s) +{ + int mti; + unsigned long *mt; + + mt = self->key; + mt[0]= s & 0xffffffffUL; + for (mti=1; mti<RK_STATE_LEN; mti++) { + mt[mti] = + (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array mt[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt[mti] &= 0xffffffffUL; + /* for >32 bit machines */ + } + self->pos = mti; + return; +} + + +/* initialize by an array with array-length */ +/* init_key is the array for initializing keys */ +/* key_length is its length */ +extern void +init_by_array(rk_state *self, unsigned long init_key[], unsigned long key_length) +{ + unsigned int i, j, k; /* was signed in the original code. RDH 12/16/2002 */ + unsigned long *mt; + + mt = self->key; + init_genrand(self, 19650218UL); + i=1; j=0; + k = (RK_STATE_LEN>key_length ? RK_STATE_LEN : key_length); + for (; k; k--) { + mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL)) + + init_key[j] + j; /* non linear */ + mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ + i++; j++; + if (i>=RK_STATE_LEN) { mt[0] = mt[RK_STATE_LEN-1]; i=1; } + if (j>=key_length) j=0; + } + for (k=RK_STATE_LEN-1; k; k--) { + mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL)) + - i; /* non linear */ + mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ + i++; + if (i>=RK_STATE_LEN) { mt[0] = mt[RK_STATE_LEN-1]; i=1; } + } + + mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ +} + diff --git a/numpy/random/mtrand/initarray.h b/numpy/random/mtrand/initarray.h new file mode 100644 index 000000000..a4ac210f4 --- /dev/null +++ b/numpy/random/mtrand/initarray.h @@ -0,0 +1,6 @@ +#include "randomkit.h" + +extern void +init_by_array(rk_state *self, unsigned long init_key[], + unsigned long key_length); + diff --git a/numpy/random/mtrand/mtrand.c b/numpy/random/mtrand/mtrand.c new file mode 100644 index 000000000..995e4871d --- /dev/null +++ b/numpy/random/mtrand/mtrand.c @@ -0,0 +1,5990 @@ +/* Generated by Pyrex 0.9.3.1 on Sun Dec 25 23:14:18 2005 */ + +#include "Python.h" +#include "structmember.h" +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#include "string.h" +#include "math.h" +#include "scipy/arrayobject.h" +#include "randomkit.h" +#include "distributions.h" +#include "initarray.h" + + +typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ +static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, int); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/ +static void __Pyx_WriteUnraisable(char *name); /*proto*/ +static void __Pyx_AddTraceback(char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ +static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static int __pyx_lineno; +static char *__pyx_filename; +staticforward char **__pyx_f; + +/* Declarations from mtrand */ + +staticforward PyTypeObject __pyx_type_6mtrand_RandomState; + +struct __pyx_obj_6mtrand_RandomState { + PyObject_HEAD + rk_state (*internal_state); +}; + +static PyTypeObject *__pyx_ptype_6mtrand_dtypedescr = 0; +static PyTypeObject *__pyx_ptype_6mtrand_ndarray = 0; +static PyTypeObject *__pyx_ptype_6mtrand_RandomState = 0; +static PyObject *__pyx_k2; +static PyObject *__pyx_k3; +static PyObject *__pyx_k4; +static PyObject *__pyx_k5; +static PyObject *__pyx_k6; +static PyObject *__pyx_k7; +static double __pyx_k8; +static double __pyx_k9; +static PyObject *__pyx_k10; +static PyObject *__pyx_k11; +static PyObject *__pyx_k12; +static PyObject *__pyx_k13; +static double __pyx_k14; +static double __pyx_k15; +static PyObject *__pyx_k16; +static PyObject *__pyx_k17; +static double __pyx_k18; +static PyObject *__pyx_k19; +static PyObject *__pyx_k20; +static PyObject *__pyx_k21; +static double __pyx_k22; +static PyObject *__pyx_k23; +static PyObject *__pyx_k24; +static PyObject *__pyx_k25; +static PyObject *__pyx_k26; +static PyObject *__pyx_k27; +static PyObject *__pyx_k28; +static PyObject *__pyx_k29; +static PyObject *__pyx_k30; +static PyObject *__pyx_k31; +static PyObject *__pyx_k32; +static PyObject *__pyx_k33; +static double __pyx_k34; +static double __pyx_k35; +static PyObject *__pyx_k36; +static double __pyx_k37; +static double __pyx_k38; +static PyObject *__pyx_k39; +static double __pyx_k40; +static double __pyx_k41; +static PyObject *__pyx_k42; +static double __pyx_k43; +static double __pyx_k44; +static PyObject *__pyx_k45; +static double __pyx_k46; +static PyObject *__pyx_k47; +static PyObject *__pyx_k48; +static PyObject *__pyx_k49; +static PyObject *__pyx_k50; +static PyObject *__pyx_k51; +static double __pyx_k52; +static PyObject *__pyx_k53; +static PyObject *__pyx_k54; +static PyObject *__pyx_k55; +static PyObject *__pyx_k56; +static PyObject *__pyx_k57; +static PyObject *__pyx_k58; +static PyObject *__pyx_k59; +static PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/ +static PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/ +static PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/ +static PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/ +static PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/ +static PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/ +static PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/ +static PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/ +static double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/ + +/* Implementation of mtrand */ + + +static PyObject *__pyx_n__sp; +static PyObject *__pyx_n__rand; +static PyObject *__pyx_n_seed; +static PyObject *__pyx_n_get_state; +static PyObject *__pyx_n_set_state; +static PyObject *__pyx_n_random_sample; +static PyObject *__pyx_n_randint; +static PyObject *__pyx_n_bytes; +static PyObject *__pyx_n_uniform; +static PyObject *__pyx_n_rand; +static PyObject *__pyx_n_randn; +static PyObject *__pyx_n_random_integers; +static PyObject *__pyx_n_standard_normal; +static PyObject *__pyx_n_normal; +static PyObject *__pyx_n_beta; +static PyObject *__pyx_n_exponential; +static PyObject *__pyx_n_standard_exponential; +static PyObject *__pyx_n_standard_gamma; +static PyObject *__pyx_n_gamma; +static PyObject *__pyx_n_f; +static PyObject *__pyx_n_noncentral_f; +static PyObject *__pyx_n_chisquare; +static PyObject *__pyx_n_noncentral_chisquare; +static PyObject *__pyx_n_standard_cauchy; +static PyObject *__pyx_n_standard_t; +static PyObject *__pyx_n_vonmises; +static PyObject *__pyx_n_pareto; +static PyObject *__pyx_n_weibull; +static PyObject *__pyx_n_power; +static PyObject *__pyx_n_laplace; +static PyObject *__pyx_n_gumbel; +static PyObject *__pyx_n_logistic; +static PyObject *__pyx_n_lognormal; +static PyObject *__pyx_n_rayleigh; +static PyObject *__pyx_n_wald; +static PyObject *__pyx_n_triangular; +static PyObject *__pyx_n_binomial; +static PyObject *__pyx_n_negative_binomial; +static PyObject *__pyx_n_poisson; +static PyObject *__pyx_n_zipf; +static PyObject *__pyx_n_geometric; +static PyObject *__pyx_n_hypergeometric; +static PyObject *__pyx_n_logseries; +static PyObject *__pyx_n_multivariate_normal; +static PyObject *__pyx_n_multinomial; +static PyObject *__pyx_n_shuffle; +static PyObject *__pyx_n_permutation; +static PyObject *__pyx_n_scipy; + +static PyObject *__pyx_n_empty; +static PyObject *__pyx_n_Float64; + +static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) { + double (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":128 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":129 */ + __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":131 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":132 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":133 */ + __pyx_v_array_data = ((double (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":134 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":135 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":136 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.cont0_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) { + double (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":144 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":145 */ + __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":147 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":148 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":149 */ + __pyx_v_array_data = ((double (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":150 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":151 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":152 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.cont1_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) { + double (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":161 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":162 */ + __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":164 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":165 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":166 */ + __pyx_v_array_data = ((double (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":167 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":168 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":169 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.cont2_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) { + double (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":179 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":180 */ + __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":182 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":183 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":184 */ + __pyx_v_array_data = ((double (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":185 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":186 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":187 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.cont3_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_n_Int; + +static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) { + long (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":195 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":196 */ + __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":198 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":199 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":200 */ + __pyx_v_array_data = ((long (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":201 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":202 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":203 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.disc0_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) { + long (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":211 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":212 */ + __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":214 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":215 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":216 */ + __pyx_v_array_data = ((long (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":217 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":218 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":219 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.discnp_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) { + long (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":228 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":229 */ + __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":231 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":232 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":233 */ + __pyx_v_array_data = ((long (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":234 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":235 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":236 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.discnmN_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) { + long (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":244 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":245 */ + __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":247 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":248 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":249 */ + __pyx_v_array_data = ((long (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":250 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":251 */ + (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":252 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.discd_array"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) { + double __pyx_v_c; + double __pyx_v_y; + double __pyx_v_t; + double __pyx_v_sum; + long __pyx_v_i; + double __pyx_r; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":257 */ + __pyx_v_sum = (__pyx_v_darr[0]); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":258 */ + __pyx_v_c = 0.0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":259 */ + for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":260 */ + __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":261 */ + __pyx_v_t = (__pyx_v_sum + __pyx_v_y); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":262 */ + __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":263 */ + __pyx_v_sum = __pyx_v_t; + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":264 */ + __pyx_r = __pyx_v_sum; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __Pyx_WriteUnraisable("mtrand.kahan_sum"); + __pyx_L0:; + return __pyx_r; +} + +static int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_seed = 0; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + static char *__pyx_argnames[] = {"seed",0}; + __pyx_v_seed = __pyx_k2; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_seed)) return -1; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_seed); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":287 */ + ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state )))); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":289 */ + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;} + Py_INCREF(__pyx_v_seed); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.__init__"); + __pyx_r = -1; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_seed); + return __pyx_r; +} + +static void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) { + int __pyx_1; + Py_INCREF(__pyx_v_self); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":292 */ + __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":293 */ + PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + goto __pyx_L2; + } + __pyx_L2:; + + goto __pyx_L0; + __Pyx_AddTraceback("mtrand.RandomState.__dealloc__"); + __pyx_L0:; + Py_DECREF(__pyx_v_self); +} + +static PyObject *__pyx_n_type; +static PyObject *__pyx_n_int; + +static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_seed[] = "Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_seed = 0; + rk_error __pyx_v_errcode; + PyArrayObject *arrayObject_obj; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + unsigned long __pyx_5; + static char *__pyx_argnames[] = {"seed",0}; + __pyx_v_seed = __pyx_k3; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_seed)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_seed); + arrayObject_obj = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_obj); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":307 */ + __pyx_1 = __pyx_v_seed == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":308 */ + __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + goto __pyx_L2; + } + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;} + Py_INCREF(__pyx_v_seed); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;} + __pyx_1 = __pyx_4 == __pyx_2; + Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":310 */ + __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;} + rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":312 */ + __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;} + Py_INCREF(((PyObject *)__pyx_3)); + Py_DECREF(((PyObject *)arrayObject_obj)); + arrayObject_obj = ((PyArrayObject *)__pyx_3); + Py_DECREF(__pyx_3); __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":313 */ + init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))arrayObject_obj->data),(arrayObject_obj->dimensions[0])); + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.seed"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject_obj); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_seed); + return __pyx_r; +} + +static PyObject *__pyx_n_MT19937; + + +static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_get_state[] = "Return a tuple representing the internal state of the generator.\n\n get_state() -> (\'MT19937\', int key[624], int pos)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *arrayObject_state; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; + Py_INCREF(__pyx_v_self); + arrayObject_state = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_state); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":322 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4); + __pyx_1 = 0; + __pyx_4 = 0; + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_INCREF(((PyObject *)__pyx_1)); + Py_DECREF(((PyObject *)arrayObject_state)); + arrayObject_state = ((PyArrayObject *)__pyx_1); + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":323 */ + memcpy(((void (*))arrayObject_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long )))); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":324 */ + __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} + __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} + Py_INCREF(__pyx_n_MT19937); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937); + Py_INCREF(((PyObject *)arrayObject_state)); + PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)arrayObject_state)); + PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4); + __pyx_4 = 0; + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.get_state"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject_state); + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_n_ValueError; + +static PyObject *__pyx_k62p; +static PyObject *__pyx_k63p; + +static char (__pyx_k62[]) = "algorithm must be 'MT19937'"; +static char (__pyx_k63[]) = "state must be 624 longs"; + +static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_set_state[] = "Set the state from a tuple.\n \n state = (\'MT19937\', int key[624], int pos)\n \n set_state(state)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_state = 0; + PyArrayObject *arrayObject_obj; + int __pyx_v_pos; + PyObject *__pyx_v_algorithm_name; + PyObject *__pyx_v_key; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_3; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"state",0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_state)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_state); + arrayObject_obj = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_obj); + __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name); + __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":335 */ + __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;} + __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_v_algorithm_name); + __pyx_v_algorithm_name = __pyx_2; + __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":336 */ + if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;} + __pyx_3 = __pyx_3 != 0; + if (__pyx_3) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":337 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;} + Py_INCREF(__pyx_k62p); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k62p); + __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":338 */ + __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;} + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;} + Py_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_2; + __pyx_2 = 0; + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;} + __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_v_pos = __pyx_3; + if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":339 */ + __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;} + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject_obj)); + arrayObject_obj = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":340 */ + __pyx_3 = ((arrayObject_obj->dimensions[0]) != 624); + if (__pyx_3) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":341 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;} + __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;} + Py_INCREF(__pyx_k63p); + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k63p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":342 */ + memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))arrayObject_obj->data),(624 * (sizeof(long )))); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":343 */ + ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.set_state"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject_obj); + Py_DECREF(__pyx_v_algorithm_name); + Py_DECREF(__pyx_v_key); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_state); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + static char *__pyx_argnames[] = {0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; + Py_INCREF(__pyx_v_self); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":347 */ + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;} + __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;} + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_r = __pyx_3; + __pyx_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.__getstate__"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + static char *__pyx_argnames[] = {"state",0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_state)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_state); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":350 */ + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;} + Py_INCREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.__setstate__"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_state); + return __pyx_r; +} + +static PyObject *__pyx_n_random; +static PyObject *__pyx_n___RandomState_ctor; + +static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_5 = 0; + static char *__pyx_argnames[] = {0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; + Py_INCREF(__pyx_v_self); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":353 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); + PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_5 = 0; + __pyx_r = __pyx_3; + __pyx_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + Py_XDECREF(__pyx_5); + __Pyx_AddTraceback("mtrand.RandomState.__reduce__"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_random_sample[] = "Return random floats in the half-open interval [0.0, 1.0).\n\n random_sample(size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"size",0}; + __pyx_v_size = __pyx_k4; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":361 */ + __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.random_sample"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_tomaxint[] = "Returns random integers x such that 0 <= x <= sys.maxint.\n\n tomaxint(size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"size",0}; + __pyx_v_size = __pyx_k5; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":368 */ + __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.tomaxint"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k64p; + +static char (__pyx_k64[]) = "low >= high"; + +static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_randint[] = "Return random integers x such that low <= x < high.\n\n randint(low, high=None, size=None) -> random values\n\n If high is None, then 0 <= x < low.\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_low = 0; + PyObject *__pyx_v_high = 0; + PyObject *__pyx_v_size = 0; + long __pyx_v_lo; + long __pyx_v_hi; + long __pyx_v_diff; + long (*__pyx_v_array_data); + PyArrayObject *arrayObject; + long __pyx_v_length; + long __pyx_v_i; + PyObject *__pyx_r; + int __pyx_1; + long __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_5 = 0; + static char *__pyx_argnames[] = {"low","high","size",0}; + __pyx_v_high = __pyx_k6; + __pyx_v_size = __pyx_k7; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OO", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_low); + Py_INCREF(__pyx_v_high); + Py_INCREF(__pyx_v_size); + arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":383 */ + __pyx_1 = __pyx_v_high == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":384 */ + __pyx_v_lo = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":385 */ + __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; goto __pyx_L1;} + __pyx_v_hi = __pyx_2; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":387 */ + __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;} + __pyx_v_lo = __pyx_2; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":388 */ + __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;} + __pyx_v_hi = __pyx_2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":390 */ + __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":391 */ + __pyx_1 = (__pyx_v_diff < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":392 */ + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;} + Py_INCREF(__pyx_k64p); + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k64p); + __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":394 */ + __pyx_1 = __pyx_v_size == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":395 */ + __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;} + __pyx_r = __pyx_3; + __pyx_3 = 0; + goto __pyx_L0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":397 */ + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_INCREF(((PyObject *)__pyx_4)); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_4); + Py_DECREF(__pyx_4); __pyx_4 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":398 */ + __pyx_v_length = PyArray_SIZE(arrayObject); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":399 */ + __pyx_v_array_data = ((long (*))arrayObject->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":400 */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":401 */ + (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + ((long )rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state))); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":402 */ + Py_INCREF(((PyObject *)arrayObject)); + __pyx_r = ((PyObject *)arrayObject); + goto __pyx_L0; + } + __pyx_L4:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + Py_XDECREF(__pyx_5); + __Pyx_AddTraceback("mtrand.RandomState.randint"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_low); + Py_DECREF(__pyx_v_high); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_bytes[] = "Return random bytes.\n\n bytes(length) -> str\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + unsigned int __pyx_v_length; + void (*__pyx_v_bytes); + PyObject *__pyx_v_bytestring; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"length",0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_length)) return 0; + Py_INCREF(__pyx_v_self); + __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":410 */ + __pyx_v_bytes = PyMem_Malloc(__pyx_v_length); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":411 */ + rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":412 */ + __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;} + Py_DECREF(__pyx_v_bytestring); + __pyx_v_bytestring = __pyx_1; + __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":413 */ + PyMem_Free(__pyx_v_bytes); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":414 */ + Py_INCREF(__pyx_v_bytestring); + __pyx_r = __pyx_v_bytestring; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.bytes"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_bytestring); + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_uniform[] = "Uniform distribution over [low, high).\n\n uniform(low=0.0, high=1.0, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_low; + double __pyx_v_high; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"low","high","size",0}; + __pyx_v_low = __pyx_k8; + __pyx_v_high = __pyx_k9; + __pyx_v_size = __pyx_k10; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":421 */ + __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.uniform"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_n_len; +static PyObject *__pyx_n_size; + + +static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_rand[] = "Return an array of the given dimensions which is initialized to \n random numbers from a uniform distribution in the range [0,1).\n\n rand(d0, d1, ..., dn) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_4; + PyObject *__pyx_5 = 0; + static char *__pyx_argnames[] = {0}; + if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) { + Py_XDECREF(__pyx_args); + Py_XDECREF(__pyx_kwds); + Py_XDECREF(__pyx_v_args); + return 0; + } + Py_INCREF(__pyx_v_self); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":430 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;} + Py_INCREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;} + if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;} + __pyx_4 = __pyx_4 == 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":431 */ + __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; goto __pyx_L1;} + __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; goto __pyx_L1;} + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":433 */ + __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;} + __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;} + __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;} + if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;} + __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_r = __pyx_5; + __pyx_5 = 0; + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_5); + __Pyx_AddTraceback("mtrand.RandomState.rand"); + __pyx_r = 0; + __pyx_L0:; + Py_XDECREF(__pyx_v_args); + Py_DECREF(__pyx_v_self); + Py_XDECREF(__pyx_args); + Py_XDECREF(__pyx_kwds); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_randn[] = "Returns zero-mean, unit-variance Gaussian random numbers in an \n array of shape (d0, d1, ..., dn).\n\n randn(d0, d1, ..., dn) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_4; + static char *__pyx_argnames[] = {0}; + if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) { + Py_XDECREF(__pyx_args); + Py_XDECREF(__pyx_kwds); + Py_XDECREF(__pyx_v_args); + return 0; + } + Py_INCREF(__pyx_v_self); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":441 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;} + Py_INCREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;} + if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;} + __pyx_4 = __pyx_4 == 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":442 */ + __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; goto __pyx_L1;} + __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; goto __pyx_L1;} + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":444 */ + __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; goto __pyx_L1;} + Py_INCREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args); + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.randn"); + __pyx_r = 0; + __pyx_L0:; + Py_XDECREF(__pyx_v_args); + Py_DECREF(__pyx_v_self); + Py_XDECREF(__pyx_args); + Py_XDECREF(__pyx_kwds); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_random_integers[] = "Return random integers x such that low <= x <= high.\n\n random_integers(low, high=None, size=None) -> random values.\n\n If high is None, then 1 <= x <= low.\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_low = 0; + PyObject *__pyx_v_high = 0; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"low","high","size",0}; + __pyx_v_high = __pyx_k11; + __pyx_v_size = __pyx_k12; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OO", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_low); + Py_INCREF(__pyx_v_high); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":453 */ + __pyx_1 = __pyx_v_high == Py_None; + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":454 */ + Py_INCREF(__pyx_v_low); + Py_DECREF(__pyx_v_high); + __pyx_v_high = __pyx_v_low; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":455 */ + __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; goto __pyx_L1;} + Py_DECREF(__pyx_v_low); + __pyx_v_low = __pyx_2; + __pyx_2 = 0; + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":456 */ + __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;} + __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;} + __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;} + Py_INCREF(__pyx_v_low); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4); + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size); + __pyx_4 = 0; + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_r = __pyx_4; + __pyx_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.random_integers"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_low); + Py_DECREF(__pyx_v_high); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_standard_normal[] = "Standard Normal distribution (mean=0, stdev=1).\n\n standard_normal(size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"size",0}; + __pyx_v_size = __pyx_k13; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":464 */ + __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.standard_normal"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k66p; + +static char (__pyx_k66[]) = "scale <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_normal[] = "Normal distribution (mean=loc, stdev=scale).\n\n normal(loc=0.0, scale=1.0, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_loc; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"loc","scale","size",0}; + __pyx_v_loc = __pyx_k14; + __pyx_v_scale = __pyx_k15; + __pyx_v_size = __pyx_k16; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":471 */ + __pyx_1 = (__pyx_v_scale <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":472 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;} + Py_INCREF(__pyx_k66p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":473 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.normal"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k67p; +static PyObject *__pyx_k68p; + +static char (__pyx_k67[]) = "a <= 0"; +static char (__pyx_k68[]) = "b <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_beta[] = "Beta distribution over [0, 1].\n\n beta(a, b, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_a; + double __pyx_v_b; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"a","b","size",0}; + __pyx_v_size = __pyx_k17; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "dd|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":480 */ + __pyx_1 = (__pyx_v_a <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":481 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; goto __pyx_L1;} + Py_INCREF(__pyx_k67p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_b <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":483 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; goto __pyx_L1;} + Py_INCREF(__pyx_k68p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":484 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.beta"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k69p; + +static char (__pyx_k69[]) = "scale <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_exponential[] = "Exponential distribution.\n\n exponential(scale=1.0, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"scale","size",0}; + __pyx_v_scale = __pyx_k18; + __pyx_v_size = __pyx_k19; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|dO", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":491 */ + __pyx_1 = (__pyx_v_scale <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":492 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;} + Py_INCREF(__pyx_k69p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":493 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.exponential"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = "Standard exponential distribution (scale=1).\n\n standard_exponential(size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"size",0}; + __pyx_v_size = __pyx_k20; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":500 */ + __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.standard_exponential"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k70p; + +static char (__pyx_k70[]) = "shape <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = "Standard Gamma distribution.\n\n standard_gamma(shape, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_shape; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"shape","size",0}; + __pyx_v_size = __pyx_k21; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":507 */ + __pyx_1 = (__pyx_v_shape <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":508 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;} + Py_INCREF(__pyx_k70p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":509 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.standard_gamma"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k71p; +static PyObject *__pyx_k72p; + +static char (__pyx_k71[]) = "shape <= 0"; +static char (__pyx_k72[]) = "scale <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_gamma[] = "Gamma distribution.\n\n gamma(shape, scale=1.0, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_shape; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"shape","scale","size",0}; + __pyx_v_scale = __pyx_k22; + __pyx_v_size = __pyx_k23; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|dO", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":516 */ + __pyx_1 = (__pyx_v_shape <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":517 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; goto __pyx_L1;} + Py_INCREF(__pyx_k71p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_scale <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":519 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;} + Py_INCREF(__pyx_k72p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":520 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.gamma"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k73p; +static PyObject *__pyx_k74p; + +static char (__pyx_k73[]) = "dfnum <= 0"; +static char (__pyx_k74[]) = "dfden <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_f[] = "F distribution.\n\n f(dfnum, dfden, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_dfnum; + double __pyx_v_dfden; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"dfnum","dfden","size",0}; + __pyx_v_size = __pyx_k24; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "dd|O", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":527 */ + __pyx_1 = (__pyx_v_dfnum <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":528 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;} + Py_INCREF(__pyx_k73p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_dfden <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":530 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; goto __pyx_L1;} + Py_INCREF(__pyx_k74p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":531 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.f"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k75p; +static PyObject *__pyx_k76p; +static PyObject *__pyx_k77p; + +static char (__pyx_k75[]) = "dfnum <= 1"; +static char (__pyx_k76[]) = "dfden <= 0"; +static char (__pyx_k77[]) = "nonc < 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = "Noncentral F distribution.\n\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_dfnum; + double __pyx_v_dfden; + double __pyx_v_nonc; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"dfnum","dfden","nonc","size",0}; + __pyx_v_size = __pyx_k25; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ddd|O", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":538 */ + __pyx_1 = (__pyx_v_dfnum <= 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":539 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;} + Py_INCREF(__pyx_k75p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_dfden <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":541 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;} + Py_INCREF(__pyx_k76p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_nonc < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":543 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; goto __pyx_L1;} + Py_INCREF(__pyx_k77p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":544 */ + __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.noncentral_f"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k78p; + +static char (__pyx_k78[]) = "df <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_chisquare[] = "Chi^2 distribution.\n\n chisquare(df, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_df; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"df","size",0}; + __pyx_v_size = __pyx_k26; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":552 */ + __pyx_1 = (__pyx_v_df <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":553 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;} + Py_INCREF(__pyx_k78p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":554 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.chisquare"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k79p; +static PyObject *__pyx_k80p; + +static char (__pyx_k79[]) = "df <= 1"; +static char (__pyx_k80[]) = "nonc < 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = "Noncentral Chi^2 distribution.\n\n noncentral_chisquare(df, nonc, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_df; + double __pyx_v_nonc; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"df","nonc","size",0}; + __pyx_v_size = __pyx_k27; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "dd|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":561 */ + __pyx_1 = (__pyx_v_df <= 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":562 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; goto __pyx_L1;} + Py_INCREF(__pyx_k79p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_nonc < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":564 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; goto __pyx_L1;} + Py_INCREF(__pyx_k80p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":565 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.noncentral_chisquare"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = "Standard Cauchy with mode=0.\n\n standard_cauchy(size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + static char *__pyx_argnames[] = {"size",0}; + __pyx_v_size = __pyx_k28; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":573 */ + __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("mtrand.RandomState.standard_cauchy"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k81p; + +static char (__pyx_k81[]) = "df <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_standard_t[] = "Standard Student\'s t distribution with df degrees of freedom.\n\n standard_t(df, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_df; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"df","size",0}; + __pyx_v_size = __pyx_k29; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":580 */ + __pyx_1 = (__pyx_v_df <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":581 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; goto __pyx_L1;} + Py_INCREF(__pyx_k81p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":582 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.standard_t"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k82p; + +static char (__pyx_k82[]) = "kappa < 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_vonmises[] = "von Mises circular distribution with mode mu and dispersion parameter\n kappa on [-pi, pi].\n\n vonmises(mu, kappa, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_mu; + double __pyx_v_kappa; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"mu","kappa","size",0}; + __pyx_v_size = __pyx_k30; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "dd|O", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":590 */ + __pyx_1 = (__pyx_v_kappa < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":591 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; goto __pyx_L1;} + Py_INCREF(__pyx_k82p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":592 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.vonmises"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k83p; + +static char (__pyx_k83[]) = "a <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_pareto[] = "Pareto distribution.\n\n pareto(a, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_a; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"a","size",0}; + __pyx_v_size = __pyx_k31; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":599 */ + __pyx_1 = (__pyx_v_a <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":600 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;} + Py_INCREF(__pyx_k83p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":601 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.pareto"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k84p; + +static char (__pyx_k84[]) = "a <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_weibull[] = "Weibull distribution.\n\n weibull(a, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_a; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"a","size",0}; + __pyx_v_size = __pyx_k32; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":608 */ + __pyx_1 = (__pyx_v_a <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":609 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; goto __pyx_L1;} + Py_INCREF(__pyx_k84p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":610 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.weibull"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k85p; + +static char (__pyx_k85[]) = "a <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_power[] = "Power distribution.\n\n power(a, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_a; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"a","size",0}; + __pyx_v_size = __pyx_k33; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":617 */ + __pyx_1 = (__pyx_v_a <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":618 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} + Py_INCREF(__pyx_k85p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":619 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.power"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k86p; + +static char (__pyx_k86[]) = "scale <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_laplace[] = "Laplace distribution.\n \n laplace(loc=0.0, scale=1.0, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_loc; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"loc","scale","size",0}; + __pyx_v_loc = __pyx_k34; + __pyx_v_scale = __pyx_k35; + __pyx_v_size = __pyx_k36; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":626 */ + __pyx_1 = (__pyx_v_scale <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":627 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; goto __pyx_L1;} + Py_INCREF(__pyx_k86p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":628 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.laplace"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k87p; + +static char (__pyx_k87[]) = "scale <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_gumbel[] = "Gumbel distribution.\n \n gumbel(loc=0.0, scale=1.0, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_loc; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"loc","scale","size",0}; + __pyx_v_loc = __pyx_k37; + __pyx_v_scale = __pyx_k38; + __pyx_v_size = __pyx_k39; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":635 */ + __pyx_1 = (__pyx_v_scale <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":636 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;} + Py_INCREF(__pyx_k87p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":637 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.gumbel"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k88p; + +static char (__pyx_k88[]) = "scale <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_logistic[] = "Logistic distribution.\n \n logistic(loc=0.0, scale=1.0, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_loc; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"loc","scale","size",0}; + __pyx_v_loc = __pyx_k40; + __pyx_v_scale = __pyx_k41; + __pyx_v_size = __pyx_k42; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":644 */ + __pyx_1 = (__pyx_v_scale <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":645 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; goto __pyx_L1;} + Py_INCREF(__pyx_k88p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":646 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.logistic"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k89p; + +static char (__pyx_k89[]) = "sigma <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_lognormal[] = "Log-normal distribution.\n \n Note that the mean parameter is not the mean of this distribution, but \n the underlying normal distribution.\n \n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n \n lognormal(mean=0.0, sigma=1.0, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_mean; + double __pyx_v_sigma; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"mean","sigma","size",0}; + __pyx_v_mean = __pyx_k43; + __pyx_v_sigma = __pyx_k44; + __pyx_v_size = __pyx_k45; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|ddO", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":658 */ + __pyx_1 = (__pyx_v_sigma <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":659 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; goto __pyx_L1;} + Py_INCREF(__pyx_k89p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":660 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.lognormal"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k90p; + +static char (__pyx_k90[]) = "scale <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = "Rayleigh distribution.\n \n rayleigh(scale=1.0, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"scale","size",0}; + __pyx_v_scale = __pyx_k46; + __pyx_v_size = __pyx_k47; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|dO", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":667 */ + __pyx_1 = (__pyx_v_scale <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":668 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; goto __pyx_L1;} + Py_INCREF(__pyx_k90p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":669 */ + __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.rayleigh"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k91p; +static PyObject *__pyx_k92p; + +static char (__pyx_k91[]) = "mean <= 0.0"; +static char (__pyx_k92[]) = "scale <= 0.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_wald[] = "Wald (inverse Gaussian) distribution.\n \n wald(mean, scale, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_mean; + double __pyx_v_scale; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"mean","scale","size",0}; + __pyx_v_size = __pyx_k48; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "dd|O", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":676 */ + __pyx_1 = (__pyx_v_mean <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":677 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;} + Py_INCREF(__pyx_k91p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_scale <= 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":679 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; goto __pyx_L1;} + Py_INCREF(__pyx_k92p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":680 */ + __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.wald"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k93p; +static PyObject *__pyx_k94p; +static PyObject *__pyx_k95p; + +static char (__pyx_k93[]) = "left > mode"; +static char (__pyx_k94[]) = "mode > right"; +static char (__pyx_k95[]) = "left == right"; + +static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_triangular[] = "Triangular distribution starting at left, peaking at mode, and \n ending at right (left <= mode <= right).\n \n triangular(left, mode, right, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_left; + double __pyx_v_mode; + double __pyx_v_right; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"left","mode","right","size",0}; + __pyx_v_size = __pyx_k49; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ddd|O", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":688 */ + __pyx_1 = (__pyx_v_left > __pyx_v_mode); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":689 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;} + Py_INCREF(__pyx_k93p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_mode > __pyx_v_right); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":691 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;} + Py_INCREF(__pyx_k94p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_left == __pyx_v_right); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":693 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; goto __pyx_L1;} + Py_INCREF(__pyx_k95p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":694 */ + __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.triangular"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k96p; +static PyObject *__pyx_k97p; +static PyObject *__pyx_k98p; + +static char (__pyx_k96[]) = "n <= 0"; +static char (__pyx_k97[]) = "p < 0"; +static char (__pyx_k98[]) = "p > 1"; + +static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_binomial[] = "Binomial distribution of n trials and p probability of success.\n\n binomial(n, p, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + long __pyx_v_n; + double __pyx_v_p; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"n","p","size",0}; + __pyx_v_size = __pyx_k50; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ld|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":703 */ + __pyx_1 = (__pyx_v_n <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":704 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;} + Py_INCREF(__pyx_k96p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":706 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; goto __pyx_L1;} + Py_INCREF(__pyx_k97p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p > 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":708 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; goto __pyx_L1;} + Py_INCREF(__pyx_k98p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":709 */ + __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.binomial"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k99p; +static PyObject *__pyx_k100p; +static PyObject *__pyx_k101p; + +static char (__pyx_k99[]) = "n <= 0"; +static char (__pyx_k100[]) = "p < 0"; +static char (__pyx_k101[]) = "p > 1"; + +static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = "Negative Binomial distribution.\n\n negative_binomial(n, p, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + long __pyx_v_n; + double __pyx_v_p; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"n","p","size",0}; + __pyx_v_size = __pyx_k51; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ld|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":716 */ + __pyx_1 = (__pyx_v_n <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":717 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;} + Py_INCREF(__pyx_k99p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":719 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; goto __pyx_L1;} + Py_INCREF(__pyx_k100p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p > 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":721 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; goto __pyx_L1;} + Py_INCREF(__pyx_k101p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":722 */ + __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.negative_binomial"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k102p; + +static char (__pyx_k102[]) = "lam <= 0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_poisson[] = "Poisson distribution.\n\n poisson(lam=1.0, size=None) -> random values\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_lam; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"lam","size",0}; + __pyx_v_lam = __pyx_k52; + __pyx_v_size = __pyx_k53; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|dO", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":730 */ + __pyx_1 = (__pyx_v_lam <= 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":731 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; goto __pyx_L1;} + Py_INCREF(__pyx_k102p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":732 */ + __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.poisson"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k103p; + +static char (__pyx_k103[]) = "a <= 1.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_zipf[] = "Zipf distribution.\n \n zipf(a, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_a; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"a","size",0}; + __pyx_v_size = __pyx_k54; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":739 */ + __pyx_1 = (__pyx_v_a <= 1.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":740 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; goto __pyx_L1;} + Py_INCREF(__pyx_k103p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":741 */ + __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.zipf"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k104p; +static PyObject *__pyx_k105p; + +static char (__pyx_k104[]) = "p < 0.0"; +static char (__pyx_k105[]) = "p > 1.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_geometric[] = "Geometric distribution with p being the probability of \"success\" on\n an individual trial.\n \n geometric(p, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"p","size",0}; + __pyx_v_size = __pyx_k55; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":749 */ + __pyx_1 = (__pyx_v_p < 0.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":750 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; goto __pyx_L1;} + Py_INCREF(__pyx_k104p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p > 1.0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":752 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;} + Py_INCREF(__pyx_k105p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":753 */ + __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.geometric"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k106p; +static PyObject *__pyx_k107p; +static PyObject *__pyx_k108p; +static PyObject *__pyx_k109p; + +static char (__pyx_k106[]) = "ngood < 1"; +static char (__pyx_k107[]) = "nbad < 1"; +static char (__pyx_k108[]) = "ngood + nbad < nsample"; +static char (__pyx_k109[]) = "nsample < 1"; + +static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = "Hypergeometric distribution.\n \n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n were to draw nsample balls from the urn without replacement, then \n the hypergeometric distribution describes the distribution of \"good\" \n balls in the sample.\n \n hypergeometric(ngood, nbad, nsample, size=None) \n "; +static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + long __pyx_v_ngood; + long __pyx_v_nbad; + long __pyx_v_nsample; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"ngood","nbad","nsample","size",0}; + __pyx_v_size = __pyx_k56; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lll|O", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":765 */ + __pyx_1 = (__pyx_v_ngood < 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":766 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;} + Py_INCREF(__pyx_k106p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_nbad < 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":768 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;} + Py_INCREF(__pyx_k107p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":770 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; goto __pyx_L1;} + Py_INCREF(__pyx_k108p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_nsample < 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":772 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; goto __pyx_L1;} + Py_INCREF(__pyx_k109p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":773 */ + __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.hypergeometric"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_k110p; +static PyObject *__pyx_k111p; + +static char (__pyx_k110[]) = "p < 0"; +static char (__pyx_k111[]) = "p > 1"; + +static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_logseries[] = "Logarithmic series distribution.\n \n logseries(p, size=None)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + static char *__pyx_argnames[] = {"p","size",0}; + __pyx_v_size = __pyx_k57; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_size); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":781 */ + __pyx_1 = (__pyx_v_p < 0); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":782 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; goto __pyx_L1;} + Py_INCREF(__pyx_k110p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_p > 1); + if (__pyx_1) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":784 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; goto __pyx_L1;} + Py_INCREF(__pyx_k111p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":785 */ + __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;} + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("mtrand.RandomState.logseries"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_n_array; +static PyObject *__pyx_n_shape; +static PyObject *__pyx_n_ArgumentError; +static PyObject *__pyx_n_isinstance; +static PyObject *__pyx_n_list; +static PyObject *__pyx_n_append; +static PyObject *__pyx_n_multiply; +static PyObject *__pyx_n_reduce; +static PyObject *__pyx_n_svd; +static PyObject *__pyx_n_matrixmultiply; +static PyObject *__pyx_n_sqrt; +static PyObject *__pyx_n_add; +static PyObject *__pyx_n_tuple; + +static PyObject *__pyx_k112p; +static PyObject *__pyx_k113p; +static PyObject *__pyx_k114p; +static PyObject *__pyx_k115p; + +static char (__pyx_k112[]) = "mean must be 1 dimensional"; +static char (__pyx_k113[]) = "cov must be 2 dimensional and square"; +static char (__pyx_k114[]) = "mean and cov must have same length"; +static char (__pyx_k115[]) = "scipy.corelinalg"; + +static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = "Return an array containing multivariate normally distributed random numbers\n with specified mean and covariance.\n\n multivariate_normal(mean, cov) -> random values\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n mean must be a 1 dimensional array. cov must be a square two dimensional\n array with the same number of rows and columns as mean has elements.\n\n The first form returns a single 1-D array containing a multivariate\n normal.\n\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n normal.\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_mean = 0; + PyObject *__pyx_v_cov = 0; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_v_shape; + PyObject *__pyx_v_final_shape; + PyObject *__pyx_v_x; + PyObject *__pyx_v_svd; + PyObject *__pyx_v_u; + PyObject *__pyx_v_s; + PyObject *__pyx_v_v; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_4; + PyObject *__pyx_5 = 0; + static char *__pyx_argnames[] = {"mean","cov","size",0}; + __pyx_v_size = __pyx_k58; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_mean); + Py_INCREF(__pyx_v_cov); + Py_INCREF(__pyx_v_size); + __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape); + __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape); + __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x); + __pyx_v_svd = Py_None; Py_INCREF(__pyx_v_svd); + __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u); + __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s); + __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":806 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;} + Py_INCREF(__pyx_v_mean); + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean); + __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_v_mean); + __pyx_v_mean = __pyx_3; + __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":807 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;} + Py_INCREF(__pyx_v_cov); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov); + __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_v_cov); + __pyx_v_cov = __pyx_2; + __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":808 */ + __pyx_4 = __pyx_v_size == Py_None; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":809 */ + __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;} + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_1; + __pyx_1 = 0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":811 */ + Py_INCREF(__pyx_v_size); + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_v_size; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":812 */ + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;} + __pyx_4 = __pyx_4 != 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":813 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;} + Py_INCREF(__pyx_k112p); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_Raise(__pyx_3, 0, 0); + Py_DECREF(__pyx_3); __pyx_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":814 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_4 = __pyx_4 != 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (!__pyx_4) { + __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;} + __pyx_4 = __pyx_4 != 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + } + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":815 */ + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;} + Py_INCREF(__pyx_k113p); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p); + __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_Raise(__pyx_1, 0, 0); + Py_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":816 */ + __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} + __pyx_4 = __pyx_4 != 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":817 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;} + __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;} + Py_INCREF(__pyx_k114p); + PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k114p); + __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + __Pyx_Raise(__pyx_2, 0, 0); + Py_DECREF(__pyx_2); __pyx_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":819 */ + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; goto __pyx_L1;} + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; goto __pyx_L1;} + __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; goto __pyx_L1;} + Py_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape); + PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1); + __pyx_1 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":820 */ + __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; goto __pyx_L1;} + Py_INCREF(__pyx_v_shape); + PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape); + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_1; + __pyx_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":821 */ + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;} + __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5); + __pyx_5 = 0; + __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_v_final_shape); + __pyx_v_final_shape = __pyx_1; + __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":822 */ + __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); + __pyx_1 = 0; + __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":826 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + Py_INCREF(__pyx_v_final_shape); + PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape); + __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); + __pyx_3 = 0; + __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_5; + __pyx_5 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":827 */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_INCREF(__pyx_v_final_shape); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape); + __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1); + __pyx_1 = 0; + __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;} + __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;} + __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); + PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5); + __pyx_3 = 0; + __pyx_5 = 0; + if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":836 */ + __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;} + Py_INCREF(__pyx_n_svd); + PyList_SET_ITEM(__pyx_2, 0, __pyx_n_svd); + __pyx_3 = __Pyx_Import(__pyx_k115p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_svd); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;} + Py_DECREF(__pyx_v_svd); + __pyx_v_svd = __pyx_5; + __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":838 */ + __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_INCREF(__pyx_v_cov); + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov); + __pyx_2 = PyObject_CallObject(__pyx_v_svd, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_DECREF(__pyx_v_u); + __pyx_v_u = __pyx_3; + __pyx_3 = 0; + __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_5; + __pyx_5 = 0; + __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_1; + __pyx_1 = 0; + if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":839 */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s); + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + Py_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v); + __pyx_2 = 0; + __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_1; + __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":842 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;} + __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;} + Py_INCREF(__pyx_v_mean); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean); + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x); + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x); + __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":843 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;} + __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;} + Py_INCREF(__pyx_v_final_shape); + PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape); + __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; + if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":844 */ + Py_INCREF(__pyx_v_x); + __pyx_r = __pyx_v_x; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_5); + __Pyx_AddTraceback("mtrand.RandomState.multivariate_normal"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_shape); + Py_DECREF(__pyx_v_final_shape); + Py_DECREF(__pyx_v_x); + Py_DECREF(__pyx_v_svd); + Py_DECREF(__pyx_v_u); + Py_DECREF(__pyx_v_s); + Py_DECREF(__pyx_v_v); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_mean); + Py_DECREF(__pyx_v_cov); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_n_zeros; + +static PyObject *__pyx_k117p; + +static char (__pyx_k117[]) = "sum(pvals) > 1.0"; + +static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_multinomial[] = "Multinomial distribution.\n \n multinomial(n, pvals, size=None) -> random values\n\n pvals is a sequence of probabilities that should sum to 1 (however, the\n last element is always assumed to account for the remaining probability\n as long as sum(pvals[:-1]) <= 1).\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + long __pyx_v_n; + PyObject *__pyx_v_pvals = 0; + PyObject *__pyx_v_size = 0; + long __pyx_v_d; + PyArrayObject *arrayObject_parr; + PyArrayObject *arrayObject_mnarr; + double (*__pyx_v_pix); + long (*__pyx_v_mnix); + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_dn; + double __pyx_v_Sum; + PyObject *__pyx_v_shape; + PyObject *__pyx_v_multin; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + long __pyx_4; + int __pyx_5; + static char *__pyx_argnames[] = {"n","pvals","size",0}; + __pyx_v_size = __pyx_k59; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lO|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_pvals); + Py_INCREF(__pyx_v_size); + arrayObject_parr = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_parr); + arrayObject_mnarr = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_mnarr); + __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape); + __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":862 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;} + Py_INCREF(__pyx_v_pvals); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_v_d = __pyx_4; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":863 */ + __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; goto __pyx_L1;} + Py_INCREF(((PyObject *)__pyx_1)); + Py_DECREF(((PyObject *)arrayObject_parr)); + arrayObject_parr = ((PyArrayObject *)__pyx_1); + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":864 */ + __pyx_v_pix = ((double (*))arrayObject_parr->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":866 */ + __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0); + if (__pyx_5) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":867 */ + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;} + Py_INCREF(__pyx_k117p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k117p); + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_1, 0, 0); + Py_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;} + goto __pyx_L2; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":869 */ + __pyx_5 = __pyx_v_size == Py_None; + if (__pyx_5) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":870 */ + __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __pyx_2 = 0; + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_3; + __pyx_3 = 0; + goto __pyx_L3; + } + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;} + __pyx_5 = __pyx_3 == __pyx_1; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_5) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":872 */ + __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;} + __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;} + Py_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); + __pyx_2 = 0; + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_3; + __pyx_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":874 */ + __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); + __pyx_1 = 0; + __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_v_shape); + __pyx_v_shape = __pyx_3; + __pyx_3 = 0; + } + __pyx_L3:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":876 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + Py_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1); + __pyx_1 = 0; + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_v_multin); + __pyx_v_multin = __pyx_1; + __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":877 */ + Py_INCREF(((PyObject *)__pyx_v_multin)); + Py_DECREF(((PyObject *)arrayObject_mnarr)); + arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":878 */ + __pyx_v_mnix = ((long (*))arrayObject_mnarr->data); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":879 */ + __pyx_v_i = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":880 */ + while (1) { + __pyx_5 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr)); + if (!__pyx_5) break; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":881 */ + __pyx_v_Sum = 1.0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":882 */ + __pyx_v_dn = __pyx_v_n; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":883 */ + __pyx_4 = (__pyx_v_d - 1); + for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":884 */ + (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]) = rk_binomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,__pyx_v_dn,((__pyx_v_pix[__pyx_v_j]) / __pyx_v_Sum)); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":885 */ + __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)])); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":886 */ + __pyx_5 = (__pyx_v_dn <= 0); + if (__pyx_5) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":887 */ + goto __pyx_L7; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":888 */ + __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j])); + } + __pyx_L7:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":889 */ + __pyx_5 = (__pyx_v_dn > 0); + if (__pyx_5) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":890 */ + (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":892 */ + __pyx_v_i = (__pyx_v_i + __pyx_v_d); + } + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":894 */ + Py_INCREF(__pyx_v_multin); + __pyx_r = __pyx_v_multin; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.multinomial"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(arrayObject_parr); + Py_DECREF(arrayObject_mnarr); + Py_DECREF(__pyx_v_shape); + Py_DECREF(__pyx_v_multin); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_pvals); + Py_DECREF(__pyx_v_size); + return __pyx_r; +} + +static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_shuffle[] = "Modify a sequence in-place by shuffling its contents.\n \n shuffle(x)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_x = 0; + long __pyx_v_i; + long __pyx_v_j; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + long __pyx_4; + int __pyx_5; + static char *__pyx_argnames[] = {"x",0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_x)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_x); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":905 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_v_i = __pyx_4; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":906 */ + while (1) { + __pyx_5 = (__pyx_v_i > 0); + if (!__pyx_5) break; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":907 */ + __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":908 */ + __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":909 */ + __pyx_v_i = (__pyx_v_i - 1); + } + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.shuffle"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_x); + return __pyx_r; +} + +static PyObject *__pyx_n_arange; + +static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6mtrand_11RandomState_permutation[] = "Given an integer, return a shuffled sequence of integers >= 0 and \n < x; given a sequence, return a shuffled array copy.\n\n permutation(x)\n "; +static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_x = 0; + PyObject *__pyx_v_arr; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_4; + static char *__pyx_argnames[] = {"x",0}; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_x)) return 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_x); + __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":917 */ + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;} + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;} + __pyx_4 = __pyx_3 == __pyx_1; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_4) { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":918 */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;} + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x); + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_2; + __pyx_2 = 0; + goto __pyx_L2; + } + /*else*/ { + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":920 */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;} + Py_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_3; + __pyx_3 = 0; + } + __pyx_L2:; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":921 */ + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;} + Py_INCREF(__pyx_v_arr); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr); + __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":922 */ + Py_INCREF(__pyx_v_arr); + __pyx_r = __pyx_v_arr; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(__pyx_r); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_AddTraceback("mtrand.RandomState.permutation"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_arr); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_x); + return __pyx_r; +} + +static __Pyx_InternTabEntry __pyx_intern_tab[] = { + {&__pyx_n_ArgumentError, "ArgumentError"}, + {&__pyx_n_Float64, "Float64"}, + {&__pyx_n_Int, "Int"}, + {&__pyx_n_MT19937, "MT19937"}, + {&__pyx_n_ValueError, "ValueError"}, + {&__pyx_n___RandomState_ctor, "__RandomState_ctor"}, + {&__pyx_n__rand, "_rand"}, + {&__pyx_n__sp, "_sp"}, + {&__pyx_n_add, "add"}, + {&__pyx_n_append, "append"}, + {&__pyx_n_arange, "arange"}, + {&__pyx_n_array, "array"}, + {&__pyx_n_beta, "beta"}, + {&__pyx_n_binomial, "binomial"}, + {&__pyx_n_bytes, "bytes"}, + {&__pyx_n_chisquare, "chisquare"}, + {&__pyx_n_empty, "empty"}, + {&__pyx_n_exponential, "exponential"}, + {&__pyx_n_f, "f"}, + {&__pyx_n_gamma, "gamma"}, + {&__pyx_n_geometric, "geometric"}, + {&__pyx_n_get_state, "get_state"}, + {&__pyx_n_gumbel, "gumbel"}, + {&__pyx_n_hypergeometric, "hypergeometric"}, + {&__pyx_n_int, "int"}, + {&__pyx_n_isinstance, "isinstance"}, + {&__pyx_n_laplace, "laplace"}, + {&__pyx_n_len, "len"}, + {&__pyx_n_list, "list"}, + {&__pyx_n_logistic, "logistic"}, + {&__pyx_n_lognormal, "lognormal"}, + {&__pyx_n_logseries, "logseries"}, + {&__pyx_n_matrixmultiply, "matrixmultiply"}, + {&__pyx_n_multinomial, "multinomial"}, + {&__pyx_n_multiply, "multiply"}, + {&__pyx_n_multivariate_normal, "multivariate_normal"}, + {&__pyx_n_negative_binomial, "negative_binomial"}, + {&__pyx_n_noncentral_chisquare, "noncentral_chisquare"}, + {&__pyx_n_noncentral_f, "noncentral_f"}, + {&__pyx_n_normal, "normal"}, + {&__pyx_n_pareto, "pareto"}, + {&__pyx_n_permutation, "permutation"}, + {&__pyx_n_poisson, "poisson"}, + {&__pyx_n_power, "power"}, + {&__pyx_n_rand, "rand"}, + {&__pyx_n_randint, "randint"}, + {&__pyx_n_randn, "randn"}, + {&__pyx_n_random, "random"}, + {&__pyx_n_random_integers, "random_integers"}, + {&__pyx_n_random_sample, "random_sample"}, + {&__pyx_n_rayleigh, "rayleigh"}, + {&__pyx_n_reduce, "reduce"}, + {&__pyx_n_scipy, "scipy"}, + {&__pyx_n_seed, "seed"}, + {&__pyx_n_set_state, "set_state"}, + {&__pyx_n_shape, "shape"}, + {&__pyx_n_shuffle, "shuffle"}, + {&__pyx_n_size, "size"}, + {&__pyx_n_sqrt, "sqrt"}, + {&__pyx_n_standard_cauchy, "standard_cauchy"}, + {&__pyx_n_standard_exponential, "standard_exponential"}, + {&__pyx_n_standard_gamma, "standard_gamma"}, + {&__pyx_n_standard_normal, "standard_normal"}, + {&__pyx_n_standard_t, "standard_t"}, + {&__pyx_n_svd, "svd"}, + {&__pyx_n_triangular, "triangular"}, + {&__pyx_n_tuple, "tuple"}, + {&__pyx_n_type, "type"}, + {&__pyx_n_uniform, "uniform"}, + {&__pyx_n_vonmises, "vonmises"}, + {&__pyx_n_wald, "wald"}, + {&__pyx_n_weibull, "weibull"}, + {&__pyx_n_zeros, "zeros"}, + {&__pyx_n_zipf, "zipf"}, + {0, 0} +}; + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)}, + {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)}, + {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)}, + {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)}, + {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)}, + {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)}, + {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)}, + {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)}, + {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)}, + {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)}, + {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)}, + {&__pyx_k74p, __pyx_k74, sizeof(__pyx_k74)}, + {&__pyx_k75p, __pyx_k75, sizeof(__pyx_k75)}, + {&__pyx_k76p, __pyx_k76, sizeof(__pyx_k76)}, + {&__pyx_k77p, __pyx_k77, sizeof(__pyx_k77)}, + {&__pyx_k78p, __pyx_k78, sizeof(__pyx_k78)}, + {&__pyx_k79p, __pyx_k79, sizeof(__pyx_k79)}, + {&__pyx_k80p, __pyx_k80, sizeof(__pyx_k80)}, + {&__pyx_k81p, __pyx_k81, sizeof(__pyx_k81)}, + {&__pyx_k82p, __pyx_k82, sizeof(__pyx_k82)}, + {&__pyx_k83p, __pyx_k83, sizeof(__pyx_k83)}, + {&__pyx_k84p, __pyx_k84, sizeof(__pyx_k84)}, + {&__pyx_k85p, __pyx_k85, sizeof(__pyx_k85)}, + {&__pyx_k86p, __pyx_k86, sizeof(__pyx_k86)}, + {&__pyx_k87p, __pyx_k87, sizeof(__pyx_k87)}, + {&__pyx_k88p, __pyx_k88, sizeof(__pyx_k88)}, + {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)}, + {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)}, + {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)}, + {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)}, + {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)}, + {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)}, + {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)}, + {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)}, + {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)}, + {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)}, + {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)}, + {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)}, + {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)}, + {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)}, + {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)}, + {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)}, + {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)}, + {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)}, + {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)}, + {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)}, + {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)}, + {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)}, + {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)}, + {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)}, + {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)}, + {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)}, + {&__pyx_k115p, __pyx_k115, sizeof(__pyx_k115)}, + {&__pyx_k117p, __pyx_k117, sizeof(__pyx_k117)}, + {0, 0, 0} +}; + +static PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o; + return o; +} + +static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++o->ob_refcnt; + __pyx_f_6mtrand_11RandomState___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --o->ob_refcnt; + PyErr_Restore(etype, eval, etb); + } + (*o->ob_type->tp_free)(o); +} + +static int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) { + return 0; +} + +static int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) { + return 0; +} + +static struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = { + {"seed", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed}, + {"get_state", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state}, + {"set_state", (PyCFunction)__pyx_f_6mtrand_11RandomState_set_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_set_state}, + {"__getstate__", (PyCFunction)__pyx_f_6mtrand_11RandomState___getstate__, METH_VARARGS|METH_KEYWORDS, 0}, + {"__setstate__", (PyCFunction)__pyx_f_6mtrand_11RandomState___setstate__, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce__", (PyCFunction)__pyx_f_6mtrand_11RandomState___reduce__, METH_VARARGS|METH_KEYWORDS, 0}, + {"random_sample", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_sample}, + {"tomaxint", (PyCFunction)__pyx_f_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_tomaxint}, + {"randint", (PyCFunction)__pyx_f_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randint}, + {"bytes", (PyCFunction)__pyx_f_6mtrand_11RandomState_bytes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_bytes}, + {"uniform", (PyCFunction)__pyx_f_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_uniform}, + {"rand", (PyCFunction)__pyx_f_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rand}, + {"randn", (PyCFunction)__pyx_f_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randn}, + {"random_integers", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_integers}, + {"standard_normal", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_normal}, + {"normal", (PyCFunction)__pyx_f_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_normal}, + {"beta", (PyCFunction)__pyx_f_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_beta}, + {"exponential", (PyCFunction)__pyx_f_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_exponential}, + {"standard_exponential", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_exponential}, + {"standard_gamma", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_gamma}, + {"gamma", (PyCFunction)__pyx_f_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gamma}, + {"f", (PyCFunction)__pyx_f_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_f}, + {"noncentral_f", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_f}, + {"chisquare", (PyCFunction)__pyx_f_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_chisquare}, + {"noncentral_chisquare", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_chisquare}, + {"standard_cauchy", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_cauchy}, + {"standard_t", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_t}, + {"vonmises", (PyCFunction)__pyx_f_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_vonmises}, + {"pareto", (PyCFunction)__pyx_f_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_pareto}, + {"weibull", (PyCFunction)__pyx_f_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_weibull}, + {"power", (PyCFunction)__pyx_f_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_power}, + {"laplace", (PyCFunction)__pyx_f_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_laplace}, + {"gumbel", (PyCFunction)__pyx_f_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gumbel}, + {"logistic", (PyCFunction)__pyx_f_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logistic}, + {"lognormal", (PyCFunction)__pyx_f_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_lognormal}, + {"rayleigh", (PyCFunction)__pyx_f_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rayleigh}, + {"wald", (PyCFunction)__pyx_f_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_wald}, + {"triangular", (PyCFunction)__pyx_f_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_triangular}, + {"binomial", (PyCFunction)__pyx_f_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_binomial}, + {"negative_binomial", (PyCFunction)__pyx_f_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_negative_binomial}, + {"poisson", (PyCFunction)__pyx_f_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_poisson}, + {"zipf", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf}, + {"geometric", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric}, + {"hypergeometric", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric}, + {"logseries", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries}, + {"multivariate_normal", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal}, + {"multinomial", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial}, + {"shuffle", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle}, + {"permutation", (PyCFunction)__pyx_f_6mtrand_11RandomState_permutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_permutation}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_RandomState = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + 0, /*nb_divide*/ + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + 0, /*nb_coerce*/ + 0, /*nb_int*/ + 0, /*nb_long*/ + 0, /*nb_float*/ + 0, /*nb_oct*/ + 0, /*nb_hex*/ + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + 0, /*nb_inplace_divide*/ + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ +}; + +static PySequenceMethods __pyx_tp_as_sequence_RandomState = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_RandomState = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_RandomState = { + 0, /*bf_getreadbuffer*/ + 0, /*bf_getwritebuffer*/ + 0, /*bf_getsegcount*/ + 0, /*bf_getcharbuffer*/ +}; + +statichere PyTypeObject __pyx_type_6mtrand_RandomState = { + PyObject_HEAD_INIT(0) + 0, /*ob_size*/ + "mtrand.RandomState", /*tp_name*/ + sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6mtrand_RandomState, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_RandomState, /*tp_as_number*/ + &__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_RandomState, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D scipy array filled with generated values\n is returned. If size is a tuple, then a scipy array with that shape is\n filled and returned.\n ", /*tp_doc*/ + __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/ + __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6mtrand_RandomState, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_f_6mtrand_11RandomState___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6mtrand_RandomState, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +DL_EXPORT(void) initmtrand(void); /*proto*/ +DL_EXPORT(void) initmtrand(void) { + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + __pyx_m = Py_InitModule4("mtrand", __pyx_methods, 0, 0, PYTHON_API_VERSION); + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; + __pyx_b = PyImport_AddModule("__builtin__"); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; + if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; + __pyx_ptype_6mtrand_dtypedescr = __Pyx_ImportType("scipy", "dtypedescr", sizeof(PyArray_Descr)); if (!__pyx_ptype_6mtrand_dtypedescr) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; goto __pyx_L1;} + __pyx_ptype_6mtrand_ndarray = __Pyx_ImportType("scipy", "ndarray", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ndarray) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; goto __pyx_L1;} + if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;} + if (PyObject_SetAttrString(__pyx_m, "RandomState", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;} + __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":118 */ + import_array(); + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":120 */ + __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} + if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":286 */ + Py_INCREF(Py_None); + __pyx_k2 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":295 */ + Py_INCREF(Py_None); + __pyx_k3 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":356 */ + Py_INCREF(Py_None); + __pyx_k4 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":363 */ + Py_INCREF(Py_None); + __pyx_k5 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":370 */ + Py_INCREF(Py_None); + __pyx_k6 = Py_None; + Py_INCREF(Py_None); + __pyx_k7 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":416 */ + __pyx_k8 = 0.0; + __pyx_k9 = 1.0; + Py_INCREF(Py_None); + __pyx_k10 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":446 */ + Py_INCREF(Py_None); + __pyx_k11 = Py_None; + Py_INCREF(Py_None); + __pyx_k12 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":459 */ + Py_INCREF(Py_None); + __pyx_k13 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":466 */ + __pyx_k14 = 0.0; + __pyx_k15 = 1.0; + Py_INCREF(Py_None); + __pyx_k16 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":475 */ + Py_INCREF(Py_None); + __pyx_k17 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":486 */ + __pyx_k18 = 1.0; + Py_INCREF(Py_None); + __pyx_k19 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":495 */ + Py_INCREF(Py_None); + __pyx_k20 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":502 */ + Py_INCREF(Py_None); + __pyx_k21 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":511 */ + __pyx_k22 = 1.0; + Py_INCREF(Py_None); + __pyx_k23 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":522 */ + Py_INCREF(Py_None); + __pyx_k24 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":533 */ + Py_INCREF(Py_None); + __pyx_k25 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":547 */ + Py_INCREF(Py_None); + __pyx_k26 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":556 */ + Py_INCREF(Py_None); + __pyx_k27 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":568 */ + Py_INCREF(Py_None); + __pyx_k28 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":575 */ + Py_INCREF(Py_None); + __pyx_k29 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":584 */ + Py_INCREF(Py_None); + __pyx_k30 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":594 */ + Py_INCREF(Py_None); + __pyx_k31 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":603 */ + Py_INCREF(Py_None); + __pyx_k32 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":612 */ + Py_INCREF(Py_None); + __pyx_k33 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":621 */ + __pyx_k34 = 0.0; + __pyx_k35 = 1.0; + Py_INCREF(Py_None); + __pyx_k36 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":630 */ + __pyx_k37 = 0.0; + __pyx_k38 = 1.0; + Py_INCREF(Py_None); + __pyx_k39 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":639 */ + __pyx_k40 = 0.0; + __pyx_k41 = 1.0; + Py_INCREF(Py_None); + __pyx_k42 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":648 */ + __pyx_k43 = 0.0; + __pyx_k44 = 1.0; + Py_INCREF(Py_None); + __pyx_k45 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":662 */ + __pyx_k46 = 1.0; + Py_INCREF(Py_None); + __pyx_k47 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":671 */ + Py_INCREF(Py_None); + __pyx_k48 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":682 */ + Py_INCREF(Py_None); + __pyx_k49 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":698 */ + Py_INCREF(Py_None); + __pyx_k50 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":711 */ + Py_INCREF(Py_None); + __pyx_k51 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":725 */ + __pyx_k52 = 1.0; + Py_INCREF(Py_None); + __pyx_k53 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":734 */ + Py_INCREF(Py_None); + __pyx_k54 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":743 */ + Py_INCREF(Py_None); + __pyx_k55 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":755 */ + Py_INCREF(Py_None); + __pyx_k56 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":776 */ + Py_INCREF(Py_None); + __pyx_k57 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":788 */ + Py_INCREF(Py_None); + __pyx_k58 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":846 */ + Py_INCREF(Py_None); + __pyx_k59 = Py_None; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":924 */ + __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;} + __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":925 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_seed); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_seed, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":926 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":927 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":928 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":929 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":930 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":931 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":932 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":933 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":934 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":935 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":936 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":937 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":938 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":939 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":940 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":941 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":942 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":943 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":944 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":945 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":946 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":947 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":948 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":949 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":950 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":951 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":952 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":953 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":954 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":955 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":956 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":957 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":958 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":960 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":961 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":962 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":963 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":964 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":965 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":966 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":968 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":969 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":971 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + + /* "/home/oliphant/core/scipy/lib/mtrand/mtrand.pyx":972 */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + return; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + __Pyx_AddTraceback("mtrand"); +} + +static char *__pyx_filenames[] = { + "mtrand.pyx", + "scipy.pxi", +}; +statichere char **__pyx_f = __pyx_filenames; + +/* Runtime support code */ + +static int __Pyx_GetStarArgs( + PyObject **args, + PyObject **kwds, + char *kwd_list[], + int nargs, + PyObject **args2, + PyObject **kwds2) +{ + PyObject *x = 0, *args1 = 0, *kwds1 = 0; + + if (args2) + *args2 = 0; + if (kwds2) + *kwds2 = 0; + + if (args2) { + args1 = PyTuple_GetSlice(*args, 0, nargs); + if (!args1) + goto bad; + *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args)); + if (!*args2) + goto bad; + } + else { + args1 = *args; + Py_INCREF(args1); + } + + if (kwds2) { + if (*kwds) { + char **p; + kwds1 = PyDict_New(); + if (!kwds) + goto bad; + *kwds2 = PyDict_Copy(*kwds); + if (!*kwds2) + goto bad; + for (p = kwd_list; *p; p++) { + x = PyDict_GetItemString(*kwds, *p); + if (x) { + if (PyDict_SetItemString(kwds1, *p, x) < 0) + goto bad; + if (PyDict_DelItemString(*kwds2, *p) < 0) + goto bad; + } + } + } + else { + *kwds2 = PyDict_New(); + if (!*kwds2) + goto bad; + } + } + else { + kwds1 = *kwds; + Py_XINCREF(kwds1); + } + + *args = args1; + *kwds = kwds1; + return 0; +bad: + Py_XDECREF(args1); + Py_XDECREF(kwds1); + Py_XDECREF(*args2); + Py_XDECREF(*kwds2); + return -1; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + if (!__import__) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunction(__import__, "OOOO", + name, global_dict, empty_dict, list); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static void __Pyx_WriteUnraisable(char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + PyErr_Fetch(&old_exc, &old_val, &old_tb); + ctx = PyString_FromString(name); + PyErr_Restore(old_exc, old_val, old_tb); + if (!ctx) + ctx = Py_None; + PyErr_WriteUnraisable(ctx); +} + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + /* Next, repeatedly, replace a tuple exception with its first item */ + while (PyTuple_Check(type) && PyTuple_Size(type) > 0) { + PyObject *tmp = type; + type = PyTuple_GET_ITEM(type, 0); + Py_INCREF(type); + Py_DECREF(tmp); + } + if (PyString_Check(type)) + ; + else if (PyClass_Check(type)) + ; /*PyErr_NormalizeException(&type, &value, &tb);*/ + else if (PyInstance_Check(type)) { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + else { + /* Normalize to raise <class>, <instance> */ + Py_DECREF(value); + value = type; + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + } + else { + /* Not something you can raise. You get an exception + anyway, just not what you specified :-) */ + PyErr_Format(PyExc_TypeError, + "exceptions must be strings, classes, or " + "instances, not %s", type->ob_type->tp_name); + goto raise_error; + } + PyErr_Restore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +static void __Pyx_UnpackError(void) { + PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *seq, int i) { + PyObject *item = PySequence_GetItem(seq, i); + if (!item) { + if (PyErr_ExceptionMatches(PyExc_IndexError)) + __Pyx_UnpackError(); + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *seq, int i) { + PyObject *item = PySequence_GetItem(seq, i); + if (item) { + Py_DECREF(item); + __Pyx_UnpackError(); + return -1; + } + PyErr_Clear(); + return 0; +} + +static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) { + while (t->p) { + *t->p = PyString_InternFromString(t->s); + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, + long size) +{ + PyObject *py_module_name = 0; + PyObject *py_class_name = 0; + PyObject *py_name_list = 0; + PyObject *py_module = 0; + PyObject *result = 0; + + py_module_name = PyString_FromString(module_name); + if (!py_module_name) + goto bad; + py_class_name = PyString_FromString(class_name); + if (!py_class_name) + goto bad; + py_name_list = PyList_New(1); + if (!py_name_list) + goto bad; + Py_INCREF(py_class_name); + if (PyList_SetItem(py_name_list, 0, py_class_name) < 0) + goto bad; + py_module = __Pyx_Import(py_module_name, py_name_list); + if (!py_module) + goto bad; + result = PyObject_GetAttr(py_module, py_class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + goto done; +bad: + Py_XDECREF(result); + result = 0; +done: + Py_XDECREF(py_module_name); + Py_XDECREF(py_class_name); + Py_XDECREF(py_name_list); + return (PyTypeObject *)result; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyObject *empty_tuple = 0; + PyObject *empty_string = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + py_srcfile = PyString_FromString(__pyx_filename); + if (!py_srcfile) goto bad; + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + empty_tuple = PyTuple_New(0); + if (!empty_tuple) goto bad; + empty_string = PyString_FromString(""); + if (!empty_string) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + empty_string, /*PyObject *code,*/ + empty_tuple, /*PyObject *consts,*/ + empty_tuple, /*PyObject *names,*/ + empty_tuple, /*PyObject *varnames,*/ + empty_tuple, /*PyObject *freevars,*/ + empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + empty_string /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(empty_tuple); + Py_XDECREF(empty_string); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx new file mode 100644 index 000000000..bf20ac913 --- /dev/null +++ b/numpy/random/mtrand/mtrand.pyx @@ -0,0 +1,972 @@ +# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit +# +# Copyright 2005 Robert Kern (robert.kern@gmail.com) +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +include "Python.pxi" +include "scipy.pxi" + +cdef extern from "math.h": + double exp(double x) + double log(double x) + double floor(double x) + double sin(double x) + double cos(double x) + +cdef extern from "randomkit.h": + + ctypedef struct rk_state: + unsigned long key[624] + int pos + + ctypedef enum rk_error: + RK_NOERR = 0 + RK_ENODEV = 1 + RK_ERR_MAX = 2 + + char *rk_strerror[2] + + # 0xFFFFFFFFUL + unsigned long RK_MAX + + void rk_seed(unsigned long seed, rk_state *state) + rk_error rk_randomseed(rk_state *state) + unsigned long rk_random(rk_state *state) + long rk_long(rk_state *state) + unsigned long rk_ulong(rk_state *state) + unsigned long rk_interval(unsigned long max, rk_state *state) + double rk_double(rk_state *state) + void rk_fill(void *buffer, size_t size, rk_state *state) + rk_error rk_devfill(void *buffer, size_t size, int strong) + rk_error rk_altfill(void *buffer, size_t size, int strong, + rk_state *state) + double rk_gauss(rk_state *state) + +cdef extern from "distributions.h": + + double rk_normal(rk_state *state, double loc, double scale) + double rk_standard_exponential(rk_state *state) + double rk_exponential(rk_state *state, double scale) + double rk_uniform(rk_state *state, double loc, double scale) + double rk_standard_gamma(rk_state *state, double shape) + double rk_gamma(rk_state *state, double shape, double scale) + double rk_beta(rk_state *state, double a, double b) + double rk_chisquare(rk_state *state, double df) + double rk_noncentral_chisquare(rk_state *state, double df, double nonc) + double rk_f(rk_state *state, double dfnum, double dfden) + double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc) + double rk_standard_cauchy(rk_state *state) + double rk_standard_t(rk_state *state, double df) + double rk_vonmises(rk_state *state, double mu, double kappa) + double rk_pareto(rk_state *state, double a) + double rk_weibull(rk_state *state, double a) + double rk_power(rk_state *state, double a) + double rk_laplace(rk_state *state, double loc, double scale) + double rk_gumbel(rk_state *state, double loc, double scale) + double rk_logistic(rk_state *state, double loc, double scale) + double rk_lognormal(rk_state *state, double mode, double sigma) + double rk_rayleigh(rk_state *state, double mode) + double rk_wald(rk_state *state, double mean, double scale) + double rk_triangular(rk_state *state, double left, double mode, double right) + + long rk_binomial(rk_state *state, long n, double p) + long rk_binomial_btpe(rk_state *state, long n, double p) + long rk_binomial_inversion(rk_state *state, long n, double p) + long rk_negative_binomial(rk_state *state, long n, double p) + long rk_poisson(rk_state *state, double lam) + long rk_poisson_mult(rk_state *state, double lam) + long rk_poisson_ptrs(rk_state *state, double lam) + long rk_zipf(rk_state *state, double a) + long rk_geometric(rk_state *state, double p) + long rk_hypergeometric(rk_state *state, long good, long bad, long sample) + long rk_logseries(rk_state *state, double p) + +ctypedef double (* rk_cont0)(rk_state *state) +ctypedef double (* rk_cont1)(rk_state *state, double a) +ctypedef double (* rk_cont2)(rk_state *state, double a, double b) +ctypedef double (* rk_cont3)(rk_state *state, double a, double b, double c) + +ctypedef long (* rk_disc0)(rk_state *state) +ctypedef long (* rk_discnp)(rk_state *state, long n, double p) +ctypedef long (* rk_discnmN)(rk_state *state, long n, long m, long N) +ctypedef long (* rk_discd)(rk_state *state, double a) + + +cdef extern from "initarray.h": + void init_by_array(rk_state *self, unsigned long *init_key, + unsigned long key_length) + +# Initialize scipy +import_array() + +import scipy as _sp + +cdef object cont0_array(rk_state *state, rk_cont0 func, object size): + cdef double *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state) + else: + array = <ndarray>_sp.empty(size, _sp.Float64) + length = PyArray_SIZE(array) + array_data = <double *>array.data + for i from 0 <= i < length: + array_data[i] = func(state) + return array + +cdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a): + cdef double *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, a) + else: + array = <ndarray>_sp.empty(size, _sp.Float64) + length = PyArray_SIZE(array) + array_data = <double *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, a) + return array + +cdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, + double b): + cdef double *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, a, b) + else: + array = <ndarray>_sp.empty(size, _sp.Float64) + length = PyArray_SIZE(array) + array_data = <double *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, a, b) + return array + +cdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, + double b, double c): + + cdef double *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, a, b, c) + else: + array = <ndarray>_sp.empty(size, _sp.Float64) + length = PyArray_SIZE(array) + array_data = <double *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, a, b, c) + return array + +cdef object disc0_array(rk_state *state, rk_disc0 func, object size): + cdef long *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state) + else: + array = <ndarray>_sp.empty(size, _sp.Int) + length = PyArray_SIZE(array) + array_data = <long *>array.data + for i from 0 <= i < length: + array_data[i] = func(state) + return array + +cdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, double p): + cdef long *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, n, p) + else: + array = <ndarray>_sp.empty(size, _sp.Int) + length = PyArray_SIZE(array) + array_data = <long *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, n, p) + return array + +cdef object discnmN_array(rk_state *state, rk_discnmN func, object size, + long n, long m, long N): + cdef long *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, n, m, N) + else: + array = <ndarray>_sp.empty(size, _sp.Int) + length = PyArray_SIZE(array) + array_data = <long *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, n, m, N) + return array + +cdef object discd_array(rk_state *state, rk_discd func, object size, double a): + cdef long *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if size is None: + return func(state, a) + else: + array = <ndarray>_sp.empty(size, _sp.Int) + length = PyArray_SIZE(array) + array_data = <long *>array.data + for i from 0 <= i < length: + array_data[i] = func(state, a) + return array + +cdef double kahan_sum(double *darr, long n): + cdef double c, y, t, sum + cdef long i + sum = darr[0] + c = 0.0 + for i from 1 <= i < n: + y = darr[i] - c + t = sum + y + c = (t-sum) - y + sum = t + return sum + +cdef class RandomState: + """Container for the Mersenne Twister PRNG. + + Constructor + ----------- + RandomState(seed=None): initializes the PRNG with the given seed. See the + seed() method for details. + + Distribution Methods + ----------------- + RandomState exposes a number of methods for generating random numbers drawn + from a variety of probability distributions. In addition to the + distribution-specific arguments, each method takes a keyword argument + size=None. If size is None, then a single value is generated and returned. + If size is an integer, then a 1-D scipy array filled with generated values + is returned. If size is a tuple, then a scipy array with that shape is + filled and returned. + """ + cdef rk_state *internal_state + + def __init__(self, seed=None): + self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state)) + + self.seed(seed) + + def __dealloc__(self): + if self.internal_state != NULL: + PyMem_Free(self.internal_state) + + def seed(self, seed=None): + """Seed the generator. + + seed(seed=None) + + seed can be an integer, an array (or other sequence) of integers of any + length, or None. If seed is None, then RandomState will try to read data + from /dev/urandom (or the Windows analogue) if available or seed from + the clock otherwise. + """ + cdef rk_error errcode + cdef ndarray obj "arrayObject_obj" + if seed is None: + errcode = rk_randomseed(self.internal_state) + elif type(seed) is int: + rk_seed(seed, self.internal_state) + else: + obj = <ndarray>PyArray_ContiguousFromObject(seed, PyArray_LONG, 1, 1) + init_by_array(self.internal_state, <unsigned long *>(obj.data), + obj.dimensions[0]) + + def get_state(self): + """Return a tuple representing the internal state of the generator. + + get_state() -> ('MT19937', int key[624], int pos) + """ + cdef ndarray state "arrayObject_state" + state = <ndarray>_sp.empty(624, _sp.Int) + memcpy(<void*>(state.data), self.internal_state.key, 624*sizeof(long)) + return ('MT19937', state, self.internal_state.pos) + + def set_state(self, state): + """Set the state from a tuple. + + state = ('MT19937', int key[624], int pos) + + set_state(state) + """ + cdef ndarray obj "arrayObject_obj" + cdef int pos + algorithm_name = state[0] + if algorithm_name != 'MT19937': + raise ValueError("algorithm must be 'MT19937'") + key, pos = state[1:] + obj = <ndarray>PyArray_ContiguousFromObject(key, PyArray_LONG, 1, 1) + if obj.dimensions[0] != 624: + raise ValueError("state must be 624 longs") + memcpy(self.internal_state.key, <void*>(obj.data), 624*sizeof(long)) + self.internal_state.pos = pos + + # Pickling support: + def __getstate__(self): + return self.get_state() + + def __setstate__(self, state): + self.set_state(state) + + def __reduce__(self): + return (_sp.random.__RandomState_ctor, (), self.get_state()) + + # Basic distributions: + def random_sample(self, size=None): + """Return random floats in the half-open interval [0.0, 1.0). + + random_sample(size=None) -> random values + """ + return cont0_array(self.internal_state, rk_double, size) + + def tomaxint(self, size=None): + """Returns random integers x such that 0 <= x <= sys.maxint. + + tomaxint(size=None) -> random values + """ + return disc0_array(self.internal_state, rk_long, size) + + def randint(self, low, high=None, size=None): + """Return random integers x such that low <= x < high. + + randint(low, high=None, size=None) -> random values + + If high is None, then 0 <= x < low. + """ + cdef long lo, hi, diff + cdef long *array_data + cdef ndarray array "arrayObject" + cdef long length + cdef long i + + if high is None: + lo = 0 + hi = low + else: + lo = low + hi = high + + diff = hi - lo - 1 + if diff < 0: + raise ValueError("low >= high") + + if size is None: + return rk_interval(diff, self.internal_state) + else: + array = <ndarray>_sp.empty(size, _sp.Int) + length = PyArray_SIZE(array) + array_data = <long *>array.data + for i from 0 <= i < length: + array_data[i] = lo + <long>rk_interval(diff, self.internal_state) + return array + + def bytes(self, unsigned int length): + """Return random bytes. + + bytes(length) -> str + """ + cdef void *bytes + bytes = PyMem_Malloc(length) + rk_fill(bytes, length, self.internal_state) + bytestring = PyString_FromString(<char*>bytes) + PyMem_Free(bytes) + return bytestring + + def uniform(self, double low=0.0, double high=1.0, size=None): + """Uniform distribution over [low, high). + + uniform(low=0.0, high=1.0, size=None) -> random values + """ + return cont2_array(self.internal_state, rk_uniform, size, low, + high-low) + + def rand(self, *args): + """Return an array of the given dimensions which is initialized to + random numbers from a uniform distribution in the range [0,1). + + rand(d0, d1, ..., dn) -> random values + """ + if len(args) == 0: + return self.random_sample() + else: + return self.random_sample(size=args) + + def randn(self, *args): + """Returns zero-mean, unit-variance Gaussian random numbers in an + array of shape (d0, d1, ..., dn). + + randn(d0, d1, ..., dn) -> random values + """ + if len(args) == 0: + return self.standard_normal() + else: + return self.standard_normal(args) + + def random_integers(self, low, high=None, size=None): + """Return random integers x such that low <= x <= high. + + random_integers(low, high=None, size=None) -> random values. + + If high is None, then 1 <= x <= low. + """ + if high is None: + high = low + low = 1 + return self.randint(low, high+1, size) + + # Complicated, continuous distributions: + def standard_normal(self, size=None): + """Standard Normal distribution (mean=0, stdev=1). + + standard_normal(size=None) -> random values + """ + return cont0_array(self.internal_state, rk_gauss, size) + + def normal(self, double loc=0.0, double scale=1.0, size=None): + """Normal distribution (mean=loc, stdev=scale). + + normal(loc=0.0, scale=1.0, size=None) -> random values + """ + if scale <= 0: + raise ValueError("scale <= 0") + return cont2_array(self.internal_state, rk_normal, size, loc, scale) + + def beta(self, double a, double b, size=None): + """Beta distribution over [0, 1]. + + beta(a, b, size=None) -> random values + """ + if a <= 0: + raise ValueError("a <= 0") + elif b <= 0: + raise ValueError("b <= 0") + return cont2_array(self.internal_state, rk_beta, size, a, b) + + def exponential(self, double scale=1.0, size=None): + """Exponential distribution. + + exponential(scale=1.0, size=None) -> random values + """ + if scale <= 0: + raise ValueError("scale <= 0") + return cont1_array(self.internal_state, rk_exponential, size, scale) + + def standard_exponential(self, size=None): + """Standard exponential distribution (scale=1). + + standard_exponential(size=None) -> random values + """ + return cont0_array(self.internal_state, rk_standard_exponential, size) + + def standard_gamma(self, double shape, size=None): + """Standard Gamma distribution. + + standard_gamma(shape, size=None) -> random values + """ + if shape <= 0: + raise ValueError("shape <= 0") + return cont1_array(self.internal_state, rk_standard_gamma, size, shape) + + def gamma(self, double shape, double scale=1.0, size=None): + """Gamma distribution. + + gamma(shape, scale=1.0, size=None) -> random values + """ + if shape <= 0: + raise ValueError("shape <= 0") + elif scale <= 0: + raise ValueError("scale <= 0") + return cont2_array(self.internal_state, rk_gamma, size, shape, scale) + + def f(self, double dfnum, double dfden, size=None): + """F distribution. + + f(dfnum, dfden, size=None) -> random values + """ + if dfnum <= 0: + raise ValueError("dfnum <= 0") + elif dfden <= 0: + raise ValueError("dfden <= 0") + return cont2_array(self.internal_state, rk_f, size, dfnum, dfden) + + def noncentral_f(self, double dfnum, double dfden, double nonc, size=None): + """Noncentral F distribution. + + noncentral_f(dfnum, dfden, nonc, size=None) -> random values + """ + if dfnum <= 1: + raise ValueError("dfnum <= 1") + elif dfden <= 0: + raise ValueError("dfden <= 0") + elif nonc < 0: + raise ValueError("nonc < 0") + return cont3_array(self.internal_state, rk_noncentral_f, size, dfnum, + dfden, nonc) + + def chisquare(self, double df, size=None): + """Chi^2 distribution. + + chisquare(df, size=None) -> random values + """ + if df <= 0: + raise ValueError("df <= 0") + return cont1_array(self.internal_state, rk_chisquare, size, df) + + def noncentral_chisquare(self, double df, double nonc, size=None): + """Noncentral Chi^2 distribution. + + noncentral_chisquare(df, nonc, size=None) -> random values + """ + if df <= 1: + raise ValueError("df <= 1") + elif nonc < 0: + raise ValueError("nonc < 0") + return cont2_array(self.internal_state, rk_noncentral_chisquare, size, + df, nonc) + + def standard_cauchy(self, size=None): + """Standard Cauchy with mode=0. + + standard_cauchy(size=None) + """ + return cont0_array(self.internal_state, rk_standard_cauchy, size) + + def standard_t(self, double df, size=None): + """Standard Student's t distribution with df degrees of freedom. + + standard_t(df, size=None) + """ + if df <= 0: + raise ValueError("df <= 0") + return cont1_array(self.internal_state, rk_standard_t, size, df) + + def vonmises(self, double mu, double kappa, size=None): + """von Mises circular distribution with mode mu and dispersion parameter + kappa on [-pi, pi]. + + vonmises(mu, kappa, size=None) + """ + if kappa < 0: + raise ValueError("kappa < 0") + return cont2_array(self.internal_state, rk_vonmises, size, mu, kappa) + + def pareto(self, double a, size=None): + """Pareto distribution. + + pareto(a, size=None) + """ + if a <= 0: + raise ValueError("a <= 0") + return cont1_array(self.internal_state, rk_pareto, size, a) + + def weibull(self, double a, size=None): + """Weibull distribution. + + weibull(a, size=None) + """ + if a <= 0: + raise ValueError("a <= 0") + return cont1_array(self.internal_state, rk_weibull, size, a) + + def power(self, double a, size=None): + """Power distribution. + + power(a, size=None) + """ + if a <= 0: + raise ValueError("a <= 0") + return cont1_array(self.internal_state, rk_power, size, a) + + def laplace(self, double loc=0.0, double scale=1.0, size=None): + """Laplace distribution. + + laplace(loc=0.0, scale=1.0, size=None) + """ + if scale <= 0.0: + raise ValueError("scale <= 0.0") + return cont2_array(self.internal_state, rk_laplace, size, loc, scale) + + def gumbel(self, double loc=0.0, double scale=1.0, size=None): + """Gumbel distribution. + + gumbel(loc=0.0, scale=1.0, size=None) + """ + if scale <= 0.0: + raise ValueError("scale <= 0.0") + return cont2_array(self.internal_state, rk_gumbel, size, loc, scale) + + def logistic(self, double loc=0.0, double scale=1.0, size=None): + """Logistic distribution. + + logistic(loc=0.0, scale=1.0, size=None) + """ + if scale <= 0.0: + raise ValueError("scale <= 0.0") + return cont2_array(self.internal_state, rk_logistic, size, loc, scale) + + def lognormal(self, double mean=0.0, double sigma=1.0, size=None): + """Log-normal distribution. + + Note that the mean parameter is not the mean of this distribution, but + the underlying normal distribution. + + lognormal(mean, sigma) <=> exp(normal(mean, sigma)) + + lognormal(mean=0.0, sigma=1.0, size=None) + """ + if sigma <= 0.0: + raise ValueError("sigma <= 0.0") + return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma) + + def rayleigh(self, double scale=1.0, size=None): + """Rayleigh distribution. + + rayleigh(scale=1.0, size=None) + """ + if scale <= 0.0: + raise ValueError("scale <= 0.0") + return cont1_array(self.internal_state, rk_rayleigh, size, scale) + + def wald(self, double mean, double scale, size=None): + """Wald (inverse Gaussian) distribution. + + wald(mean, scale, size=None) + """ + if mean <= 0.0: + raise ValueError("mean <= 0.0") + elif scale <= 0.0: + raise ValueError("scale <= 0.0") + return cont2_array(self.internal_state, rk_wald, size, mean, scale) + + def triangular(self, double left, double mode, double right, size=None): + """Triangular distribution starting at left, peaking at mode, and + ending at right (left <= mode <= right). + + triangular(left, mode, right, size=None) + """ + if left > mode: + raise ValueError("left > mode") + elif mode > right: + raise ValueError("mode > right") + elif left == right: + raise ValueError("left == right") + return cont3_array(self.internal_state, rk_triangular, size, left, + mode, right) + + # Complicated, discrete distributions: + def binomial(self, long n, double p, size=None): + """Binomial distribution of n trials and p probability of success. + + binomial(n, p, size=None) -> random values + """ + if n <= 0: + raise ValueError("n <= 0") + elif p < 0: + raise ValueError("p < 0") + elif p > 1: + raise ValueError("p > 1") + return discnp_array(self.internal_state, rk_binomial, size, n, p) + + def negative_binomial(self, long n, double p, size=None): + """Negative Binomial distribution. + + negative_binomial(n, p, size=None) -> random values + """ + if n <= 0: + raise ValueError("n <= 0") + elif p < 0: + raise ValueError("p < 0") + elif p > 1: + raise ValueError("p > 1") + return discnp_array(self.internal_state, rk_negative_binomial, size, n, + p) + + def poisson(self, double lam=1.0, size=None): + """Poisson distribution. + + poisson(lam=1.0, size=None) -> random values + """ + if lam <= 0: + raise ValueError("lam <= 0") + return discd_array(self.internal_state, rk_poisson, size, lam) + + def zipf(self, double a, size=None): + """Zipf distribution. + + zipf(a, size=None) + """ + if a <= 1.0: + raise ValueError("a <= 1.0") + return discd_array(self.internal_state, rk_zipf, size, a) + + def geometric(self, double p, size=None): + """Geometric distribution with p being the probability of "success" on + an individual trial. + + geometric(p, size=None) + """ + if p < 0.0: + raise ValueError("p < 0.0") + elif p > 1.0: + raise ValueError("p > 1.0") + return discd_array(self.internal_state, rk_geometric, size, p) + + def hypergeometric(self, long ngood, long nbad, long nsample, size=None): + """Hypergeometric distribution. + + Consider an urn with ngood "good" balls and nbad "bad" balls. If one + were to draw nsample balls from the urn without replacement, then + the hypergeometric distribution describes the distribution of "good" + balls in the sample. + + hypergeometric(ngood, nbad, nsample, size=None) + """ + if ngood < 1: + raise ValueError("ngood < 1") + elif nbad < 1: + raise ValueError("nbad < 1") + elif ngood + nbad < nsample: + raise ValueError("ngood + nbad < nsample") + elif nsample < 1: + raise ValueError("nsample < 1") + return discnmN_array(self.internal_state, rk_hypergeometric, size, + ngood, nbad, nsample) + + def logseries(self, double p, size=None): + """Logarithmic series distribution. + + logseries(p, size=None) + """ + if p < 0: + raise ValueError("p < 0") + elif p > 1: + raise ValueError("p > 1") + return discd_array(self.internal_state, rk_logseries, size, p) + + # Multivariate distributions: + def multivariate_normal(self, mean, cov, size=None): + """Return an array containing multivariate normally distributed random numbers + with specified mean and covariance. + + multivariate_normal(mean, cov) -> random values + multivariate_normal(mean, cov, [m, n, ...]) -> random values + + mean must be a 1 dimensional array. cov must be a square two dimensional + array with the same number of rows and columns as mean has elements. + + The first form returns a single 1-D array containing a multivariate + normal. + + The second form returns an array of shape (m, n, ..., cov.shape[0]). + In this case, output[i,j,...,:] is a 1-D array containing a multivariate + normal. + """ + # Check preconditions on arguments + mean = _sp.array(mean) + cov = _sp.array(cov) + if size is None: + shape = [] + else: + shape = size + if len(mean.shape) != 1: + raise ArgumentError("mean must be 1 dimensional") + if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): + raise ArgumentError("cov must be 2 dimensional and square") + if mean.shape[0] != cov.shape[0]: + raise ArgumentError("mean and cov must have same length") + # Compute shape of output + if isinstance(shape, int): + shape = [shape] + final_shape = list(shape[:]) + final_shape.append(mean.shape[0]) + # Create a matrix of independent standard normally distributed random + # numbers. The matrix has rows with the same length as mean and as + # many rows are necessary to form a matrix of shape final_shape. + x = standard_normal(_sp.multiply.reduce(final_shape)) + x.shape = (_sp.multiply.reduce(final_shape[0:len(final_shape)-1]), + mean.shape[0]) + # Transform matrix of standard normals into matrix where each row + # contains multivariate normals with the desired covariance. + # Compute A such that matrixmultiply(transpose(A),A) == cov. + # Then the matrix products of the rows of x and A has the desired + # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value + # decomposition of cov is such an A. + + from scipy.corelinalg import svd + # XXX: we really should be doing this by Cholesky decomposition + (u,s,v) = svd(cov) + x = _sp.matrixmultiply(x*_sp.sqrt(s),v) + # The rows of x now have the correct covariance but mean 0. Add + # mean to each row. Then each row will have mean mean. + _sp.add(mean,x,x) + x.shape = tuple(final_shape) + return x + + def multinomial(self, long n, object pvals, size=None): + """Multinomial distribution. + + multinomial(n, pvals, size=None) -> random values + + pvals is a sequence of probabilities that should sum to 1 (however, the + last element is always assumed to account for the remaining probability + as long as sum(pvals[:-1]) <= 1). + """ + cdef long d + cdef ndarray parr "arrayObject_parr", mnarr "arrayObject_mnarr" + cdef double *pix + cdef long *mnix + cdef long i, j, dn + cdef double Sum + + d = len(pvals) + parr = <ndarray>PyArray_ContiguousFromObject(pvals, PyArray_DOUBLE, 1, 1) + pix = <double*>parr.data + + if kahan_sum(pix, d-1) > 1.0: + raise ValueError("sum(pvals) > 1.0") + + if size is None: + shape = (d,) + elif type(size) is int: + shape = (size, d) + else: + shape = size + (d,) + + multin = _sp.zeros(shape, _sp.Int) + mnarr = <ndarray>multin + mnix = <long*>mnarr.data + i = 0 + while i < PyArray_SIZE(mnarr): + Sum = 1.0 + dn = n + for j from 0 <= j < d-1: + mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum) + dn = dn - mnix[i+j] + if dn <= 0: + break + Sum = Sum - pix[j] + if dn > 0: + mnix[i+d-1] = dn + + i = i + d + + return multin + + # Shuffling and permutations: + def shuffle(self, object x): + """Modify a sequence in-place by shuffling its contents. + + shuffle(x) + """ + cdef long i, j + + # adaptation of random.shuffle() + i = len(x) - 1 + while i > 0: + j = rk_interval(i, self.internal_state) + x[i], x[j] = x[j], x[i] + i = i - 1 + + def permutation(self, object x): + """Given an integer, return a shuffled sequence of integers >= 0 and + < x; given a sequence, return a shuffled array copy. + + permutation(x) + """ + if type(x) is int: + arr = _sp.arange(x) + else: + arr = _sp.array(x) + self.shuffle(arr) + return arr + +_rand = RandomState() +seed = _rand.seed +get_state = _rand.get_state +set_state = _rand.set_state +random_sample = _rand.random_sample +randint = _rand.randint +bytes = _rand.bytes +uniform = _rand.uniform +rand = _rand.rand +randn = _rand.randn +random_integers = _rand.random_integers +standard_normal = _rand.standard_normal +normal = _rand.normal +beta = _rand.beta +exponential = _rand.exponential +standard_exponential = _rand.standard_exponential +standard_gamma = _rand.standard_gamma +gamma = _rand.gamma +f = _rand.f +noncentral_f = _rand.noncentral_f +chisquare = _rand.chisquare +noncentral_chisquare = _rand.noncentral_chisquare +standard_cauchy = _rand.standard_cauchy +standard_t = _rand.standard_t +vonmises = _rand.vonmises +pareto = _rand.pareto +weibull = _rand.weibull +power = _rand.power +laplace = _rand.laplace +gumbel = _rand.gumbel +logistic = _rand.logistic +lognormal = _rand.lognormal +rayleigh = _rand.rayleigh +wald = _rand.wald +triangular = _rand.triangular + +binomial = _rand.binomial +negative_binomial = _rand.negative_binomial +poisson = _rand.poisson +zipf = _rand.zipf +geometric = _rand.geometric +hypergeometric = _rand.hypergeometric +logseries = _rand.logseries + +multivariate_normal = _rand.multivariate_normal +multinomial = _rand.multinomial + +shuffle = _rand.shuffle +permutation = _rand.permutation diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/mtrand/randomkit.c new file mode 100644 index 000000000..6a58f2dba --- /dev/null +++ b/numpy/random/mtrand/randomkit.c @@ -0,0 +1,355 @@ +/* Random kit 1.3 */ + +/* + * Copyright (c) 2003-2005, Jean-Sebastien Roy (js@jeannot.org) + * + * The rk_random and rk_seed functions algorithms and the original design of + * the Mersenne Twister RNG: + * + * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Original algorithm for the implementation of rk_interval function from + * Richard J. Wagner's implementation of the Mersenne Twister RNG, optimised by + * Magnus Jonsson. + * + * Constants used in the rk_double implementation by Isaku Wada. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* static char const rcsid[] = + "@(#) $Jeannot: randomkit.c,v 1.28 2005/07/21 22:14:09 js Exp $"; */ + +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <time.h> +#include <limits.h> +#include <math.h> + +#ifdef _WIN32 +/* Windows */ +#include <sys/timeb.h> +#ifndef RK_NO_WINCRYPT +/* Windows crypto */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#include <windows.h> +#include <wincrypt.h> +#endif +#else +/* Unix */ +#include <sys/time.h> +#include <unistd.h> +#endif + +#include "randomkit.h" + +#ifndef RK_DEV_URANDOM +#define RK_DEV_URANDOM "/dev/urandom" +#endif + +#ifndef RK_DEV_RANDOM +#define RK_DEV_RANDOM "/dev/random" +#endif + +char *rk_strerror[RK_ERR_MAX] = +{ + "no error", + "random device unvavailable" +}; + +/* static functions */ +static unsigned long rk_hash(unsigned long key); + +void rk_seed(unsigned long seed, rk_state *state) +{ + int pos; + seed &= 0xffffffffUL; + + /* Knuth's PRNG as used in the Mersenne Twister reference implementation */ + for (pos=0; pos<RK_STATE_LEN; pos++) + { + state->key[pos] = seed; + seed = (1812433253UL * (seed ^ (seed >> 30)) + pos + 1) & 0xffffffffUL; + } + + state->pos = RK_STATE_LEN; + state->has_gauss = 0; +} + +/* Thomas Wang 32 bits integer hash function */ +unsigned long rk_hash(unsigned long key) +{ + key += ~(key << 15); + key ^= (key >> 10); + key += (key << 3); + key ^= (key >> 6); + key += ~(key << 11); + key ^= (key >> 16); + return key; +} + +rk_error rk_randomseed(rk_state *state) +{ +#ifndef _WIN32 + struct timeval tv; +#else + struct _timeb tv; +#endif + int i; + + if(rk_devfill(state->key, sizeof(state->key), 0) == RK_NOERR) + { + state->key[0] |= 0x80000000UL; /* ensures non-zero key */ + state->pos = RK_STATE_LEN; + state->has_gauss = 0; + + for (i=0; i<624; i++) + { + state->key[i] &= 0xffffffffUL; + } + + return RK_NOERR; + } + +#ifndef _WIN32 + gettimeofday(&tv, NULL); + rk_seed(rk_hash(getpid()) ^ rk_hash(tv.tv_sec) ^ rk_hash(tv.tv_usec) + ^ rk_hash(clock()), state); +#else + _ftime(&tv); + rk_seed(rk_hash(tv.time) ^ rk_hash(tv.millitm) ^ rk_hash(clock()), state); +#endif + + return RK_ENODEV; +} + +/* Magic Mersenne Twister constants */ +#define N 624 +#define M 397 +#define MATRIX_A 0x9908b0dfUL +#define UPPER_MASK 0x80000000UL +#define LOWER_MASK 0x7fffffffUL + +/* Slightly optimised reference implementation of the Mersenne Twister */ +unsigned long rk_random(rk_state *state) +{ + unsigned long y; + + if (state->pos == RK_STATE_LEN) + { + int i; + + for (i=0;i<N-M;i++) + { + y = (state->key[i] & UPPER_MASK) | (state->key[i+1] & LOWER_MASK); + state->key[i] = state->key[i+M] ^ (y>>1) ^ (-(y & 1) & MATRIX_A); + } + for (;i<N-1;i++) + { + y = (state->key[i] & UPPER_MASK) | (state->key[i+1] & LOWER_MASK); + state->key[i] = state->key[i+(M-N)] ^ (y>>1) ^ (-(y & 1) & MATRIX_A); + } + y = (state->key[N-1] & UPPER_MASK) | (state->key[0] & LOWER_MASK); + state->key[N-1] = state->key[M-1] ^ (y>>1) ^ (-(y & 1) & MATRIX_A); + + state->pos = 0; + } + + y = state->key[state->pos++]; + + /* Tempering */ + y ^= (y >> 11); + y ^= (y << 7) & 0x9d2c5680UL; + y ^= (y << 15) & 0xefc60000UL; + y ^= (y >> 18); + + return y; +} + +long rk_long(rk_state *state) +{ + return rk_ulong(state) >> 1; +} + +unsigned long rk_ulong(rk_state *state) +{ +#if ULONG_MAX <= 0xffffffffUL + return rk_random(state); +#else + return (rk_random(state) << 32) | (rk_random(state)); +#endif +} + +unsigned long rk_interval(unsigned long max, rk_state *state) +{ + unsigned long mask = max, value; + + if (max == 0) return 0; + + /* Smallest bit mask >= max */ + mask |= mask >> 1; + mask |= mask >> 2; + mask |= mask >> 4; + mask |= mask >> 8; + mask |= mask >> 16; +#if ULONG_MAX > 0xffffffffUL + mask |= mask >> 32; +#endif + + /* Search a random value in [0..mask] <= max */ + while ((value = (rk_ulong(state) & mask)) > max); + + return value; +} + +double rk_double(rk_state *state) +{ + /* shifts : 67108864 = 0x4000000, 9007199254740992 = 0x20000000000000 */ + long a = rk_random(state) >> 5, b = rk_random(state) >> 6; + return (a * 67108864.0 + b) / 9007199254740992.0; +} + +void rk_fill(void *buffer, size_t size, rk_state *state) +{ + unsigned long r; + unsigned char *buf = buffer; + + for (; size >= 4; size -= 4) + { + r = rk_random(state); + *(buf++) = r & 0xFF; + *(buf++) = (r >> 8) & 0xFF; + *(buf++) = (r >> 16) & 0xFF; + *(buf++) = (r >> 24) & 0xFF; + } + + if (!size) return; + + r = rk_random(state); + + for (; size; r >>= 8, size --) + *(buf++) = (unsigned char)(r & 0xFF); +} + +rk_error rk_devfill(void *buffer, size_t size, int strong) +{ +#ifndef _WIN32 + FILE *rfile; + int done; + + if (strong) + rfile = fopen(RK_DEV_RANDOM, "rb"); + else + rfile = fopen(RK_DEV_URANDOM, "rb"); + if (rfile == NULL) + return RK_ENODEV; + done = fread(buffer, size, 1, rfile); + fclose(rfile); + if (done) + return RK_NOERR; +#else + +#ifndef RK_NO_WINCRYPT + HCRYPTPROV hCryptProv; + BOOL done; + + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT) || !hCryptProv) + return RK_ENODEV; + done = CryptGenRandom(hCryptProv, size, (unsigned char *)buffer); + CryptReleaseContext(hCryptProv, 0); + if (done) + return RK_NOERR; +#endif + +#endif + + return RK_ENODEV; +} + +rk_error rk_altfill(void *buffer, size_t size, int strong, rk_state *state) +{ + rk_error err; + + err = rk_devfill(buffer, size, strong); + if (err) + rk_fill(buffer, size, state); + + return err; +} + +double rk_gauss(rk_state *state) +{ + if (state->has_gauss) + { + state->has_gauss = 0; + return state->gauss; + } + else + { + double f, x1, x2, r2; + do + { + x1 = 2.0*rk_double(state) - 1.0; + x2 = 2.0*rk_double(state) - 1.0; + r2 = x1*x1 + x2*x2; + } + while (r2 >= 1.0 || r2 == 0.0); + + f = sqrt(-2.0*log(r2)/r2); /* Box-Muller transform */ + state->has_gauss = 1; + state->gauss = f*x1; /* Keep for next call */ + return f*x2; + } +} + + diff --git a/numpy/random/mtrand/randomkit.h b/numpy/random/mtrand/randomkit.h new file mode 100644 index 000000000..389666854 --- /dev/null +++ b/numpy/random/mtrand/randomkit.h @@ -0,0 +1,189 @@ +/* Random kit 1.3 */ + +/* + * Copyright (c) 2003-2005, Jean-Sebastien Roy (js@jeannot.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* @(#) $Jeannot: randomkit.h,v 1.24 2005/07/21 22:14:09 js Exp $ */ + +/* + * Typical use: + * + * { + * rk_state state; + * unsigned long seed = 1, random_value; + * + * rk_seed(seed, &state); // Initialize the RNG + * ... + * random_value = rk_random(&state); // Generate random values in [0..RK_MAX] + * } + * + * Instead of rk_seed, you can use rk_randomseed which will get a random seed + * from /dev/urandom (or the clock, if /dev/urandom is unavailable): + * + * { + * rk_state state; + * unsigned long random_value; + * + * rk_randomseed(&state); // Initialize the RNG with a random seed + * ... + * random_value = rk_random(&state); // Generate random values in [0..RK_MAX] + * } + */ + +/* + * Useful macro: + * RK_DEV_RANDOM: the device used for random seeding. + * defaults to "/dev/urandom" + */ + +#include <stddef.h> + +#ifndef _RANDOMKIT_ +#define _RANDOMKIT_ + +#define RK_STATE_LEN 624 + +typedef struct rk_state_ +{ + unsigned long key[RK_STATE_LEN]; + int pos; + int has_gauss; /* !=0: gauss contains a gaussian deviate */ + double gauss; + + /* The rk_state structure has been extended to store the following + * information for the binomial generator. If the input values of n or p + * are different than nsave and psave, then the other parameters will be + * recomputed. RTK 2005-09-02 */ + + int has_binomial; /* !=0: following parameters initialized for + binomial */ + double psave; + long nsave; + double r; + double q; + double fm; + long m; + double p1; + double xm; + double xl; + double xr; + double c; + double laml; + double lamr; + double p2; + double p3; + double p4; + +} +rk_state; + +typedef enum { + RK_NOERR = 0, /* no error */ + RK_ENODEV = 1, /* no RK_DEV_RANDOM device */ + RK_ERR_MAX = 2 +} rk_error; + +/* error strings */ +extern char *rk_strerror[RK_ERR_MAX]; + +/* Maximum generated random value */ +#define RK_MAX 0xFFFFFFFFUL + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Initialize the RNG state using the given seed. + */ +extern void rk_seed(unsigned long seed, rk_state *state); + +/* + * Initialize the RNG state using a random seed. + * Uses /dev/random or, when unavailable, the clock (see randomkit.c). + * Returns RK_NOERR when no errors occurs. + * Returns RK_ENODEV when the use of RK_DEV_RANDOM failed (for example because + * there is no such device). In this case, the RNG was initialized using the + * clock. + */ +extern rk_error rk_randomseed(rk_state *state); + +/* + * Returns a random unsigned long between 0 and RK_MAX inclusive + */ +extern unsigned long rk_random(rk_state *state); + +/* + * Returns a random long between 0 and LONG_MAX inclusive + */ +extern long rk_long(rk_state *state); + +/* + * Returns a random unsigned long between 0 and ULONG_MAX inclusive + */ +extern unsigned long rk_ulong(rk_state *state); + +/* + * Returns a random unsigned long between 0 and max inclusive. + */ +extern unsigned long rk_interval(unsigned long max, rk_state *state); + +/* + * Returns a random double between 0.0 and 1.0, 1.0 excluded. + */ +extern double rk_double(rk_state *state); + +/* + * fill the buffer with size random bytes + */ +extern void rk_fill(void *buffer, size_t size, rk_state *state); + +/* + * fill the buffer with randombytes from the random device + * Returns RK_ENODEV if the device is unavailable, or RK_NOERR if it is + * On Unix, if strong is defined, RK_DEV_RANDOM is used. If not, RK_DEV_URANDOM + * is used instead. This parameter has no effect on Windows. + * Warning: on most unixes RK_DEV_RANDOM will wait for enough entropy to answer + * which can take a very long time on quiet systems. + */ +extern rk_error rk_devfill(void *buffer, size_t size, int strong); + +/* + * fill the buffer using rk_devfill if the random device is available and using + * rk_fill if is is not + * parameters have the same meaning as rk_fill and rk_devfill + * Returns RK_ENODEV if the device is unavailable, or RK_NOERR if it is + */ +extern rk_error rk_altfill(void *buffer, size_t size, int strong, + rk_state *state); + +/* + * return a random gaussian deviate with variance unity and zero mean. + */ +extern double rk_gauss(rk_state *state); + +#ifdef __cplusplus +} +#endif + +#endif /* _RANDOMKIT_ */ diff --git a/numpy/random/mtrand/scipy.pxi b/numpy/random/mtrand/scipy.pxi new file mode 100644 index 000000000..9c7b4d01c --- /dev/null +++ b/numpy/random/mtrand/scipy.pxi @@ -0,0 +1,52 @@ +# :Author: Robert Kern +# :Copyright: 2004, Enthought, Inc. +# :License: BSD Style + + +cdef extern from "scipy/arrayobject.h": + ctypedef enum PyArray_TYPES: + PyArray_BOOL + PyArray_BYTE + PyArray_UBYTE + PyArray_SHORT + PyArray_USHORT + PyArray_INT + PyArray_UINT + PyArray_LONG + PyArray_ULONG + PyArray_FLOAT + PyArray_DOUBLE + PyArray_LONGDOUBLE + PyArray_CFLOAT + PyArray_CDOUBLE + PyArray_CLONGDOUBLE + PyArray_OBJECT + PyArray_STRING + PyArray_UNICODE + PyArray_VOID + PyArray_NTYPES + PyArray_NOTYPE + + ctypedef int intp + + ctypedef extern class scipy.dtypedescr [object PyArray_Descr]: + cdef int type_num, elsize + cdef char type + + ctypedef extern class scipy.ndarray [object PyArrayObject]: + cdef char *data + cdef int nd + cdef intp *dimensions + cdef intp *strides + cdef object base + cdef dtypedescr descr + cdef int flags + + ndarray PyArray_SimpleNew(int ndims, intp* dims, int item_type) + int PyArray_Check(object obj) + ndarray PyArray_ContiguousFromObject(object obj, PyArray_TYPES type, + int mindim, int maxdim) + intp PyArray_SIZE(ndarray arr) + void *PyArray_DATA(ndarray arr) + + void import_array() diff --git a/numpy/random/setup.py b/numpy/random/setup.py new file mode 100644 index 000000000..17e5e0133 --- /dev/null +++ b/numpy/random/setup.py @@ -0,0 +1,24 @@ + +from os.path import join + +def configuration(parent_package='',top_path=None): + from scipy.distutils.misc_util import Configuration + config = Configuration('random',parent_package,top_path) + + # Configure mtrand + config.add_extension('mtrand', + sources=[join('mtrand', x) for x in + ['mtrand.c', 'randomkit.c', 'initarray.c', + 'distributions.c']], + libraries=['m'], + depends = [join('mtrand','*.h'), + join('mtrand','*.pyx'), + join('mtrand','*.pxi'), + ] + ) + + return config + +if __name__ == '__main__': + from scipy.distutils.core import setup + setup(**configuration(top_path='').todict()) |