summaryrefslogtreecommitdiff
path: root/numpy/random
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random')
-rw-r--r--numpy/random/SConscript50
-rw-r--r--numpy/random/SConstruct2
-rw-r--r--numpy/random/__init__.py102
-rw-r--r--numpy/random/info.py134
-rw-r--r--numpy/random/mtrand/Python.pxi54
-rw-r--r--numpy/random/mtrand/distributions.c876
-rw-r--r--numpy/random/mtrand/distributions.h185
-rw-r--r--numpy/random/mtrand/generate_mtrand_c.py37
-rw-r--r--numpy/random/mtrand/initarray.c136
-rw-r--r--numpy/random/mtrand/initarray.h6
-rw-r--r--numpy/random/mtrand/mtrand.c10535
-rw-r--r--numpy/random/mtrand/mtrand.pyx3304
-rw-r--r--numpy/random/mtrand/numpy.pxi133
-rw-r--r--numpy/random/mtrand/randomkit.c381
-rw-r--r--numpy/random/mtrand/randomkit.h189
-rw-r--r--numpy/random/setup.py69
-rw-r--r--numpy/random/setupscons.py40
-rw-r--r--numpy/random/tests/test_random.py71
18 files changed, 16304 insertions, 0 deletions
diff --git a/numpy/random/SConscript b/numpy/random/SConscript
new file mode 100644
index 000000000..a2acb0a66
--- /dev/null
+++ b/numpy/random/SConscript
@@ -0,0 +1,50 @@
+# Last Change: Wed Nov 19 09:00 PM 2008 J
+# vim:syntax=python
+import os
+
+from numscons import GetNumpyEnvironment, scons_get_mathlib
+
+from setup import needs_mingw_ftime_workaround
+
+def CheckWincrypt(context):
+ from copy import deepcopy
+ src = """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+ return 0;
+#else
+ return 1;
+#endif
+}
+"""
+
+ context.Message("Checking if using wincrypt ... ")
+ st = context.env.TryRun(src, '.C')
+ if st[0] == 0:
+ context.Result('No')
+ else:
+ context.Result('Yes')
+ return st[0]
+
+env = GetNumpyEnvironment(ARGUMENTS)
+
+mlib = scons_get_mathlib(env)
+env.AppendUnique(LIBS = mlib)
+
+# On windows, see if we should use Advapi32
+if os.name == 'nt':
+ config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt})
+ if config.CheckWincrypt:
+ config.env.AppendUnique(LIBS = 'Advapi32')
+ config.Finish()
+
+if needs_mingw_ftime_workaround():
+ env.Append(CPPDEFINES=['NPY_NEEDS_MINGW_TIME_WORKAROUND'])
+
+sources = [os.path.join('mtrand', x) for x in
+ ['mtrand.c', 'randomkit.c', 'initarray.c', 'distributions.c']]
+
+# XXX: Pyrex dependency
+env.NumpyPythonExtension('mtrand', source = sources)
diff --git a/numpy/random/SConstruct b/numpy/random/SConstruct
new file mode 100644
index 000000000..a377d8391
--- /dev/null
+++ b/numpy/random/SConstruct
@@ -0,0 +1,2 @@
+from numscons import GetInitEnvironment
+GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py
new file mode 100644
index 000000000..8c3a33368
--- /dev/null
+++ b/numpy/random/__init__.py
@@ -0,0 +1,102 @@
+"""
+========================
+Random Number Generation
+========================
+
+==================== =========================================================
+Utility functions
+==============================================================================
+random Uniformly distributed values of a given shape.
+bytes Uniformly distributed random bytes.
+random_integers Uniformly distributed integers in a given range.
+random_sample Uniformly distributed floats in a given range.
+permutation Randomly permute a sequence / generate a random sequence.
+shuffle Randomly permute a sequence in place.
+seed Seed the random number generator.
+==================== =========================================================
+
+==================== =========================================================
+Compatibility functions
+==============================================================================
+rand Uniformly distributed values.
+randn Normally distributed values.
+ranf Uniformly distributed floating point numbers.
+randint Uniformly distributed integers in a given range.
+==================== =========================================================
+
+==================== =========================================================
+Univariate distributions
+==============================================================================
+beta Beta distribution over ``[0, 1]``.
+binomial Binomial distribution.
+chisquare :math:`\\chi^2` distribution.
+exponential Exponential distribution.
+f F (Fisher-Snedecor) distribution.
+gamma Gamma distribution.
+geometric Geometric distribution.
+gumbel Gumbel distribution.
+hypergeometric Hypergeometric distribution.
+laplace Laplace distribution.
+logistic Logistic distribution.
+lognormal Log-normal distribution.
+logseries Logarithmic series distribution.
+negative_binomial Negative binomial distribution.
+noncentral_chisquare Non-central chi-square distribution.
+noncentral_f Non-central F distribution.
+normal Normal / Gaussian distribution.
+pareto Pareto distribution.
+poisson Poisson distribution.
+power Power distribution.
+rayleigh Rayleigh distribution.
+triangular Triangular distribution.
+uniform Uniform distribution.
+vonmises Von Mises circular distribution.
+wald Wald (inverse Gaussian) distribution.
+weibull Weibull distribution.
+zipf Zipf's distribution over ranked data.
+==================== =========================================================
+
+==================== =========================================================
+Multivariate distributions
+==============================================================================
+dirichlet Multivariate generalization of Beta distribution.
+multinomial Multivariate generalization of the binomial distribution.
+multivariate_normal Multivariate generalization of the normal distribution.
+==================== =========================================================
+
+==================== =========================================================
+Standard distributions
+==============================================================================
+standard_cauchy Standard Cauchy-Lorentz distribution.
+standard_exponential Standard exponential distribution.
+standard_gamma Standard Gamma distribution.
+standard_normal Standard normal distribution.
+standard_t Standard Student's t-distribution.
+==================== =========================================================
+
+==================== =========================================================
+Internal functions
+==============================================================================
+get_state Get tuple representing internal state of generator.
+set_state Set state of generator.
+==================== =========================================================
+
+"""
+# 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 numpy.testing import Tester
+test = Tester().test
+bench = Tester().bench
diff --git a/numpy/random/info.py b/numpy/random/info.py
new file mode 100644
index 000000000..6139e5784
--- /dev/null
+++ b/numpy/random/info.py
@@ -0,0 +1,134 @@
+"""
+========================
+Random Number Generation
+========================
+
+==================== =========================================================
+Utility functions
+==============================================================================
+random Uniformly distributed values of a given shape.
+bytes Uniformly distributed random bytes.
+random_integers Uniformly distributed integers in a given range.
+random_sample Uniformly distributed floats in a given range.
+permutation Randomly permute a sequence / generate a random sequence.
+shuffle Randomly permute a sequence in place.
+seed Seed the random number generator.
+==================== =========================================================
+
+==================== =========================================================
+Compatibility functions
+==============================================================================
+rand Uniformly distributed values.
+randn Normally distributed values.
+ranf Uniformly distributed floating point numbers.
+randint Uniformly distributed integers in a given range.
+==================== =========================================================
+
+==================== =========================================================
+Univariate distributions
+==============================================================================
+beta Beta distribution over ``[0, 1]``.
+binomial Binomial distribution.
+chisquare :math:`\\chi^2` distribution.
+exponential Exponential distribution.
+f F (Fisher-Snedecor) distribution.
+gamma Gamma distribution.
+geometric Geometric distribution.
+gumbel Gumbel distribution.
+hypergeometric Hypergeometric distribution.
+laplace Laplace distribution.
+logistic Logistic distribution.
+lognormal Log-normal distribution.
+logseries Logarithmic series distribution.
+negative_binomial Negative binomial distribution.
+noncentral_chisquare Non-central chi-square distribution.
+noncentral_f Non-central F distribution.
+normal Normal / Gaussian distribution.
+pareto Pareto distribution.
+poisson Poisson distribution.
+power Power distribution.
+rayleigh Rayleigh distribution.
+triangular Triangular distribution.
+uniform Uniform distribution.
+vonmises Von Mises circular distribution.
+wald Wald (inverse Gaussian) distribution.
+weibull Weibull distribution.
+zipf Zipf's distribution over ranked data.
+==================== =========================================================
+
+==================== =========================================================
+Multivariate distributions
+==============================================================================
+dirichlet Multivariate generalization of Beta distribution.
+multinomial Multivariate generalization of the binomial distribution.
+multivariate_normal Multivariate generalization of the normal distribution.
+==================== =========================================================
+
+==================== =========================================================
+Standard distributions
+==============================================================================
+standard_cauchy Standard Cauchy-Lorentz distribution.
+standard_exponential Standard exponential distribution.
+standard_gamma Standard Gamma distribution.
+standard_normal Standard normal distribution.
+standard_t Standard Student's t-distribution.
+==================== =========================================================
+
+==================== =========================================================
+Internal functions
+==============================================================================
+get_state Get tuple representing internal state of generator.
+set_state Set state of generator.
+==================== =========================================================
+
+"""
+
+depends = ['core']
+
+__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..03018e960
--- /dev/null
+++ b/numpy/random/mtrand/Python.pxi
@@ -0,0 +1,54 @@
+# :Author: Robert Kern
+# :Copyright: 2004, Enthought, Inc.
+# :License: BSD Style
+
+
+cdef extern from "Python.h":
+ # Not part of the Python API, but we might as well define it here.
+ # Note that the exact type doesn't actually matter for Pyrex.
+ ctypedef int size_t
+
+ # String API
+ char* PyString_AsString(object string)
+ char* PyString_AS_STRING(object string)
+ object PyString_FromString(char* c_string)
+ object PyString_FromStringAndSize(char* c_string, int length)
+
+ # Float API
+ double PyFloat_AsDouble(object ob)
+ long PyInt_AsLong(object ob)
+
+ # Memory API
+ 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)
+
+ # CObject API
+ ctypedef void (*destructor1)(void* cobj)
+ ctypedef void (*destructor2)(void* cobj, void* desc)
+ int PyCObject_Check(object p)
+ object PyCObject_FromVoidPtr(void* cobj, destructor1 destr)
+ object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc,
+ destructor2 destr)
+ void* PyCObject_AsVoidPtr(object self)
+ void* PyCObject_GetDesc(object self)
+ int PyCObject_SetVoidPtr(object self, void* cobj)
+
+ # TypeCheck API
+ int PyFloat_Check(object obj)
+ int PyInt_Check(object obj)
+
+ # Error API
+ int PyErr_Occurred()
+ void PyErr_Clear()
+
+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..8cd508f7a
--- /dev/null
+++ b/numpy/random/mtrand/distributions.c
@@ -0,0 +1,876 @@
+/* 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
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338328
+#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 / (X + Y);
+ }
+ }
+ }
+ 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) * dfden) /
+ (rk_chisquare(state, dfden) * dfnum));
+}
+
+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*q + 1));
+ } 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, double 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 if (lam == 0)
+ {
+ return 0;
+ }
+ 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;
+}
+
+/* Uses the rejection algorithm compared against the wrapped Cauchy
+ distribution suggested by Best and Fisher and documented in
+ Chapter 9 of Luc's Non-Uniform Random Variate Generation.
+ http://cg.scs.carleton.ca/~luc/rnbookindex.html
+ (but corrected to match the algorithm in R and Python)
+*/
+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 = rk_double(state);
+ Z = cos(M_PI*U);
+ W = (1 + s*Z)/(s + Z);
+ Y = kappa * (s - W);
+ V = rk_double(state);
+ if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0))
+ {
+ break;
+ }
+ }
+
+ U = rk_double(state);
+
+ result = acos(W);
+ if (U < 0.5)
+ {
+ result = -result;
+ }
+ result += mu;
+ mod = fmod(result, 2*M_PI);
+ return mod;
+ }
+}
+
+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 am1, b;
+
+ am1 = a - 1.0;
+ b = pow(2.0, am1);
+ do
+ {
+ U = 1.0-rk_double(state);
+ V = rk_double(state);
+ X = (long)floor(pow(U, -1.0/am1));
+ /* The real result may be above what can be represented in a signed
+ * long. It will get casted to -sys.maxint-1. Since this is
+ * a straightforward rejection algorithm, we can just reject this value
+ * in the rejection condition below. This function then models a Zipf
+ * distribution truncated to sys.maxint.
+ */
+ T = pow(1.0 + 1.0/X, am1);
+ } while (((V*X*(T-1.0)/(b-1.0)) > (T/b)) || X < 1);
+ 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 (good > bad) 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 (good > bad) 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;
+ long result;
+
+ r = log(1.0 - p);
+
+ while (1) {
+ V = rk_double(state);
+ if (V >= p) {
+ return 1;
+ }
+ U = rk_double(state);
+ q = 1.0 - exp(r*U);
+ if (V <= q*q) {
+ result = (long)floor(1 + log(V)/log(q));
+ if (result < 1) {
+ continue;
+ }
+ else {
+ return result;
+ }
+ }
+ 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..6f60a4ff3
--- /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, double 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..8eb6254f2
--- /dev/null
+++ b/numpy/random/mtrand/generate_mtrand_c.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+import sys
+import re
+import os
+
+unused_internal_funcs = ['__Pyx_PrintItem',
+ '__Pyx_PrintNewline',
+ '__Pyx_ReRaise',
+ #'__Pyx_GetExcValue',
+ '__Pyx_ArgTypeTest',
+ '__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..07ad2cc4f
--- /dev/null
+++ b/numpy/random/mtrand/initarray.c
@@ -0,0 +1,136 @@
+/* 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 */
+ self->has_gauss = 0;
+ self->has_binomial = 0;
+}
+
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..3f5c1932c
--- /dev/null
+++ b/numpy/random/mtrand/mtrand.c
@@ -0,0 +1,10535 @@
+/* 0.9.7 on Tue Oct 28 02:15:49 2008 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#include "structmember.h"
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#if PY_VERSION_HEX < 0x02050000
+ typedef int Py_ssize_t;
+ #define PY_SSIZE_T_MAX INT_MAX
+ #define PY_SSIZE_T_MIN INT_MIN
+ #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+ #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
+#endif
+#ifndef WIN32
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+#include <math.h>
+#include "string.h"
+#include "math.h"
+#include "numpy/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_m;
+static PyObject *__pyx_b;
+static int __pyx_lineno;
+static char *__pyx_filename;
+static char **__pyx_f;
+
+static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
+static int __Pyx_EndUnpack(PyObject *); /*proto*/
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
+
+static PyObject *__Pyx_ImportModule(char *name); /*proto*/
+
+static void __Pyx_AddTraceback(char *funcname); /*proto*/
+
+/* Declarations from mtrand */
+
+typedef double (*__pyx_t_6mtrand_rk_cont0)(rk_state *);
+
+typedef double (*__pyx_t_6mtrand_rk_cont1)(rk_state *,double);
+
+typedef double (*__pyx_t_6mtrand_rk_cont2)(rk_state *,double,double);
+
+typedef double (*__pyx_t_6mtrand_rk_cont3)(rk_state *,double,double,double);
+
+typedef long (*__pyx_t_6mtrand_rk_disc0)(rk_state *);
+
+typedef long (*__pyx_t_6mtrand_rk_discnp)(rk_state *,long,double);
+
+typedef long (*__pyx_t_6mtrand_rk_discdd)(rk_state *,double,double);
+
+typedef long (*__pyx_t_6mtrand_rk_discnmN)(rk_state *,long,long,long);
+
+typedef long (*__pyx_t_6mtrand_rk_discd)(rk_state *,double);
+
+struct __pyx_obj_6mtrand_RandomState {
+ PyObject_HEAD
+ rk_state *internal_state;
+};
+
+
+static PyTypeObject *__pyx_ptype_6mtrand_dtype = 0;
+static PyTypeObject *__pyx_ptype_6mtrand_ndarray = 0;
+static PyTypeObject *__pyx_ptype_6mtrand_flatiter = 0;
+static PyTypeObject *__pyx_ptype_6mtrand_broadcast = 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 PyObject *__pyx_k8;
+static PyObject *__pyx_k9;
+static PyObject *__pyx_k10;
+static PyObject *__pyx_k11;
+static PyObject *__pyx_k12;
+static PyObject *__pyx_k13;
+static PyObject *__pyx_k14;
+static PyObject *__pyx_k15;
+static PyObject *__pyx_k16;
+static PyObject *__pyx_k17;
+static PyObject *__pyx_k18;
+static PyObject *__pyx_k19;
+static PyObject *__pyx_k20;
+static PyObject *__pyx_k21;
+static PyObject *__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 PyObject *__pyx_k34;
+static PyObject *__pyx_k35;
+static PyObject *__pyx_k36;
+static PyObject *__pyx_k37;
+static PyObject *__pyx_k38;
+static PyObject *__pyx_k39;
+static PyObject *__pyx_k40;
+static PyObject *__pyx_k41;
+static PyObject *__pyx_k42;
+static PyObject *__pyx_k43;
+static PyObject *__pyx_k44;
+static PyObject *__pyx_k45;
+static PyObject *__pyx_k46;
+static PyObject *__pyx_k47;
+static PyObject *__pyx_k48;
+static PyObject *__pyx_k49;
+static PyObject *__pyx_k50;
+static PyObject *__pyx_k51;
+static PyObject *__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_k60;
+static PyObject *__pyx_f_6mtrand_cont0_array(rk_state *,__pyx_t_6mtrand_rk_cont0,PyObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont1_array_sc(rk_state *,__pyx_t_6mtrand_rk_cont1,PyObject *,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *,__pyx_t_6mtrand_rk_cont1,PyObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state *,__pyx_t_6mtrand_rk_cont2,PyObject *,double,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *,__pyx_t_6mtrand_rk_cont2,PyObject *,PyArrayObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state *,__pyx_t_6mtrand_rk_cont3,PyObject *,double,double,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *,__pyx_t_6mtrand_rk_cont3,PyObject *,PyArrayObject *,PyArrayObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_disc0_array(rk_state *,__pyx_t_6mtrand_rk_disc0,PyObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_discnp_array_sc(rk_state *,__pyx_t_6mtrand_rk_discnp,PyObject *,long,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *,__pyx_t_6mtrand_rk_discnp,PyObject *,PyArrayObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_discdd_array_sc(rk_state *,__pyx_t_6mtrand_rk_discdd,PyObject *,double,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *,__pyx_t_6mtrand_rk_discdd,PyObject *,PyArrayObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state *,__pyx_t_6mtrand_rk_discnmN,PyObject *,long,long,long); /*proto*/
+static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *,__pyx_t_6mtrand_rk_discnmN,PyObject *,PyArrayObject *,PyArrayObject *,PyArrayObject *); /*proto*/
+static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *,__pyx_t_6mtrand_rk_discd,PyObject *,double); /*proto*/
+static PyObject *__pyx_f_6mtrand_discd_array(rk_state *,__pyx_t_6mtrand_rk_discd,PyObject *,PyArrayObject *); /*proto*/
+static double __pyx_f_6mtrand_kahan_sum(double *,long); /*proto*/
+
+
+/* Implementation of mtrand */
+
+
+static PyObject *__pyx_n_numpy;
+static PyObject *__pyx_n_np;
+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_dirichlet;
+static PyObject *__pyx_n_shuffle;
+static PyObject *__pyx_n_permutation;
+
+static PyObject *__pyx_n_empty;
+static PyObject *__pyx_n_float64;
+
+static PyObject *__pyx_f_6mtrand_cont0_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont0 __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":131 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":134 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; 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 = 134; 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 = 134; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":135 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":136 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":137 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":139 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont1 __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":148 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":151 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; 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 = 151; 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 = 151; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":152 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":153 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":154 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":156 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.cont1_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k61p;
+
+static char __pyx_k61[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont1 __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_oa) {
+ double *__pyx_v_array_data;
+ double *__pyx_v_oa_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_length;
+ npy_intp __pyx_v_i;
+ PyArrayIterObject *__pyx_v_itera;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ npy_intp __pyx_5;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_oa);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":167 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":168 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":169 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":170 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":171 */
+ __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_itera));
+ __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":172 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":173 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double *)__pyx_v_itera->dataptr)[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":174 */
+ PyArray_ITER_NEXT(__pyx_v_itera);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":176 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; 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 = 176; 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 = 176; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":177 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":178 */
+ __pyx_3 = PyArray_MultiIterNew(2,((void *)arrayObject),((void *)__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":180 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;}
+ Py_INCREF(__pyx_k61p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);
+ __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;}
+ 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 = 181; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":182 */
+ __pyx_5 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":183 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":184 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":185 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":186 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_itera);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_oa);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont2 __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":195 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __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 = 196; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":198 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); 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_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); 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 *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":199 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":200 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":201 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":203 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.cont2_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k62p;
+
+static char __pyx_k62[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont2 __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_oa,PyArrayObject *__pyx_v_ob) {
+ double *__pyx_v_array_data;
+ double *__pyx_v_oa_data;
+ double *__pyx_v_ob_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_i;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ npy_intp __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_oa);
+ Py_INCREF(__pyx_v_ob);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":216 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":217 */
+ __pyx_2 = PyArray_MultiIterNew(2,((void *)__pyx_v_oa),((void *)__pyx_v_ob)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":218 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":219 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":220 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":221 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,0));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":222 */
+ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":223 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":224 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":226 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; 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 = 226; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":227 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":228 */
+ __pyx_4 = PyArray_MultiIterNew(3,((void *)arrayObject),((void *)__pyx_v_oa),((void *)__pyx_v_ob)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":229 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+ Py_INCREF(__pyx_k62p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k62p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":231 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":232 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":233 */
+ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":234 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":235 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":236 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":237 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.cont2_array");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_ob);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont3 __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":247 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __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 = 248; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":250 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; 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 = 250; 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 = 250; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":251 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":252 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":253 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":255 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.cont3_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k63p;
+
+static char __pyx_k63[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_cont3 __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_oa,PyArrayObject *__pyx_v_ob,PyArrayObject *__pyx_v_oc) {
+ double *__pyx_v_array_data;
+ double *__pyx_v_oa_data;
+ double *__pyx_v_ob_data;
+ double *__pyx_v_oc_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_i;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ npy_intp __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_oa);
+ Py_INCREF(__pyx_v_ob);
+ Py_INCREF(__pyx_v_oc);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":269 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":270 */
+ __pyx_2 = PyArray_MultiIterNew(3,((void *)__pyx_v_oa),((void *)__pyx_v_ob),((void *)__pyx_v_oc)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":271 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":272 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":273 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":274 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,0));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":275 */
+ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":276 */
+ __pyx_v_oc_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":277 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":278 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":280 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; 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 = 280; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":281 */
+ __pyx_v_array_data = ((double *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":282 */
+ __pyx_4 = PyArray_MultiIterNew(4,((void *)arrayObject),((void *)__pyx_v_oa),((void *)__pyx_v_ob),((void *)__pyx_v_oc)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":284 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ Py_INCREF(__pyx_k63p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k63p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":286 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":287 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":288 */
+ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":289 */
+ __pyx_v_oc_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,3));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":290 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":291 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":292 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.cont3_array");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_ob);
+ Py_DECREF(__pyx_v_oc);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_disc0_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_disc0 __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":300 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":303 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; 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 = 303; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":304 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":305 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":306 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":308 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discnp __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":316 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __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 = 317; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":319 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; 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 = 319; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":320 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":321 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":322 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":324 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.discnp_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k64p;
+
+static char __pyx_k64[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discnp __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_on,PyArrayObject *__pyx_v_op) {
+ long *__pyx_v_array_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_i;
+ double *__pyx_v_op_data;
+ long *__pyx_v_on_data;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ npy_intp __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_on);
+ Py_INCREF(__pyx_v_op);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":335 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":336 */
+ __pyx_2 = PyArray_MultiIterNew(2,((void *)__pyx_v_on),((void *)__pyx_v_op)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":337 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":338 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":339 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":340 */
+ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,0));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":341 */
+ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":342 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":343 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":345 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; 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 = 345; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":346 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":347 */
+ __pyx_4 = PyArray_MultiIterNew(3,((void *)arrayObject),((void *)__pyx_v_on),((void *)__pyx_v_op)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":348 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
+ Py_INCREF(__pyx_k64p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k64p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":350 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":351 */
+ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":352 */
+ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":353 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":354 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":355 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":357 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.discnp_array");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_on);
+ Py_DECREF(__pyx_v_op);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_discdd_array_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discdd __pyx_v_func,PyObject *__pyx_v_size,double __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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":365 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __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 = 366; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":368 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; 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 = 368; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":369 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":370 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":371 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":373 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.discdd_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k65p;
+
+static char __pyx_k65[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discdd __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_on,PyArrayObject *__pyx_v_op) {
+ long *__pyx_v_array_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_i;
+ double *__pyx_v_op_data;
+ double *__pyx_v_on_data;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ npy_intp __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_on);
+ Py_INCREF(__pyx_v_op);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":384 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":385 */
+ __pyx_2 = PyArray_MultiIterNew(2,((void *)__pyx_v_on),((void *)__pyx_v_op)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":386 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":387 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":388 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":389 */
+ __pyx_v_on_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,0));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":390 */
+ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":391 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":392 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":394 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; 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 = 394; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":395 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":396 */
+ __pyx_4 = PyArray_MultiIterNew(3,((void *)arrayObject),((void *)__pyx_v_on),((void *)__pyx_v_op)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":397 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
+ Py_INCREF(__pyx_k65p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k65p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":399 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":400 */
+ __pyx_v_on_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":401 */
+ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":402 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":403 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":404 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":406 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.discdd_array");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_on);
+ Py_DECREF(__pyx_v_op);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discnmN __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":415 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __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 = 416; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":418 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; 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 = 418; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":419 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":420 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":421 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":423 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.discnmN_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k66p;
+
+static char __pyx_k66[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discnmN __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_on,PyArrayObject *__pyx_v_om,PyArrayObject *__pyx_v_oN) {
+ long *__pyx_v_array_data;
+ long *__pyx_v_on_data;
+ long *__pyx_v_om_data;
+ long *__pyx_v_oN_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_i;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ npy_intp __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_on);
+ Py_INCREF(__pyx_v_om);
+ Py_INCREF(__pyx_v_oN);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":436 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":437 */
+ __pyx_2 = PyArray_MultiIterNew(3,((void *)__pyx_v_on),((void *)__pyx_v_om),((void *)__pyx_v_oN)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":438 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":439 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":440 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":441 */
+ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,0));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":442 */
+ __pyx_v_om_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":443 */
+ __pyx_v_oN_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":444 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":445 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":447 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; 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 = 447; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":448 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":449 */
+ __pyx_4 = PyArray_MultiIterNew(4,((void *)arrayObject),((void *)__pyx_v_on),((void *)__pyx_v_om),((void *)__pyx_v_oN)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":451 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}
+ Py_INCREF(__pyx_k66p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k66p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":453 */
+ __pyx_3 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":454 */
+ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":455 */
+ __pyx_v_om_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,2));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":456 */
+ __pyx_v_oN_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi,3));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":457 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":458 */
+ PyArray_MultiIter_NEXT(__pyx_v_multi);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":460 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.discnmN_array");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_multi);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_on);
+ Py_DECREF(__pyx_v_om);
+ Py_DECREF(__pyx_v_oN);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discd __pyx_v_func,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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":468 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":471 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; 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 = 471; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":472 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":473 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":474 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":476 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.discd_array_sc");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k67p;
+
+static char __pyx_k67[] = "size is not compatible with inputs";
+
+static PyObject *__pyx_f_6mtrand_discd_array(rk_state *__pyx_v_state,__pyx_t_6mtrand_rk_discd __pyx_v_func,PyObject *__pyx_v_size,PyArrayObject *__pyx_v_oa) {
+ long *__pyx_v_array_data;
+ double *__pyx_v_oa_data;
+ PyArrayObject *arrayObject;
+ npy_intp __pyx_v_length;
+ npy_intp __pyx_v_i;
+ PyArrayMultiIterObject *__pyx_v_multi;
+ PyArrayIterObject *__pyx_v_itera;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ npy_intp __pyx_5;
+ Py_INCREF(__pyx_v_size);
+ Py_INCREF(__pyx_v_oa);
+ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":487 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":488 */
+ __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":489 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":490 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":491 */
+ __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_itera));
+ __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":492 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":493 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double *)__pyx_v_itera->dataptr)[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":494 */
+ PyArray_ITER_NEXT(__pyx_v_itera);
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":496 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; 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 = 496; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":497 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":498 */
+ __pyx_3 = PyArray_MultiIterNew(2,((void *)arrayObject),((void *)__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_multi));
+ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":499 */
+ __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
+ Py_INCREF(__pyx_k67p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k67p);
+ __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
+ 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 = 500; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":501 */
+ __pyx_5 = __pyx_v_multi->size;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":502 */
+ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi,1));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":503 */
+ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":504 */
+ PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":505 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_multi);
+ Py_DECREF(__pyx_v_itera);
+ Py_DECREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_oa);
+ 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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":510 */
+ __pyx_v_sum = (__pyx_v_darr[0]);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":511 */
+ __pyx_v_c = 0.0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":512 */
+ for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":513 */
+ __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":514 */
+ __pyx_v_t = (__pyx_v_sum + __pyx_v_y);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":515 */
+ __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":516 */
+ __pyx_v_sum = __pyx_v_t;
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":517 */
+ __pyx_r = __pyx_v_sum;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ __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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":547 */
+ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state *)PyMem_Malloc((sizeof(rk_state))));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":549 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; 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 = 549; 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);
+ __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL);
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":553 */
+ PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":554 */
+ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = NULL;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ Py_DECREF(__pyx_v_self);
+}
+
+static PyObject *__pyx_n_integer;
+
+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[] = "\n seed(seed=None)\n\n Seed the generator.\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\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_v_iseed;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ unsigned long __pyx_4;
+ 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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_iseed = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":570 */
+ __pyx_1 = __pyx_v_seed == Py_None;
+ if (__pyx_1) {
+ __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+ goto __pyx_L2;
+ }
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_seed);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);
+ __pyx_3 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = __pyx_3 == ((PyObject *)(&PyInt_Type));
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; goto __pyx_L1;}
+ rk_seed(__pyx_4,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+ goto __pyx_L2;
+ }
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_integer); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsInstance(__pyx_v_seed,__pyx_3); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":575 */
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_seed);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);
+ __pyx_3 = PyObject_CallObject(((PyObject *)(&PyInt_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_v_iseed);
+ __pyx_v_iseed = __pyx_3;
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":576 */
+ __pyx_4 = PyInt_AsUnsignedLongMask(__pyx_v_iseed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}
+ rk_seed(__pyx_4,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":578 */
+ __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_seed,NPY_LONG,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject_obj));
+ arrayObject_obj = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":579 */
+ 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(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ __Pyx_AddTraceback("mtrand.RandomState.seed");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(arrayObject_obj);
+ Py_DECREF(__pyx_v_iseed);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_seed);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_uint;
+static PyObject *__pyx_n_asarray;
+static PyObject *__pyx_n_uint32;
+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[] = "\n get_state()\n\n Return a tuple representing the internal state of the generator::\n\n (\'MT19937\', int key[624], int pos, int has_gauss, float cached_gaussian)\n\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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":592 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; 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 = 592; goto __pyx_L1;}
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_uint); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; 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 = 592; 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 = 592; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)arrayObject_state));
+ arrayObject_state = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":593 */
+ memcpy(((void *)arrayObject_state->data),((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key),(624 * (sizeof(long))));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":594 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_asarray); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_uint32); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)arrayObject_state));
+ PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)arrayObject_state));
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_1 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)arrayObject_state));
+ arrayObject_state = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":595 */
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}
+ __pyx_4 = PyFloat_FromDouble(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
+ Py_INCREF(__pyx_n_MT19937);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_n_MT19937);
+ Py_INCREF(((PyObject *)arrayObject_state));
+ PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)arrayObject_state));
+ PyTuple_SET_ITEM(__pyx_3, 2, __pyx_1);
+ PyTuple_SET_ITEM(__pyx_3, 3, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_3, 4, __pyx_4);
+ __pyx_1 = 0;
+ __pyx_2 = 0;
+ __pyx_4 = 0;
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_k70p;
+static PyObject *__pyx_k71p;
+
+static char __pyx_k70[] = "algorithm must be 'MT19937'";
+static char __pyx_k71[] = "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[] = "\n set_state(state)\n\n Set the state from a tuple.\n\n state = (\'MT19937\', int key[624], int pos, int has_gauss, float cached_gaussian)\n\n For backwards compatibility, the following form is also accepted\n although it is missing some information about the cached Gaussian value.\n\n state = (\'MT19937\', int key[624], int pos)\n\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_v_has_gauss;
+ PyObject *__pyx_v_cached_gaussian;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ int __pyx_2;
+ PyObject *__pyx_3 = 0;
+ Py_ssize_t __pyx_4;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ double __pyx_7;
+ 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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_algorithm_name = Py_None; Py_INCREF(Py_None);
+ __pyx_v_key = Py_None; Py_INCREF(Py_None);
+ __pyx_v_has_gauss = Py_None; Py_INCREF(Py_None);
+ __pyx_v_cached_gaussian = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":614 */
+ __pyx_1 = PySequence_GetItem(__pyx_v_state, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_algorithm_name);
+ __pyx_v_algorithm_name = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":615 */
+ if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}
+ __pyx_2 = __pyx_2 != 0;
+ if (__pyx_2) {
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;}
+ Py_INCREF(__pyx_k70p);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k70p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __Pyx_Raise(__pyx_3, 0, 0);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":617 */
+ __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetIter(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_key);
+ __pyx_v_key = __pyx_1;
+ __pyx_1 = 0;
+ __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ __pyx_2 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_v_pos = __pyx_2;
+ if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":618 */
+ __pyx_4 = PyObject_Length(__pyx_v_state); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
+ __pyx_2 = (__pyx_4 == 3);
+ if (__pyx_2) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":619 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_has_gauss);
+ __pyx_v_has_gauss = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":620 */
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_cached_gaussian);
+ __pyx_v_cached_gaussian = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+ __pyx_1 = PySequence_GetSlice(__pyx_v_state, 3, 5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetIter(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_has_gauss);
+ __pyx_v_has_gauss = __pyx_1;
+ __pyx_1 = 0;
+ __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_cached_gaussian);
+ __pyx_v_cached_gaussian = __pyx_1;
+ __pyx_1 = 0;
+ if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":623 */
+ /*try:*/ {
+ __pyx_1 = PyArray_ContiguousFromObject(__pyx_v_key,NPY_ULONG,1,1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L4;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)arrayObject_obj));
+ arrayObject_obj = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+ goto __pyx_L5;
+ __pyx_L4:;
+ Py_XDECREF(__pyx_3); __pyx_3 = 0;
+ Py_XDECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":625 */
+ __pyx_2 = PyErr_ExceptionMatches(PyExc_TypeError);
+ if (__pyx_2) {
+ __Pyx_AddTraceback("mtrand.set_state");
+ if (__Pyx_GetException(&__pyx_3, &__pyx_1, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; goto __pyx_L1;}
+ __pyx_6 = PyArray_ContiguousFromObject(__pyx_v_key,NPY_LONG,1,1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_6)));
+ Py_DECREF(((PyObject *)arrayObject_obj));
+ arrayObject_obj = ((PyArrayObject *)__pyx_6);
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ goto __pyx_L5;
+ }
+ goto __pyx_L1;
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":628 */
+ __pyx_2 = ((arrayObject_obj->dimensions[0]) != 624);
+ if (__pyx_2) {
+ __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;}
+ Py_INCREF(__pyx_k71p);
+ PyTuple_SET_ITEM(__pyx_6, 0, __pyx_k71p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ __Pyx_Raise(__pyx_3, 0, 0);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":630 */
+ memcpy(((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key),((void *)arrayObject_obj->data),(624 * (sizeof(long))));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":631 */
+ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":632 */
+ __pyx_2 = PyInt_AsLong(__pyx_v_has_gauss); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}
+ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss = __pyx_2;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":633 */
+ __pyx_7 = PyFloat_AsDouble(__pyx_v_cached_gaussian); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}
+ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss = __pyx_7;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ __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_has_gauss);
+ Py_DECREF(__pyx_v_cached_gaussian);
+ 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;
+ static char *__pyx_argnames[] = {0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+ Py_INCREF(__pyx_v_self);
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;}
+ __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ __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);
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; 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 = 640; 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(Py_None);
+ 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;
+ static char *__pyx_argnames[] = {0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+ Py_INCREF(__pyx_v_self);
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; 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 = 643; 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 = 643; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; goto __pyx_L1;}
+ __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; 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 = 643; 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_4);
+ __pyx_1 = 0;
+ __pyx_2 = 0;
+ __pyx_4 = 0;
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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.__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[] = "\n random_sample(size=None)\n\n Return random floats in the half-open interval [0.0, 1.0).\n\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);
+ __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 = 653; goto __pyx_L1;}
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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[] = "\n tomaxint(size=None)\n\n Uniformly sample discrete random integers `x` such that\n ``0 <= x <= sys.maxint``.\n\n Parameters\n ----------\n size : tuple of ints, int, optional\n Shape of output. If the given size is, for example, (m,n,k),\n m*n*k samples are generated. If no shape is specified, a single sample\n is returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Uniform sampling over a given half-open interval of integers.\n random_integers : Uniform sampling over a given closed interval of\n integers.\n\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);
+ __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 = 681; goto __pyx_L1;}
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_k72p;
+
+static char __pyx_k72[] = "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[] = "\n randint(low, high=None, size=None)\n\n Return random integers x such that low <= x < high.\n\n If high is None, then 0 <= x < low.\n\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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":698 */
+ __pyx_1 = __pyx_v_high == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":699 */
+ __pyx_v_lo = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":700 */
+ __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
+ __pyx_v_hi = __pyx_2;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":702 */
+ __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}
+ __pyx_v_lo = __pyx_2;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":703 */
+ __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}
+ __pyx_v_hi = __pyx_2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":705 */
+ __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":706 */
+ __pyx_1 = (__pyx_v_diff < 0);
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;}
+ Py_INCREF(__pyx_k72p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);
+ __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;}
+ 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 = 707; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":709 */
+ __pyx_1 = __pyx_v_size == Py_None;
+ if (__pyx_1) {
+ __pyx_3 = PyInt_FromLong((((long)rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)) + __pyx_v_lo)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":712 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_4, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
+ Py_DECREF(((PyObject *)arrayObject));
+ arrayObject = ((PyArrayObject *)__pyx_5);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":713 */
+ __pyx_v_length = PyArray_SIZE(arrayObject);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":714 */
+ __pyx_v_array_data = ((long *)arrayObject->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":715 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+ (__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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":717 */
+ Py_INCREF(((PyObject *)arrayObject));
+ __pyx_r = ((PyObject *)arrayObject);
+ goto __pyx_L0;
+ }
+ __pyx_L4:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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[] = "\n bytes(length)\n\n Return random bytes.\n\n Parameters\n ----------\n length : int\n Number of random bytes.\n\n Returns\n -------\n out : str\n String of length `N`.\n\n Examples\n --------\n >>> np.random.bytes(10)\n \' eh\\x85\\x022SZ\\xbf\\xa4\' #random\n\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(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":742 */
+ __pyx_1 = PyString_FromStringAndSize(NULL,__pyx_v_length); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_bytestring);
+ __pyx_v_bytestring = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":743 */
+ __pyx_v_bytes = PyString_AS_STRING(__pyx_v_bytestring);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":744 */
+ rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":745 */
+ Py_INCREF(__pyx_v_bytestring);
+ __pyx_r = __pyx_v_bytestring;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_n_subtract;
+
+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[] = "\n uniform(low=0.0, high=1.0, size=1)\n\n Draw samples from a uniform distribution.\n\n Samples are uniformly distributed over the half-open interval\n ``[low, high)`` (includes low, but excludes high). In other words,\n any value within the given interval is equally likely to be drawn\n by `uniform`.\n\n Parameters\n ----------\n low : float, optional\n Lower boundary of the output interval. All values generated will be\n greater than or equal to low. The default value is 0.\n high : float\n Upper boundary of the output interval. All values generated will be\n less than high. The default value is 1.0.\n size : tuple of ints, int, optional\n Shape of output. If the given size is, for example, (m,n,k),\n m*n*k samples are generated. If no shape is specified, a single sample\n is returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Discrete uniform distribution, yielding integers.\n random_integers : Discrete uniform distribution over the closed interval\n ``[low, high]``.\n random_sample : Floats uniformly distributed over ``[0, 1)``.\n random : Alias for `random_sample`.\n rand : Convenience function that accepts dimensions as input, e.g.,\n ``rand(2,2)`` would generate a 2-by-2 array of floats, uniformly\n distributed over ``[0, 1)``.\n\n Notes\n -----\n The probability density function of the uniform distribution is\n\n .. math:: p(x) = \\frac{1}{b - a}\n\n anywhere within the interval ``[a, b)``, and zero elsewhere.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> s = np.random.uniform(-1,0,1000)\n\n All values are within the given interval:\n\n >>> np.all(s >= -1)\n True\n\n >>> np.all(s < 0)\n True\n\n Display the histogram of the samples, along with the\n probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 15, normed=True)\n >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_uniform(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;
+ PyArrayObject *__pyx_v_olow;
+ PyArrayObject *__pyx_v_ohigh;
+ PyArrayObject *__pyx_v_odiff;
+ double __pyx_v_flow;
+ double __pyx_v_fhigh;
+ PyObject *__pyx_v_temp;
+ 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_low = __pyx_k8;
+ __pyx_v_high = __pyx_k9;
+ __pyx_v_size = __pyx_k10;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOO", __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);
+ __pyx_v_olow = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_ohigh = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_odiff = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_temp = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":822 */
+ __pyx_v_flow = PyFloat_AsDouble(__pyx_v_low);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":823 */
+ __pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":824 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_flow,(__pyx_v_fhigh - __pyx_v_flow)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":826 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":827 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_low,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_olow));
+ __pyx_v_olow = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":828 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_high,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_ohigh));
+ __pyx_v_ohigh = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":829 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_subtract); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; 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 = 829; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ohigh));
+ PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ohigh));
+ Py_INCREF(((PyObject *)__pyx_v_olow));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_olow));
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_v_temp);
+ __pyx_v_temp = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":830 */
+ Py_INCREF(__pyx_v_temp);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":832 */
+ __pyx_3 = PyArray_EnsureArray(__pyx_v_temp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odiff));
+ __pyx_v_odiff = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":833 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_olow,__pyx_v_odiff); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("mtrand.RandomState.uniform");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_olow);
+ Py_DECREF(__pyx_v_ohigh);
+ Py_DECREF(__pyx_v_odiff);
+ Py_DECREF(__pyx_v_temp);
+ 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_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[] = "\n rand(d0, d1, ..., dn)\n\n Random values in a given shape.\n\n Create an array of the given shape and propagate it with\n random samples from a uniform distribution\n over ``[0, 1)``.\n\n Parameters\n ----------\n d0, d1, ..., dn : int\n Shape of the output.\n\n Returns\n -------\n out : ndarray, shape ``(d0, d1, ..., dn)``\n Random values.\n\n See Also\n --------\n random\n\n Notes\n -----\n This is a convenience function. If you want an interface that\n takes a shape-tuple as the first argument, refer to\n `random`.\n\n Examples\n --------\n >>> np.random.rand(3,2)\n array([[ 0.14022471, 0.96360618], #random\n [ 0.37601032, 0.25528411], #random\n [ 0.49313049, 0.94909878]]) #random\n\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;
+ Py_ssize_t __pyx_1;
+ int __pyx_2;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ static char *__pyx_argnames[] = {0};
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0, 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);
+ __pyx_1 = PyObject_Length(__pyx_v_args); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+ __pyx_2 = (__pyx_1 == 0);
+ if (__pyx_2) {
+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
+ __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+ __pyx_5 = PyDict_New(); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_5, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+ __pyx_6 = PyEval_CallObjectWithKeywords(__pyx_3, __pyx_4, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_r = __pyx_6;
+ __pyx_6 = 0;
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ __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[] = "\n randn(d0, d1, ..., dn)\n\n Returns zero-mean, unit-variance Gaussian random numbers in an\n array of shape (d0, d1, ..., dn).\n\n Note: This is a convenience function. If you want an\n interface that takes a tuple as the first argument\n use numpy.random.standard_normal(shape_tuple).\n\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;
+ Py_ssize_t __pyx_1;
+ int __pyx_2;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {0};
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0, 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);
+ __pyx_1 = PyObject_Length(__pyx_v_args); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; goto __pyx_L1;}
+ __pyx_2 = (__pyx_1 == 0);
+ if (__pyx_2) {
+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}
+ __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_args);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_args);
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_r = __pyx_5;
+ __pyx_5 = 0;
+ goto __pyx_L0;
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __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[] = "\n random_integers(low, high=None, size=None)\n\n Return random integers x such that low <= x <= high.\n\n If high is None, then 1 <= x <= low.\n\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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":904 */
+ __pyx_1 = __pyx_v_high == Py_None;
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":905 */
+ Py_INCREF(__pyx_v_low);
+ Py_DECREF(__pyx_v_high);
+ __pyx_v_high = __pyx_v_low;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":906 */
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_low);
+ __pyx_v_low = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":907 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; 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 = 907; 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 = 907; 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(Py_None);
+ 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[] = "\n standard_normal(size=None)\n\n Standard Normal distribution (mean=0, stdev=1).\n\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);
+ __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 = 917; goto __pyx_L1;}
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_n_any;
+static PyObject *__pyx_n_less_equal;
+
+static PyObject *__pyx_k74p;
+static PyObject *__pyx_k75p;
+
+static char __pyx_k74[] = "scale <= 0";
+static char __pyx_k75[] = "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[] = "\n normal(loc=0.0, scale=1.0, size=None)\n\n Draw random samples from a normal (Gaussian) distribution.\n\n The probability density function of the normal distribution, first\n derived by De Moivre and 200 years later by both Gauss and Laplace\n independently [2]_, is often called the bell curve because of\n its characteristic shape (see the example below).\n\n The normal distributions occurs often in nature. For example, it\n describes the commonly occurring distribution of samples influenced\n by a large number of tiny, random disturbances, each with its own\n unique distribution [2]_.\n\n Parameters\n ----------\n loc : float\n Mean (\"centre\") of the distribution.\n scale : float\n Standard deviation (spread or \"width\") of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.norm : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gaussian distribution is\n\n .. math:: p(x) = \\frac{1}{\\sqrt{ 2 \\pi \\sigma^2 }}\n e^{ - \\frac{ (x - \\mu)^2 } {2 \\sigma^2} },\n\n where :math:`\\mu` is the mean and :math:`\\sigma` the standard deviation.\n The square of the standard deviation, :math:`\\sigma^2`, is called the\n variance.\n\n The function has its peak at the mean, and its \"spread\" increases with\n the standard deviation (the function reaches 0.607 times its maximum at\n :math:`x + \\sigma` and :math:`x - \\sigma` [2]_). This implies that\n `numpy.random.normal` is more likely to return samples lying close to the\n mean, rather than those far away.\n\n References\n ----------\n .. [1] Wikipedia, \"Normal distribution\",\n http://en.wikipedia.org/wiki/Normal_distribution\n .. [2] P. R. Peebles Jr., \"Central Limit Theorem\" in \"Probability, Random\n Variables and Random Signal Principles\", 4th ed., 2001,\n pp. 51, 51, 125.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 0, 0.1 # mean and standard deviation\n >>> s = np.random.normal(mu, sigma, 1000)\n\n Verify the mean and the variance:\n\n >>> abs(mu - np.mean(s)) < 0.01\n True\n\n >>> abs(sigma - np.std(s, ddof=1)) < 0.01\n True\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *\n ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),\n ... linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_loc = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oloc;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_floc;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OOO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_loc);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1004 */
+ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1005 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1006 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1007 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
+ Py_INCREF(__pyx_k74p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k74p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
+ 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 = 1008; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1009 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1011 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1013 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oloc));
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1014 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1015 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;}
+ Py_INCREF(__pyx_k75p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1017 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.normal");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oloc);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_loc);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k76p;
+static PyObject *__pyx_k77p;
+static PyObject *__pyx_k78p;
+static PyObject *__pyx_k79p;
+
+static char __pyx_k76[] = "a <= 0";
+static char __pyx_k77[] = "b <= 0";
+static char __pyx_k78[] = "a <= 0";
+static char __pyx_k79[] = "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[] = "\n beta(a, b, size=None)\n\n The Beta distribution over ``[0, 1]``.\n\n The Beta distribution is a special case of the Dirichlet distribution,\n and is related to the Gamma distribution. It has the probability\n distribution function\n\n .. math:: f(x; a,b) = \\frac{1}{B(\\alpha, \\beta)} x^{\\alpha - 1}\n (1 - x)^{\\beta - 1},\n\n where the normalisation, B, is the beta function,\n\n .. math:: B(\\alpha, \\beta) = \\int_0^1 t^{\\alpha - 1}\n (1 - t)^{\\beta - 1} dt.\n\n It is often seen in Bayesian inference and order statistics.\n\n Parameters\n ----------\n a : float\n Alpha, non-negative.\n b : float\n Beta, non-negative.\n size : tuple of ints, optional\n The number of samples to draw. The ouput is packed according to\n the size given.\n\n Returns\n -------\n out : ndarray\n Array of the given shape, containing values drawn from a\n Beta distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_a = 0;
+ PyObject *__pyx_v_b = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oa;
+ PyArrayObject *__pyx_v_ob;
+ double __pyx_v_fa;
+ double __pyx_v_fb;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"a","b","size",0};
+ __pyx_v_size = __pyx_k17;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_a);
+ Py_INCREF(__pyx_v_b);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_ob = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1059 */
+ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1060 */
+ __pyx_v_fb = PyFloat_AsDouble(__pyx_v_b);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1061 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1062 */
+ __pyx_1 = (__pyx_v_fa <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;}
+ Py_INCREF(__pyx_k76p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k76p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;}
+ 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 = 1063; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1064 */
+ __pyx_1 = (__pyx_v_fb <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;}
+ Py_INCREF(__pyx_k77p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k77p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;}
+ 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 = 1065; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1066 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_fa,__pyx_v_fb); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1068 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1070 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oa));
+ __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1071 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_b,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_ob));
+ __pyx_v_ob = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1072 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
+ Py_INCREF(__pyx_k78p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1074 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ob));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_ob));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
+ Py_INCREF(__pyx_k79p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k79p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
+ 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 = 1075; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1076 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_oa,__pyx_v_ob); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.beta");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_ob);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_a);
+ Py_DECREF(__pyx_v_b);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k80p;
+static PyObject *__pyx_k81p;
+
+static char __pyx_k80[] = "scale <= 0";
+static char __pyx_k81[] = "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[] = "\n exponential(scale=1.0, size=None)\n\n Exponential distribution.\n\n Its probability density function is\n\n .. math:: f(x; \\lambda) = \\lambda \\exp(-\\lambda x),\n\n for ``x > 0`` and 0 elsewhere. :math:`lambda` is\n known as the rate parameter.\n\n The exponential distribution is a continuous analogue of the\n geometric distribution. It describes many common situations, such as\n the size of raindrops measured over many rainstorms [1]_, or the time\n between page requests to Wikipedia [2]_.\n\n Parameters\n ----------\n scale : float\n The rate parameter, :math:`\\lambda`.\n size : tuple of ints\n Number of samples to draw. The output is shaped\n according to `size`.\n\n References\n ----------\n .. [1] Peyton Z. Peebles Jr., \"Probability, Random Variables and\n Random Signal Principles\", 4th ed, 2001, p. 57.\n .. [2] \"Poisson Process\", Wikipedia,\n http://en.wikipedia.org/wiki/Poisson_process\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OO", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1115 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1116 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1117 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;}
+ Py_INCREF(__pyx_k80p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k80p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;}
+ 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 = 1118; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1119 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1121 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1123 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1124 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;}
+ Py_INCREF(__pyx_k81p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k81p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;}
+ 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 = 1125; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1126 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.exponential");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_scale);
+ 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[] = "\n standard_exponential(size=None)\n\n Standard exponential distribution (scale=1).\n\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);
+ __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 = 1135; goto __pyx_L1;}
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_k82p;
+static PyObject *__pyx_k83p;
+
+static char __pyx_k82[] = "shape <= 0";
+static char __pyx_k83[] = "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[] = "\n standard_gamma(shape, size=None)\n\n Standard Gamma distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_shape = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oshape;
+ double __pyx_v_fshape;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"shape","size",0};
+ __pyx_v_size = __pyx_k21;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_shape);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1147 */
+ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1148 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1149 */
+ __pyx_1 = (__pyx_v_fshape <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+ Py_INCREF(__pyx_k82p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k82p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+ 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 = 1150; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1151 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_fshape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1153 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1154 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oshape));
+ __pyx_v_oshape = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1155 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oshape));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oshape));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+ Py_INCREF(__pyx_k83p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k83p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+ 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 = 1156; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1157 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_oshape); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.standard_gamma");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oshape);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_shape);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k84p;
+static PyObject *__pyx_k85p;
+static PyObject *__pyx_k86p;
+static PyObject *__pyx_k87p;
+
+static char __pyx_k84[] = "shape <= 0";
+static char __pyx_k85[] = "scale <= 0";
+static char __pyx_k86[] = "shape <= 0";
+static char __pyx_k87[] = "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[] = "\n gamma(shape, scale=1.0, size=None)\n\n Draw samples from a Gamma distribution.\n\n Samples are drawn from a Gamma distribution with specified parameters,\n `shape` (sometimes designated \"k\") and `scale` (sometimes designated\n \"theta\"), where both parameters are > 0.\n\n Parameters\n ----------\n shape : scalar > 0\n The shape of the gamma distribution.\n scale : scalar > 0, optional\n The scale of the gamma distribution. Default is equal to 1.\n size : shape_tuple, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n out : ndarray, float\n Returns one sample unless `size` parameter is specified.\n\n See Also\n --------\n scipy.stats.distributions.gamma : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gamma distribution is\n\n .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n\n where :math:`k` is the shape and :math:`\\theta` the scale,\n and :math:`\\Gamma` is the Gamma function.\n\n The Gamma distribution is often used to model the times to failure of\n electronic components, and arises naturally in processes for which the\n waiting times between Poisson distributed events are relevant.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/GammaDistribution.html\n .. [2] Wikipedia, \"Gamma-distribution\",\n http://en.wikipedia.org/wiki/Gamma-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> shape, scale = 2., 2. # mean and dispersion\n >>> s = np.random.gamma(shape, scale, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> y = bins**(shape-1)*((exp(-bins/scale))/\\\n (sps.gamma(shape)*scale**shape))\n >>> plt.plot(bins, y, linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_shape = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oshape;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_fshape;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "O|OO", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_shape);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1232 */
+ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1233 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1234 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1235 */
+ __pyx_1 = (__pyx_v_fshape <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; goto __pyx_L1;}
+ Py_INCREF(__pyx_k84p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k84p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; goto __pyx_L1;}
+ 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 = 1236; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1237 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; goto __pyx_L1;}
+ Py_INCREF(__pyx_k85p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k85p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; goto __pyx_L1;}
+ 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 = 1238; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1239 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_fshape,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1241 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1242 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oshape));
+ __pyx_v_oshape = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1243 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1244 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oshape));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oshape));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;}
+ Py_INCREF(__pyx_k86p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1246 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;}
+ Py_INCREF(__pyx_k87p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k87p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;}
+ 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 = 1247; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1248 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_oshape,__pyx_v_oscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.gamma");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oshape);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_shape);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k88p;
+static PyObject *__pyx_k89p;
+static PyObject *__pyx_k90p;
+static PyObject *__pyx_k91p;
+
+static char __pyx_k88[] = "shape <= 0";
+static char __pyx_k89[] = "scale <= 0";
+static char __pyx_k90[] = "dfnum <= 0";
+static char __pyx_k91[] = "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[] = "\n f(dfnum, dfden, size=None)\n\n Draw samples from a F distribution.\n\n Samples are drawn from an F distribution with specified parameters,\n `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom\n in denominator), where both parameters should be greater than zero.\n\n The random variate of the F distribution (also known as the\n Fisher distribution) is a continuous probability distribution\n that arises in ANOVA tests, and is the ratio of two chi-square\n variates.\n\n Parameters\n ----------\n dfnum : float\n Degrees of freedom in numerator. Should be greater than zero.\n dfden : float\n Degrees of freedom in denominator. Should be greater than zero.\n size : {tuple, int}, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``,\n then ``m * n * k`` samples are drawn. By default only one sample\n is returned.\n\n Returns\n -------\n samples : {ndarray, scalar}\n Samples from the Fisher distribution.\n\n See Also\n --------\n scipy.stats.distributions.f : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n\n The F statistic is used to compare in-group variances to between-group\n variances. Calculating the distribution depends on the sampling, and\n so it is a function of the respective degrees of freedom in the\n problem. The variable `dfnum` is the number of samples minus one, the\n between-groups degrees of freedom, while `dfden` is the within-groups\n degrees of freedom, the sum of the number of samples in each group\n minus the number of groups.\n\n References\n ----------\n .. [1] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.\n .. [2] Wikipedia, \"F-distribution\",\n http://en.wikipedia.org/wiki/F-distribution\n\n Examples\n --------\n An example from Glantz[1], pp 47-40.\n Two groups, children of diabetics (25 people) and children from people\n without diabetes (25 controls). Fasting blood glucose was measured,\n case group had a mean value of 86.1, controls had a mean value of\n 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these\n data consistent with the null hypothesis that the parents diabetic\n status does not affect their children\'s blood glucose levels?\n Calculating the F statistic from the data gives a value of 36.01.\n\n Draw samples from the distribution:\n\n >>> dfnum = 1. # between group degrees of freedom\n >>> dfden = 48. # within groups degrees of freedom\n >>> s = np.random.f(dfnum, dfden, 1000)\n\n The lower bound for the top 1% of the samples is :\n\n >>> sort(s)[-10]\n 7.61988120985\n\n So there is about a 1% chance that the F statistic will exceed 7.62,\n the measured value is 36, so the null hypothesis is rejected at the 1%\n level.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_dfnum = 0;
+ PyObject *__pyx_v_dfden = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_odfnum;
+ PyArrayObject *__pyx_v_odfden;
+ double __pyx_v_fdfnum;
+ double __pyx_v_fdfden;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"dfnum","dfden","size",0};
+ __pyx_v_size = __pyx_k24;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_dfnum);
+ Py_INCREF(__pyx_v_dfden);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_odfnum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1334 */
+ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1335 */
+ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1336 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1337 */
+ __pyx_1 = (__pyx_v_fdfnum <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
+ Py_INCREF(__pyx_k88p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k88p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
+ 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 = 1338; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1339 */
+ __pyx_1 = (__pyx_v_fdfden <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;}
+ Py_INCREF(__pyx_k89p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k89p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;}
+ 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 = 1340; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1341 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_fdfnum,__pyx_v_fdfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1343 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1345 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odfnum));
+ __pyx_v_odfnum = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1346 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_odfden));
+ __pyx_v_odfden = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1347 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odfnum));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odfnum));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
+ Py_INCREF(__pyx_k90p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1349 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odfden));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_odfden));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; goto __pyx_L1;}
+ Py_INCREF(__pyx_k91p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k91p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; goto __pyx_L1;}
+ 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 = 1350; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1351 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.f");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_odfnum);
+ Py_DECREF(__pyx_v_odfden);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_dfnum);
+ Py_DECREF(__pyx_v_dfden);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_less;
+
+static PyObject *__pyx_k92p;
+static PyObject *__pyx_k93p;
+static PyObject *__pyx_k94p;
+static PyObject *__pyx_k95p;
+static PyObject *__pyx_k96p;
+static PyObject *__pyx_k97p;
+
+static char __pyx_k92[] = "dfnum <= 1";
+static char __pyx_k93[] = "dfden <= 0";
+static char __pyx_k94[] = "nonc < 0";
+static char __pyx_k95[] = "dfnum <= 1";
+static char __pyx_k96[] = "dfden <= 0";
+static char __pyx_k97[] = "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[] = "\n noncentral_f(dfnum, dfden, nonc, size=None)\n\n Noncentral F distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_dfnum = 0;
+ PyObject *__pyx_v_dfden = 0;
+ PyObject *__pyx_v_nonc = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_odfnum;
+ PyArrayObject *__pyx_v_odfden;
+ PyArrayObject *__pyx_v_ononc;
+ double __pyx_v_fdfnum;
+ double __pyx_v_fdfden;
+ double __pyx_v_fnonc;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"dfnum","dfden","nonc","size",0};
+ __pyx_v_size = __pyx_k25;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|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_dfnum);
+ Py_INCREF(__pyx_v_dfden);
+ Py_INCREF(__pyx_v_nonc);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_odfnum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1363 */
+ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1364 */
+ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1365 */
+ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1366 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1367 */
+ __pyx_1 = (__pyx_v_fdfnum <= 1);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;}
+ Py_INCREF(__pyx_k92p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k92p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;}
+ 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 = 1368; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1369 */
+ __pyx_1 = (__pyx_v_fdfden <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;}
+ Py_INCREF(__pyx_k93p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k93p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;}
+ 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 = 1370; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1371 */
+ __pyx_1 = (__pyx_v_fnonc < 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+ Py_INCREF(__pyx_k94p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k94p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+ 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 = 1372; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1373 */
+ __pyx_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_fdfnum,__pyx_v_fdfden,__pyx_v_fnonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1376 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1378 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odfnum));
+ __pyx_v_odfnum = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1379 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_odfden));
+ __pyx_v_odfden = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1380 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_ononc));
+ __pyx_v_ononc = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1382 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odfnum));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odfnum));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+ Py_INCREF(__pyx_k95p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k95p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+ 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 = 1383; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1384 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odfden));
+ PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_odfden));
+ 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 = 1384; 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 = 1384; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; goto __pyx_L1;}
+ Py_INCREF(__pyx_k96p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k96p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; goto __pyx_L1;}
+ 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 = 1385; goto __pyx_L1;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1386 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ononc));
+ PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_ononc));
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; goto __pyx_L1;}
+ Py_INCREF(__pyx_k97p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; goto __pyx_L1;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1388 */
+ __pyx_5 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden,__pyx_v_ononc); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; goto __pyx_L1;}
+ __pyx_r = __pyx_5;
+ __pyx_5 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.noncentral_f");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_odfnum);
+ Py_DECREF(__pyx_v_odfden);
+ Py_DECREF(__pyx_v_ononc);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_dfnum);
+ Py_DECREF(__pyx_v_dfden);
+ Py_DECREF(__pyx_v_nonc);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k98p;
+static PyObject *__pyx_k99p;
+
+static char __pyx_k98[] = "df <= 0";
+static char __pyx_k99[] = "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[] = "\n chisquare(df, size=None)\n\n Draw samples from a chi-square distribution.\n\n When `df` independent random variables, each with standard\n normal distributions (mean 0, variance 1), are squared and summed,\n the resulting distribution is chi-square (see Notes). This\n distribution is often used in hypothesis testing.\n\n Parameters\n ----------\n df : int\n Number of degrees of freedom.\n size : tuple of ints, int, optional\n Size of the returned array. By default, a scalar is\n returned.\n\n Returns\n -------\n output : ndarray\n Samples drawn from the distribution, packed in a `size`-shaped\n array.\n\n Raises\n ------\n ValueError\n When `df` <= 0 or when an inappropriate `size` (e.g. ``size=-1``)\n is given.\n\n Notes\n -----\n The variable obtained by summing the squares of `df` independent,\n standard normally distributed random variables:\n\n .. math:: Q = \\sum_{i=0}^{\\mathtt{df}} X^2_i\n\n is chi-square distributed, denoted\n\n .. math:: Q \\sim \\chi^2_k.\n\n The probability density function of the chi-squared distribution is\n\n .. math:: p(x) = \\frac{(1/2)^{k/2}}{\\Gamma(k/2)}\n x^{k/2 - 1} e^{-x/2},\n\n where :math:`\\Gamma` is the gamma function,\n\n .. math:: \\Gamma(x) = \\int_0^{-\\infty} t^{x - 1} e^{-t} dt.\n\n References\n ----------\n .. [1] NIST/SEMATECH e-Handbook of Statistical Methods,\n http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm\n .. [2] Wikipedia, \"Chi-square distribution\",\n http://en.wikipedia.org/wiki/Chi-square_distribution\n\n Examples\n --------\n >>> np.random.chisquare(2,4)\n array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272])\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_df = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_odf;
+ double __pyx_v_fdf;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"df","size",0};
+ __pyx_v_size = __pyx_k26;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_df);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1458 */
+ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1459 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1460 */
+ __pyx_1 = (__pyx_v_fdf <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
+ Py_INCREF(__pyx_k98p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k98p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
+ 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 = 1461; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1462 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_fdf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1464 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1466 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odf));
+ __pyx_v_odf = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1467 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
+ Py_INCREF(__pyx_k99p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k99p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
+ 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 = 1468; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1469 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_odf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.chisquare");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_odf);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_df);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k100p;
+static PyObject *__pyx_k101p;
+static PyObject *__pyx_k102p;
+static PyObject *__pyx_k103p;
+
+static char __pyx_k100[] = "df <= 0";
+static char __pyx_k101[] = "nonc <= 0";
+static char __pyx_k102[] = "df <= 1";
+static char __pyx_k103[] = "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[] = "\n noncentral_chisquare(df, nonc, size=None)\n\n Draw samples from a noncentral chi-square distribution.\n\n The noncentral :math:`\\chi^2` distribution is a generalisation of\n the :math:`\\chi^2` distribution.\n\n Parameters\n ----------\n df : int\n Degrees of freedom.\n nonc : float\n Non-centrality.\n size : tuple of ints\n Shape of the output.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_df = 0;
+ PyObject *__pyx_v_nonc = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_odf;
+ PyArrayObject *__pyx_v_ononc;
+ double __pyx_v_fdf;
+ double __pyx_v_fnonc;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"df","nonc","size",0};
+ __pyx_v_size = __pyx_k27;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_df);
+ Py_INCREF(__pyx_v_nonc);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1492 */
+ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1493 */
+ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1494 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1495 */
+ __pyx_1 = (__pyx_v_fdf <= 1);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; goto __pyx_L1;}
+ Py_INCREF(__pyx_k100p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k100p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; goto __pyx_L1;}
+ 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 = 1496; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1497 */
+ __pyx_1 = (__pyx_v_fnonc <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;}
+ Py_INCREF(__pyx_k101p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k101p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;}
+ 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 = 1498; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1499 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_fdf,__pyx_v_fnonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1502 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1504 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odf));
+ __pyx_v_odf = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1505 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_ononc));
+ __pyx_v_ononc = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1506 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; goto __pyx_L1;}
+ Py_INCREF(__pyx_k102p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1508 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ononc));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_ononc));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
+ Py_INCREF(__pyx_k103p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k103p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
+ 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 = 1509; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1510 */
+ __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_odf,__pyx_v_ononc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.noncentral_chisquare");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_odf);
+ Py_DECREF(__pyx_v_ononc);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_df);
+ Py_DECREF(__pyx_v_nonc);
+ 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[] = "\n standard_cauchy(size=None)\n\n Standard Cauchy with mode=0.\n\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);
+ __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 = 1520; goto __pyx_L1;}
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ 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_k104p;
+static PyObject *__pyx_k105p;
+
+static char __pyx_k104[] = "df <= 0";
+static char __pyx_k105[] = "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[] = "\n standard_t(df, size=None)\n\n Standard Student\'s t distribution with df degrees of freedom.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_df = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_odf;
+ double __pyx_v_fdf;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"df","size",0};
+ __pyx_v_size = __pyx_k29;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_df);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1532 */
+ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1533 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1534 */
+ __pyx_1 = (__pyx_v_fdf <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; goto __pyx_L1;}
+ Py_INCREF(__pyx_k104p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k104p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; goto __pyx_L1;}
+ 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 = 1535; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1536 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_fdf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1538 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1540 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_odf));
+ __pyx_v_odf = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1541 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; goto __pyx_L1;}
+ Py_INCREF(__pyx_k105p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k105p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; goto __pyx_L1;}
+ 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 = 1542; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1543 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_odf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.standard_t");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_odf);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_df);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k106p;
+static PyObject *__pyx_k107p;
+
+static char __pyx_k106[] = "kappa < 0";
+static char __pyx_k107[] = "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[] = "\n vonmises(mu=0.0, kappa=1.0, size=None)\n\n Draw samples from a von Mises distribution.\n\n Samples are drawn from a von Mises distribution with specified mode (mu)\n and dispersion (kappa), on the interval [-pi, pi].\n\n The von Mises distribution (also known as the circular normal\n distribution) is a continuous probability distribution on the circle. It\n may be thought of as the circular analogue of the normal distribution.\n\n Parameters\n ----------\n mu : float\n Mode (\"center\") of the distribution.\n kappa : float, >= 0.\n Dispersion of the distribution.\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n The returned samples live on the unit circle [-\\pi, \\pi].\n\n See Also\n --------\n scipy.stats.distributions.vonmises : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the von Mises distribution is\n\n .. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},\n\n where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,\n and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.\n\n The von Mises, named for Richard Edler von Mises, born in\n Austria-Hungary, in what is now the Ukraine. He fled to the United\n States in 1939 and became a professor at Harvard. He worked in\n probability theory, aerodynamics, fluid mechanics, and philosophy of\n science.\n\n References\n ----------\n .. [1] Abramowitz, M. and Stegun, I. A. (ed.), Handbook of Mathematical\n Functions, National Bureau of Standards, 1964; reprinted Dover\n Publications, 1965.\n .. [2] von Mises, Richard, 1964, Mathematical Theory of Probability\n and Statistics (New York: Academic Press).\n .. [3] Wikipedia, \"Von Mises distribution\",\n http://en.wikipedia.org/wiki/Von_Mises_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, kappa = 0.0, 4.0 # mean and dispersion\n >>> s = np.random.vonmises(mu, kappa, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> x = arange(-pi, pi, 2*pi/50.)\n >>> y = -np.exp(kappa*np.cos(x-mu))/(2*pi*sps.jn(0,kappa))\n >>> plt.plot(x, y/max(y), linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_mu = 0;
+ PyObject *__pyx_v_kappa = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_omu;
+ PyArrayObject *__pyx_v_okappa;
+ double __pyx_v_fmu;
+ double __pyx_v_fkappa;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"mu","kappa","size",0};
+ __pyx_v_size = __pyx_k30;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_mu);
+ Py_INCREF(__pyx_v_kappa);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_omu = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_okappa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1625 */
+ __pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1626 */
+ __pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1627 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1628 */
+ __pyx_1 = (__pyx_v_fkappa < 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; goto __pyx_L1;}
+ Py_INCREF(__pyx_k106p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k106p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; goto __pyx_L1;}
+ 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 = 1629; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1630 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_fmu,__pyx_v_fkappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1632 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1634 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_mu,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_omu));
+ __pyx_v_omu = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1635 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_kappa,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_okappa));
+ __pyx_v_okappa = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1636 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_okappa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_okappa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; goto __pyx_L1;}
+ Py_INCREF(__pyx_k107p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1638 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_omu,__pyx_v_okappa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.vonmises");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_omu);
+ Py_DECREF(__pyx_v_okappa);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_mu);
+ Py_DECREF(__pyx_v_kappa);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k108p;
+static PyObject *__pyx_k109p;
+
+static char __pyx_k108[] = "a <= 0";
+static char __pyx_k109[] = "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[] = "\n pareto(a, size=None)\n\n Draw samples from a Pareto distribution with specified shape.\n\n This is a simplified version of the Generalized Pareto distribution\n (available in SciPy), with the scale set to one and the location set to\n zero. Most authors default the location to one.\n\n The Pareto distribution must be greater than zero, and is unbounded above.\n It is also known as the \"80-20 rule\". In this distribution, 80 percent of\n the weights are in the lowest 20 percent of the range, while the other 20\n percent fill the remaining 80 percent of the range.\n\n Parameters\n ----------\n shape : float, > 0.\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.genpareto.pdf : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Pareto distribution is\n\n .. math:: p(x) = \\frac{am^a}{x^{a+1}}\n\n where :math:`a` is the shape and :math:`m` the location\n\n The Pareto distribution, named after the Italian economist Vilfredo Pareto,\n is a power law probability distribution useful in many real world problems.\n Outside the field of economics it is generally referred to as the Bradford\n distribution. Pareto developed the distribution to describe the\n distribution of wealth in an economy. It has also found use in insurance,\n web page access statistics, oil field sizes, and many other problems,\n including the download frequency for projects in Sourceforge [1]. It is\n one of the so-called \"fat-tailed\" distributions.\n\n\n References\n ----------\n .. [1] Francis Hunt and Paul Johnson, On the Pareto Distribution of\n Sourceforge projects.\n .. [2] Pareto, V. (1896). Course of Political Economy. Lausanne.\n .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 23-30.\n .. [4] Wikipedia, \"Pareto distribution\",\n http://en.wikipedia.org/wiki/Pareto_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a, m = 3., 1. # shape and mode\n >>> s = np.random.pareto(a, 1000) + m\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align=\'center\')\n >>> fit = a*m**a/bins**(a+1)\n >>> plt.plot(bins, max(count)*fit/max(fit),linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_a = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oa;
+ double __pyx_v_fa;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"a","size",0};
+ __pyx_v_size = __pyx_k31;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_a);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1716 */
+ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1717 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1718 */
+ __pyx_1 = (__pyx_v_fa <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;}
+ Py_INCREF(__pyx_k108p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;}
+ 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 = 1719; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1720 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1720; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1722 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1724 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oa));
+ __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1725 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; goto __pyx_L1;}
+ Py_INCREF(__pyx_k109p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k109p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; goto __pyx_L1;}
+ 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 = 1726; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1727 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.pareto");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_a);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k110p;
+static PyObject *__pyx_k111p;
+
+static char __pyx_k110[] = "a <= 0";
+static char __pyx_k111[] = "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[] = "\n weibull(a, size=None)\n\n Weibull distribution.\n\n Draw samples from a 1-parameter Weibull distribution with the given\n shape parameter.\n\n .. math:: X = (-ln(U))^{1/a}\n\n Here, U is drawn from the uniform distribution over (0,1].\n\n The more common 2-parameter Weibull, including a scale parameter\n :math:`\\lambda` is just :math:`X = \\lambda(-ln(U))^{1/a}`.\n\n The Weibull (or Type III asymptotic extreme value distribution for smallest\n values, SEV Type III, or Rosin-Rammler distribution) is one of a class of\n Generalized Extreme Value (GEV) distributions used in modeling extreme\n value problems. This class includes the Gumbel and Frechet distributions.\n\n Parameters\n ----------\n a : float\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.weibull : probability density function,\n distribution or cumulative density function, etc.\n\n gumbel, scipy.stats.distributions.genextreme\n\n Notes\n -----\n The probability density for the Weibull distribution is\n\n .. math:: p(x) = \\frac{a}\n {\\lambda}(\\frac{x}{\\lambda})^{a-1}e^{-(x/\\lambda)^a},\n\n where :math:`a` is the shape and :math:`\\lambda` the scale.\n\n The function has its peak (the mode) at\n :math:`\\lambda(\\frac{a-1}{a})^{1/a}`.\n\n When ``a = 1``, the Weibull distribution reduces to the exponential\n distribution.\n\n References\n ----------\n .. [1] Waloddi Weibull, Professor, Royal Technical University, Stockholm,\n 1939 \"A Statistical Theory Of The Strength Of Materials\",\n Ingeniorsvetenskapsakademiens Handlingar Nr 151, 1939,\n Generalstabens Litografiska Anstalts Forlag, Stockholm.\n .. [2] Waloddi Weibull, 1951 \"A Statistical Distribution Function of Wide\n Applicability\", Journal Of Applied Mechanics ASME Paper.\n .. [3] Wikipedia, \"Weibull distribution\",\n http://en.wikipedia.org/wiki/Weibull_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 5. # shape\n >>> s = np.random.weibull(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> def weib(x,n,a):\n ... return (a/n)*(x/n)**(a-1)*exp(-(x/n)**a)\n\n >>> count, bins, ignored = plt.hist(numpy.random.weibull(5.,1000))\n >>> scale = count.max()/weib(x, 1., 5.).max()\n >>> x = arange(1,100.)/50.\n >>> plt.plot(x, weib(x, 1., 5.)*scale)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_a = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oa;
+ double __pyx_v_fa;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"a","size",0};
+ __pyx_v_size = __pyx_k32;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_a);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1815 */
+ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1816 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1817 */
+ __pyx_1 = (__pyx_v_fa <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; goto __pyx_L1;}
+ Py_INCREF(__pyx_k110p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k110p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; goto __pyx_L1;}
+ 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 = 1818; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1819 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1821 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1823 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oa));
+ __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1824 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; goto __pyx_L1;}
+ Py_INCREF(__pyx_k111p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; goto __pyx_L1;}
+ 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 = 1825; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1826 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.weibull");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_a);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k112p;
+static PyObject *__pyx_k113p;
+
+static char __pyx_k112[] = "a <= 0";
+static char __pyx_k113[] = "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[] = "\n power(a, size=None)\n\n Power distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_a = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oa;
+ double __pyx_v_fa;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"a","size",0};
+ __pyx_v_size = __pyx_k33;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_a);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1838 */
+ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1839 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1840 */
+ __pyx_1 = (__pyx_v_fa <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; goto __pyx_L1;}
+ Py_INCREF(__pyx_k112p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; goto __pyx_L1;}
+ 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 = 1841; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1842 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1844 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1846 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oa));
+ __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1847 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1848; goto __pyx_L1;}
+ Py_INCREF(__pyx_k113p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1848; goto __pyx_L1;}
+ 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 = 1848; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1849 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1849; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.power");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_a);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k114p;
+static PyObject *__pyx_k115p;
+
+static char __pyx_k114[] = "scale <= 0";
+static char __pyx_k115[] = "scale <= 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[] = "\n laplace(loc=0.0, scale=1.0, size=None)\n\n Laplace or double exponential distribution.\n\n It has the probability density function\n\n .. math:: f(x; \\mu, \\lambda) = \\frac{1}{2\\lambda}\n \\exp\\left(-\\frac{|x - \\mu|}{\\lambda}\\right).\n\n The Laplace distribution is similar to the Gaussian/normal distribution,\n but is sharper at the peak and has fatter tails.\n\n Parameters\n ----------\n loc : float\n The position, :math:`\\mu`, of the distribution peak.\n scale : float\n :math:`\\lambda`, the exponential decay.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_loc = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oloc;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_floc;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OOO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_loc);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1876 */
+ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1877 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1878 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1879 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; goto __pyx_L1;}
+ Py_INCREF(__pyx_k114p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k114p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; goto __pyx_L1;}
+ 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 = 1880; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1881 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1883 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1884 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oloc));
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1885 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1886 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; goto __pyx_L1;}
+ Py_INCREF(__pyx_k115p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k115p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1888 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.laplace");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oloc);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_loc);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k116p;
+static PyObject *__pyx_k117p;
+
+static char __pyx_k116[] = "scale <= 0";
+static char __pyx_k117[] = "scale <= 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[] = "\n gumbel(loc=0.0, scale=1.0, size=None)\n\n Gumbel distribution.\n\n Draw samples from a Gumbel distribution with specified location (or mean)\n and scale (or standard deviation).\n\n The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value\n Type I) distribution is one of a class of Generalized Extreme Value (GEV)\n distributions used in modeling extreme value problems. The Gumbel is a\n special case of the Extreme Value Type I distribution for maximums from\n distributions with \"exponential-like\" tails, it may be derived by\n considering a Gaussian process of measurements, and generating the pdf for\n the maximum values from that set of measurements (see examples).\n\n Parameters\n ----------\n loc : float\n The location of the mode of the distribution.\n scale : float\n The scale parameter of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.gumbel : probability density function,\n distribution or cumulative density function, etc.\n weibull, scipy.stats.genextreme\n\n Notes\n -----\n The probability density for the Gumbel distribution is\n\n .. math:: p(x) = \\frac{e^{-(x - \\mu)/ \\beta}}{\\beta} e^{ -e^{-(x - \\mu)/\n \\beta}},\n\n where :math:`\\mu` is the mode, a location parameter, and :math:`\\beta`\n is the scale parameter.\n\n The Gumbel (named for German mathematician Emil Julius Gumbel) was used\n very early in the hydrology literature, for modeling the occurrence of\n flood events. It is also used for modeling maximum wind speed and rainfall\n rates. It is a \"fat-tailed\" distribution - the probability of an event in\n the tail of the distribution is larger than if one used a Gaussian, hence\n the surprisingly frequent occurrence of 100-year floods. Floods were\n initially modeled as a Gaussian process, which underestimated the frequency\n of extreme events.\n\n It is one of a class of extreme value distributions, the Generalized\n Extreme Value (GEV) distributions, which also includes the Weibull and\n Frechet.\n\n The function has a mean of :math:`\\mu + 0.57721\\beta` and a variance of\n :math:`\\frac{\\pi^2}{6}\\beta^2`.\n\n References\n ----------\n .. [1] Gumbel, E.J. (1958). Statistics of Extremes. Columbia University\n Press.\n .. [2] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme\n Values, from Insurance, Finance, Hydrology and Other Fields,\n Birkhauser Verlag, Basel: Boston : Berlin.\n .. [3] Wikipedia, \"Gumbel distribution\",\n http://en.wikipedia.org/wiki/Gumbel_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, beta = 0, 0.1 # location and scale\n >>> s = np.random.gumbel(mu, beta, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp( -np.exp( -(bins - mu) /beta) ),\n ... linewidth=2, color=\'r\')\n >>> plt.show()\n\n Show how an extreme value distribution can arise from a Gaussian process\n and compare to a Gaussian:\n\n >>> means = []\n >>> maxima = []\n >>> for i in range(0,1000) :\n ... a = np.random.normal(mu, beta, 1000)\n ... means.append(a.mean())\n ... maxima.append(a.max())\n >>> count, bins, ignored = plt.hist(maxima, 30, normed=True)\n >>> beta = np.std(maxima)*np.pi/np.sqrt(6)\n >>> mu = np.mean(maxima) - 0.57721*beta\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp(-np.exp(-(bins - mu)/beta)),\n ... linewidth=2, color=\'r\')\n >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi))\n ... * np.exp(-(bins - mu)**2 / (2 * beta**2)),\n ... linewidth=2, color=\'g\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_loc = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oloc;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_floc;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OOO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_loc);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2000 */
+ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2001 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2002 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2003 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; goto __pyx_L1;}
+ Py_INCREF(__pyx_k116p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k116p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; goto __pyx_L1;}
+ 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 = 2004; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2005 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2007 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2008 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oloc));
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2009 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2010 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; goto __pyx_L1;}
+ Py_INCREF(__pyx_k117p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k117p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2012 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2012; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.gumbel");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oloc);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_loc);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k118p;
+static PyObject *__pyx_k119p;
+
+static char __pyx_k118[] = "scale <= 0";
+static char __pyx_k119[] = "scale <= 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[] = "\n logistic(loc=0.0, scale=1.0, size=None)\n\n Draw samples from a Logistic distribution.\n\n Samples are drawn from a Logistic distribution with specified\n parameters, loc (location or mean, also median), and scale (>0).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logistic : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Logistic distribution is\n\n .. math:: P(x) = P(x) = \\frac{e^{-(x-\\mu)/s}}{s(1+e^{-(x-\\mu)/s})^2},\n\n where :math:`\\mu` = location and :math:`s` = scale.\n\n The Logistic distribution is used in Extreme Value problems where it\n can act as a mixture of Gumbel distributions, in Epidemiology, and by\n the World Chess Federation (FIDE) where it is used in the Elo ranking\n system, assuming the performance of each player is a logistically\n distributed random variable.\n\n References\n ----------\n .. [1] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme\n Values, from Insurance, Finance, Hydrology and Other Fields,\n Birkhauser Verlag, Basel, pp 132-133.\n .. [2] Weisstein, Eric W. \"Logistic Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/LogisticDistribution.html\n .. [3] Wikipedia, \"Logistic-distribution\",\n http://en.wikipedia.org/wiki/Logistic-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> loc, scale = 10, 1\n >>> s = np.random.logistic(loc, scale, 10000)\n >>> count, bins, ignored = plt.hist(s, bins=50)\n\n # plot against distribution\n\n >>> def logist(x, loc, scale):\n ... return exp((loc-x)/scale)/(scale*(1+exp((loc-x)/scale))**2)\n >>> plt.plot(bins, logist(bins, loc, scale)*count.max()/\\\n ... logist(bins, loc, scale).max())\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_loc = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oloc;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_floc;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OOO", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_loc);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2088 */
+ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2089 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2090 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2091 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; goto __pyx_L1;}
+ Py_INCREF(__pyx_k118p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k118p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; goto __pyx_L1;}
+ 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 = 2092; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2093 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2095 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2096 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2096; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2096; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oloc));
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2097 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2098 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; goto __pyx_L1;}
+ Py_INCREF(__pyx_k119p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k119p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2100 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2100; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.logistic");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oloc);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_loc);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k120p;
+static PyObject *__pyx_k121p;
+
+static char __pyx_k120[] = "sigma <= 0";
+static char __pyx_k121[] = "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[] = "\n lognormal(mean=0.0, sigma=1.0, size=None)\n\n Return samples drawn from a log-normal distribution.\n\n Draw samples from a log-normal distribution with specified mean, standard\n deviation, and shape. Note that the mean and standard deviation are not the\n values for the distribution itself, but of the underlying normal\n distribution it is derived from.\n\n\n Parameters\n ----------\n mean : float\n Mean value of the underlying normal distribution\n sigma : float, >0.\n Standard deviation of the underlying normal distribution\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.lognorm : probability density function, distribution,\n cumulative density function, etc.\n\n Notes\n -----\n A variable `x` has a log-normal distribution if `log(x)` is normally\n distributed.\n\n The probability density function for the log-normal distribution is\n\n .. math:: p(x) = \\frac{1}{\\sigma x \\sqrt{2\\pi}}\n e^{(-\\frac{(ln(x)-\\mu)^2}{2\\sigma^2})}\n\n where :math:`\\mu` is the mean and :math:`\\sigma` is the standard deviation\n of the normally distributed logarithm of the variable.\n\n A log-normal distribution results if a random variable is the *product* of\n a large number of independent, identically-distributed variables in the\n same way that a normal distribution results if the variable is the *sum*\n of a large number of independent, identically-distributed variables\n (see the last example). It is one of the so-called \"fat-tailed\"\n distributions.\n\n The log-normal distribution is commonly used to model the lifespan of units\n with fatigue-stress failure modes. Since this includes\n most mechanical systems, the log-normal distribution has widespread\n application.\n\n It is also commonly used to model oil field sizes, species abundance, and\n latent periods of infectious diseases.\n\n References\n ----------\n .. [1] Eckhard Limpert, Werner A. Stahel, and Markus Abbt, \"Log-normal\n Distributions across the Sciences: Keys and Clues\", May 2001\n Vol. 51 No. 5 BioScience\n http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf\n .. [2] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 31-32.\n .. [3] Wikipedia, \"Lognormal distribution\",\n http://en.wikipedia.org/wiki/Lognormal_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 3., 1. # mean and standard deviation\n >>> s = np.random.lognormal(mu, sigma, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align=\'center\')\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, linewidth=2, color=\'r\')\n >>> plt.axis(\'tight\')\n >>> plt.show()\n\n Demonstrate that taking the products of random samples from a uniform\n distribution can be fit well by a log-normal probability density function.\n\n >>> # Generate a thousand samples: each is the product of 100 random\n >>> # values, drawn from a normal distribution.\n >>> b = []\n >>> for i in range(1000):\n ... a = 10. + np.random.random(100)\n ... b.append(np.product(a))\n\n >>> b = np.array(b) / np.min(b) # scale values to be positive\n\n >>> count, bins, ignored = plt.hist(b, 100, normed=True, align=\'center\')\n\n >>> sigma = np.std(np.log(b))\n >>> mu = np.mean(np.log(b))\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, color=\'r\', linewidth=2)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_mean = 0;
+ PyObject *__pyx_v_sigma = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_omean;
+ PyArrayObject *__pyx_v_osigma;
+ double __pyx_v_fmean;
+ double __pyx_v_fsigma;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OOO", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_mean);
+ Py_INCREF(__pyx_v_sigma);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_osigma = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2217 */
+ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2218 */
+ __pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2220 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2221 */
+ __pyx_1 = (__pyx_v_fsigma <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; goto __pyx_L1;}
+ Py_INCREF(__pyx_k120p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k120p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; goto __pyx_L1;}
+ 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 = 2222; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2223 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_fmean,__pyx_v_fsigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2225 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2227 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_omean));
+ __pyx_v_omean = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2228 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_sigma,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_osigma));
+ __pyx_v_osigma = ((PyArrayObject *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2229 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_osigma));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_osigma));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; goto __pyx_L1;}
+ Py_INCREF(__pyx_k121p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k121p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2231 */
+ __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_omean,__pyx_v_osigma); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2231; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.lognormal");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_omean);
+ Py_DECREF(__pyx_v_osigma);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_mean);
+ Py_DECREF(__pyx_v_sigma);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k122p;
+static PyObject *__pyx_k123p;
+
+static char __pyx_k122[] = "scale <= 0";
+static char __pyx_k123[] = "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[] = "\n rayleigh(scale=1.0, size=None)\n\n Rayleigh distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OO", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2243 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2245 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2246 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; goto __pyx_L1;}
+ Py_INCREF(__pyx_k122p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k122p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; goto __pyx_L1;}
+ 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 = 2247; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2248 */
+ __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2250 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2252 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2253 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; goto __pyx_L1;}
+ Py_INCREF(__pyx_k123p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k123p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; goto __pyx_L1;}
+ 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 = 2254; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2255 */
+ __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.rayleigh");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k124p;
+static PyObject *__pyx_k125p;
+static PyObject *__pyx_k126p;
+static PyObject *__pyx_k127p;
+
+static char __pyx_k124[] = "mean <= 0";
+static char __pyx_k125[] = "scale <= 0";
+static char __pyx_k126[] = "mean <= 0.0";
+static char __pyx_k127[] = "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[] = "\n wald(mean, scale, size=None)\n\n Wald (inverse Gaussian) distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_mean = 0;
+ PyObject *__pyx_v_scale = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_omean;
+ PyArrayObject *__pyx_v_oscale;
+ double __pyx_v_fmean;
+ double __pyx_v_fscale;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"mean","scale","size",0};
+ __pyx_v_size = __pyx_k48;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_mean);
+ Py_INCREF(__pyx_v_scale);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2267 */
+ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2268 */
+ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2269 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2270 */
+ __pyx_1 = (__pyx_v_fmean <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; goto __pyx_L1;}
+ Py_INCREF(__pyx_k124p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k124p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; goto __pyx_L1;}
+ 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 = 2271; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2272 */
+ __pyx_1 = (__pyx_v_fscale <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; goto __pyx_L1;}
+ Py_INCREF(__pyx_k125p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k125p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; goto __pyx_L1;}
+ 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 = 2273; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2274 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_fmean,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2276 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2277 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_omean));
+ __pyx_v_omean = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2278 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_v_oscale));
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2279 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_omean));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_omean));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; goto __pyx_L1;}
+ Py_INCREF(__pyx_k126p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k126p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; goto __pyx_L1;}
+ Py_INCREF(__pyx_k127p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k127p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; goto __pyx_L1;}
+ 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 = 2282; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2283 */
+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_omean,__pyx_v_oscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.wald");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_omean);
+ Py_DECREF(__pyx_v_oscale);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_mean);
+ Py_DECREF(__pyx_v_scale);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_greater;
+static PyObject *__pyx_n_equal;
+
+static PyObject *__pyx_k128p;
+static PyObject *__pyx_k129p;
+static PyObject *__pyx_k130p;
+static PyObject *__pyx_k131p;
+static PyObject *__pyx_k132p;
+static PyObject *__pyx_k133p;
+
+static char __pyx_k128[] = "left > mode";
+static char __pyx_k129[] = "mode > right";
+static char __pyx_k130[] = "left == right";
+static char __pyx_k131[] = "left > mode";
+static char __pyx_k132[] = "mode > right";
+static char __pyx_k133[] = "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[] = "\n triangular(left, mode, right, size=None)\n\n Triangular distribution starting at left, peaking at mode, and\n ending at right (left <= mode <= right).\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_left = 0;
+ PyObject *__pyx_v_mode = 0;
+ PyObject *__pyx_v_right = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oleft;
+ PyArrayObject *__pyx_v_omode;
+ PyArrayObject *__pyx_v_oright;
+ double __pyx_v_fleft;
+ double __pyx_v_fmode;
+ double __pyx_v_fright;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"left","mode","right","size",0};
+ __pyx_v_size = __pyx_k49;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|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_left);
+ Py_INCREF(__pyx_v_mode);
+ Py_INCREF(__pyx_v_right);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oleft = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_omode = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_oright = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2298 */
+ __pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2299 */
+ __pyx_v_fright = PyFloat_AsDouble(__pyx_v_right);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2300 */
+ __pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2301 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2302 */
+ __pyx_1 = (__pyx_v_fleft > __pyx_v_fmode);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; goto __pyx_L1;}
+ Py_INCREF(__pyx_k128p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k128p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; goto __pyx_L1;}
+ 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 = 2303; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2304 */
+ __pyx_1 = (__pyx_v_fmode > __pyx_v_fright);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;}
+ Py_INCREF(__pyx_k129p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k129p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;}
+ 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 = 2305; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2306 */
+ __pyx_1 = (__pyx_v_fleft == __pyx_v_fright);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;}
+ Py_INCREF(__pyx_k130p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k130p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;}
+ 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 = 2307; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2308 */
+ __pyx_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_fleft,__pyx_v_fmode,__pyx_v_fright); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2311 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2312 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_left,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oleft));
+ __pyx_v_oleft = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2313 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_mode,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_omode));
+ __pyx_v_omode = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2314 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_right,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oright));
+ __pyx_v_oright = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2316 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; 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 = 2316; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oleft));
+ PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_oleft));
+ Py_INCREF(((PyObject *)__pyx_v_omode));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_omode));
+ __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; goto __pyx_L1;}
+ Py_INCREF(__pyx_k131p);
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k131p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_3, 0, 0);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2318 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_omode));
+ PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_omode));
+ Py_INCREF(((PyObject *)__pyx_v_oright));
+ PyTuple_SET_ITEM(__pyx_4, 1, ((PyObject *)__pyx_v_oright));
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_1) {
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; goto __pyx_L1;}
+ Py_INCREF(__pyx_k132p);
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k132p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; goto __pyx_L1;}
+ 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 = 2319; goto __pyx_L1;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2320 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oleft));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oleft));
+ Py_INCREF(((PyObject *)__pyx_v_oright));
+ PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)__pyx_v_oright));
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; goto __pyx_L1;}
+ Py_INCREF(__pyx_k133p);
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k133p);
+ __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_4, 0, 0);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; goto __pyx_L1;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2322 */
+ __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_oleft,__pyx_v_omode,__pyx_v_oright); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.triangular");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oleft);
+ Py_DECREF(__pyx_v_omode);
+ Py_DECREF(__pyx_v_oright);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_left);
+ Py_DECREF(__pyx_v_mode);
+ Py_DECREF(__pyx_v_right);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k134p;
+static PyObject *__pyx_k135p;
+static PyObject *__pyx_k136p;
+static PyObject *__pyx_k137p;
+static PyObject *__pyx_k138p;
+static PyObject *__pyx_k139p;
+
+static char __pyx_k134[] = "n <= 0";
+static char __pyx_k135[] = "p < 0";
+static char __pyx_k136[] = "p > 1";
+static char __pyx_k137[] = "n <= 0";
+static char __pyx_k138[] = "p < 0";
+static char __pyx_k139[] = "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[] = "\n binomial(n, p, size=None)\n\n Draw samples from a binomial distribution.\n\n Samples are drawn from a Binomial distribution with specified\n parameters, n trials and p probability of success where\n n an integer > 0 and p is in the interval [0,1]. (n may be\n input as a float, but it is truncated to an integer in use)\n\n Parameters\n ----------\n n : float (but truncated to an integer)\n parameter, > 0.\n p : float\n parameter, >= 0 and <=1.\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.binom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Binomial distribution is\n\n .. math:: P(N) = \\binom{n}{N}p^N(1-p)^{n-N},\n\n where :math:`n` is the number of trials, :math:`p` is the probability\n of success, and :math:`N` is the number of successes.\n\n When estimating the standard error of a proportion in a population by\n using a random sample, the normal distribution works well unless the\n product p*n <=5, where p = population proportion estimate, and n =\n number of samples, in which case the binomial distribution is used\n instead. For example, a sample of 15 people shows 4 who are left\n handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4,\n so the binomial distribution should be used in this case.\n\n References\n ----------\n .. [1] Dalgaard, Peter, \"Introductory Statistics with R\",\n Springer-Verlag, 2002.\n .. [2] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.\n .. [3] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [4] Weisstein, Eric W. \"Binomial Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/BinomialDistribution.html\n .. [5] Wikipedia, \"Binomial-distribution\",\n http://en.wikipedia.org/wiki/Binomial_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> n, p = 10, .5 # number of trials, probability of each trial\n >>> s = np.random.binomial(n, p, 1000)\n # result of flipping a coin 10 times, tested 1000 times.\n\n A real world example. A company drills 9 wild-cat oil exploration\n wells, each with an estimated probability of success of 0.1. All nine\n wells fail. What is the probability of that happening?\n\n Let\'s do 20,000 trials of the model, and count the number that\n generate zero positive results.\n\n >>> sum(np.random.binomial(9,0.1,20000)==0)/20000.\n answer = 0.38885, or 38%.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_n = 0;
+ PyObject *__pyx_v_p = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_on;
+ PyArrayObject *__pyx_v_op;
+ long __pyx_v_ln;
+ double __pyx_v_fp;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"n","p","size",0};
+ __pyx_v_size = __pyx_k50;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_n);
+ Py_INCREF(__pyx_v_p);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2411 */
+ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2412 */
+ __pyx_v_ln = PyInt_AsLong(__pyx_v_n);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2413 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2414 */
+ __pyx_1 = (__pyx_v_ln <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;}
+ Py_INCREF(__pyx_k134p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k134p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;}
+ 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 = 2415; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2416 */
+ __pyx_1 = (__pyx_v_fp < 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;}
+ Py_INCREF(__pyx_k135p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k135p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;}
+ 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 = 2417; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_1 = (__pyx_v_fp > 1);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;}
+ Py_INCREF(__pyx_k136p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k136p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;}
+ 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 = 2419; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2420 */
+ __pyx_2 = __pyx_f_6mtrand_discnp_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_ln,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2422 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2424 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_on));
+ __pyx_v_on = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2425 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_op));
+ __pyx_v_op = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2426 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; goto __pyx_L1;}
+ Py_INCREF(__pyx_k137p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k137p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2428 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; goto __pyx_L1;}
+ Py_INCREF(__pyx_k138p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k138p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; goto __pyx_L1;}
+ 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 = 2429; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2430 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; goto __pyx_L1;}
+ Py_INCREF(__pyx_k139p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k139p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; goto __pyx_L1;}
+ 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 = 2431; goto __pyx_L1;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2432 */
+ __pyx_5 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2432; goto __pyx_L1;}
+ __pyx_r = __pyx_5;
+ __pyx_5 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.binomial");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_on);
+ Py_DECREF(__pyx_v_op);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_n);
+ Py_DECREF(__pyx_v_p);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k140p;
+static PyObject *__pyx_k141p;
+static PyObject *__pyx_k142p;
+static PyObject *__pyx_k143p;
+static PyObject *__pyx_k144p;
+static PyObject *__pyx_k145p;
+
+static char __pyx_k140[] = "n <= 0";
+static char __pyx_k141[] = "p < 0";
+static char __pyx_k142[] = "p > 1";
+static char __pyx_k143[] = "n <= 0";
+static char __pyx_k144[] = "p < 0";
+static char __pyx_k145[] = "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[] = "\n negative_binomial(n, p, size=None)\n\n Negative Binomial distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_n = 0;
+ PyObject *__pyx_v_p = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_on;
+ PyArrayObject *__pyx_v_op;
+ double __pyx_v_fn;
+ double __pyx_v_fp;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"n","p","size",0};
+ __pyx_v_size = __pyx_k51;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_n);
+ Py_INCREF(__pyx_v_p);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2446 */
+ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2447 */
+ __pyx_v_fn = PyFloat_AsDouble(__pyx_v_n);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2448 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2449 */
+ __pyx_1 = (__pyx_v_fn <= 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; goto __pyx_L1;}
+ Py_INCREF(__pyx_k140p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k140p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; goto __pyx_L1;}
+ 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 = 2450; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2451 */
+ __pyx_1 = (__pyx_v_fp < 0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; goto __pyx_L1;}
+ Py_INCREF(__pyx_k141p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k141p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; goto __pyx_L1;}
+ 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 = 2452; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_1 = (__pyx_v_fp > 1);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; goto __pyx_L1;}
+ Py_INCREF(__pyx_k142p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k142p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; goto __pyx_L1;}
+ 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 = 2454; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2455 */
+ __pyx_2 = __pyx_f_6mtrand_discdd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_fn,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2455; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2458 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2460 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_on));
+ __pyx_v_on = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2461 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2461; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_op));
+ __pyx_v_op = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2462 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; goto __pyx_L1;}
+ Py_INCREF(__pyx_k143p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k143p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2464 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; goto __pyx_L1;}
+ Py_INCREF(__pyx_k144p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k144p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; goto __pyx_L1;}
+ 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 = 2465; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2466 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2467; goto __pyx_L1;}
+ Py_INCREF(__pyx_k145p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k145p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2467; goto __pyx_L1;}
+ 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 = 2467; goto __pyx_L1;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2468 */
+ __pyx_5 = __pyx_f_6mtrand_discdd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; goto __pyx_L1;}
+ __pyx_r = __pyx_5;
+ __pyx_5 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.negative_binomial");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_on);
+ Py_DECREF(__pyx_v_op);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_n);
+ Py_DECREF(__pyx_v_p);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k146p;
+static PyObject *__pyx_k147p;
+
+static char __pyx_k146[] = "lam < 0";
+static char __pyx_k147[] = "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[] = "\n poisson(lam=1.0, size=None)\n\n Poisson distribution.\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_lam = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_olam;
+ double __pyx_v_flam;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 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, "|OO", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_lam);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_olam = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2480 */
+ __pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2481 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2482 */
+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_lam, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; goto __pyx_L1;}
+ __pyx_1 = __pyx_1 < 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; goto __pyx_L1;}
+ Py_INCREF(__pyx_k146p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k146p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; goto __pyx_L1;}
+ 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 = 2483; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2484 */
+ __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_flam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2486 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2488 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_lam,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2488; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_olam));
+ __pyx_v_olam = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2489 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_olam));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_olam));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; goto __pyx_L1;}
+ Py_INCREF(__pyx_k147p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k147p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; goto __pyx_L1;}
+ 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 = 2490; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2491 */
+ __pyx_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_olam); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.poisson");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_olam);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_lam);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k148p;
+static PyObject *__pyx_k149p;
+
+static char __pyx_k148[] = "a <= 1.0";
+static char __pyx_k149[] = "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[] = "\n zipf(a, size=None)\n\n Draw samples from a Zipf distribution.\n\n Samples are drawn from a Zipf distribution with specified parameter (a),\n where a > 1.\n\n The zipf distribution (also known as the zeta\n distribution) is a continuous probability distribution that satisfies\n Zipf\'s law, where the frequency of an item is inversely proportional to\n its rank in a frequency table.\n\n Parameters\n ----------\n a : float\n parameter, > 1.\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n The returned samples are greater than or equal to one.\n\n See Also\n --------\n scipy.stats.distributions.zipf : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Zipf distribution is\n\n .. math:: p(x) = \\frac{x^{-a}}{\\zeta(a)},\n\n where :math:`\\zeta` is the Riemann Zeta function.\n\n Named after the American linguist George Kingsley Zipf, who noted that\n the frequency of any word in a sample of a language is inversely\n proportional to its rank in the frequency table.\n\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Zipf Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/ZipfDistribution.html\n .. [2] Wikipedia, \"Zeta distribution\",\n http://en.wikipedia.org/wiki/Zeta_distribution\n .. [3] Wikipedia, \"Zipf\'s Law\",\n http://en.wikipedia.org/wiki/Zipf%27s_law\n .. [4] Zipf, George Kingsley (1932): Selected Studies of the Principle\n of Relative Frequency in Language. Cambridge (Mass.).\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 2. # parameter\n >>> s = np.random.zipf(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n Truncate s values at 50 so plot is interesting\n >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)\n >>> x = arange(1., 50.)\n >>> y = x**(-a)/sps.zetac(a)\n >>> plt.plot(x, y/max(y), linewidth=2, color=\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_a = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_oa;
+ double __pyx_v_fa;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"a","size",0};
+ __pyx_v_size = __pyx_k54;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_a);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2572 */
+ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2573 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2574 */
+ __pyx_1 = (__pyx_v_fa <= 1.0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; goto __pyx_L1;}
+ Py_INCREF(__pyx_k148p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k148p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; goto __pyx_L1;}
+ 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 = 2575; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2576 */
+ __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2578 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2580 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_oa));
+ __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2581 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2582; goto __pyx_L1;}
+ Py_INCREF(__pyx_k149p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k149p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2582; goto __pyx_L1;}
+ 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 = 2582; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2583 */
+ __pyx_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2583; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.zipf");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_oa);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_a);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k150p;
+static PyObject *__pyx_k151p;
+static PyObject *__pyx_k152p;
+static PyObject *__pyx_k153p;
+
+static char __pyx_k150[] = "p < 0.0";
+static char __pyx_k151[] = "p > 1.0";
+static char __pyx_k152[] = "p < 0.0";
+static char __pyx_k153[] = "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[] = "\n geometric(p, size=None)\n\n Draw samples from the geometric distribution.\n\n Bernoulli trials are experiments with one of two outcomes:\n success or failure (an example of such an experiment is flipping\n a coin). The geometric distribution models the number of trials\n that must be run in order to achieve success. It is therefore\n supported on the positive integers, ``k = 1, 2, ...``.\n\n The probability mass function of the geometric distribution is\n\n .. math:: f(k) = (1 - p)^{k - 1} p\n\n where `p` is the probability of success of an individual trial.\n\n Parameters\n ----------\n p : float\n The probability of success of an individual trial.\n size : tuple of ints\n Number of values to draw from the distribution. The output\n is shaped according to `size`.\n\n Returns\n -------\n out : ndarray\n Samples from the geometric distribution, shaped according to\n `size`.\n\n Examples\n --------\n Draw ten thousand values from the geometric distribution,\n with the probability of an individual success equal to 0.35:\n\n >>> z = np.random.geometric(p=0.35, size=10000)\n\n How many trials succeeded after a single run?\n\n >>> (z == 1).sum() / 10000.\n 0.34889999999999999 #random\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_p = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_op;
+ double __pyx_v_fp;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"p","size",0};
+ __pyx_v_size = __pyx_k55;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_p);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2633 */
+ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2634 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2635 */
+ __pyx_1 = (__pyx_v_fp < 0.0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; goto __pyx_L1;}
+ Py_INCREF(__pyx_k150p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k150p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; goto __pyx_L1;}
+ 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 = 2636; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2637 */
+ __pyx_1 = (__pyx_v_fp > 1.0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; goto __pyx_L1;}
+ Py_INCREF(__pyx_k151p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k151p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; goto __pyx_L1;}
+ 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 = 2638; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2639 */
+ __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2641 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2644 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_op));
+ __pyx_v_op = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2645 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; goto __pyx_L1;}
+ Py_INCREF(__pyx_k152p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k152p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; goto __pyx_L1;}
+ 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 = 2646; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2647 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_op));
+ 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 = 2647; 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 = 2647; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;}
+ Py_INCREF(__pyx_k153p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k153p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;}
+ 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 = 2648; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2649 */
+ __pyx_3 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_op); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; goto __pyx_L1;}
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.geometric");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_op);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_p);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_add;
+
+static PyObject *__pyx_k154p;
+static PyObject *__pyx_k155p;
+static PyObject *__pyx_k156p;
+static PyObject *__pyx_k157p;
+static PyObject *__pyx_k158p;
+static PyObject *__pyx_k159p;
+static PyObject *__pyx_k160p;
+static PyObject *__pyx_k161p;
+
+static char __pyx_k154[] = "ngood < 1";
+static char __pyx_k155[] = "nbad < 1";
+static char __pyx_k156[] = "nsample < 1";
+static char __pyx_k157[] = "ngood + nbad < nsample";
+static char __pyx_k158[] = "ngood < 1";
+static char __pyx_k159[] = "nbad < 1";
+static char __pyx_k160[] = "nsample < 1";
+static char __pyx_k161[] = "ngood + nbad < nsample";
+
+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[] = "\n hypergeometric(ngood, nbad, nsample, size=None)\n\n Draw samples from a Hypergeometric distribution.\n\n Samples are drawn from a Hypergeometric distribution with specified\n parameters, ngood (ways to make a good selection), nbad (ways to make\n a bad selection), and nsample = number of items sampled, which is less\n than or equal to the sum ngood + nbad.\n\n Parameters\n ----------\n ngood : float (but truncated to an integer)\n parameter, > 0.\n nbad : float\n parameter, >= 0.\n nsample : float\n parameter, > 0 and <= ngood+nbad\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.hypergeom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Hypergeometric distribution is\n\n .. math:: P(x) = \\frac{\\binom{m}{n}\\binom{N-m}{n-x}}{\\binom{N}{n}},\n\n where :math:`0 \\le x \\le m` and :math:`n+m-N \\le x \\le n`\n\n for P(x) the probability of x successes, n = ngood, m = nbad, and\n N = number of samples.\n\n Consider an urn with black and white marbles in it, ngood of them\n black and nbad are white. If you draw nsample balls without\n replacement, then the Hypergeometric distribution describes the\n distribution of black balls in the drawn sample.\n\n Note that this distribution is very similar to the Binomial\n distribution, except that in this case, samples are drawn without\n replacement, whereas in the Binomial case samples are drawn with\n replacement (or the sample space is infinite). As the sample space\n becomes large, this distribution approaches the Binomial.\n\n References\n ----------\n .. [1] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [2] Weisstein, Eric W. \"Hypergeometric Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/HypergeometricDistribution.html\n .. [3] Wikipedia, \"Hypergeometric-distribution\",\n http://en.wikipedia.org/wiki/Hypergeometric-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> ngood, nbad, nsamp = 100, 2, 10\n # number of good, number of bad, and number of samples\n >>> s = np.random.hypergeometric(ngood, nbad, nsamp, 1000)\n >>> hist(s)\n # note that it is very unlikely to grab both bad items\n\n Suppose you have an urn with 15 white and 15 black marbles.\n If you pull 15 marbles at random, how likely is it that\n 12 or more of them are one color?\n\n >>> s = np.random.hypergeometric(15, 15, 15, 100000)\n >>> sum(s>=12)/100000. + sum(s<=3)/100000.\n # answer = 0.003 ... pretty unlikely!\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_ngood = 0;
+ PyObject *__pyx_v_nbad = 0;
+ PyObject *__pyx_v_nsample = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_ongood;
+ PyArrayObject *__pyx_v_onbad;
+ PyArrayObject *__pyx_v_onsample;
+ long __pyx_v_lngood;
+ long __pyx_v_lnbad;
+ long __pyx_v_lnsample;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ static char *__pyx_argnames[] = {"ngood","nbad","nsample","size",0};
+ __pyx_v_size = __pyx_k56;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|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_ngood);
+ Py_INCREF(__pyx_v_nbad);
+ Py_INCREF(__pyx_v_nsample);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_ongood = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_onbad = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_onsample = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2738 */
+ __pyx_v_lngood = PyInt_AsLong(__pyx_v_ngood);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2739 */
+ __pyx_v_lnbad = PyInt_AsLong(__pyx_v_nbad);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2740 */
+ __pyx_v_lnsample = PyInt_AsLong(__pyx_v_nsample);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2741 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2742 */
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_ngood, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; goto __pyx_L1;}
+ __pyx_1 = __pyx_1 < 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; goto __pyx_L1;}
+ Py_INCREF(__pyx_k154p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k154p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; goto __pyx_L1;}
+ 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 = 2743; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2744 */
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_nbad, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; goto __pyx_L1;}
+ __pyx_1 = __pyx_1 < 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; goto __pyx_L1;}
+ Py_INCREF(__pyx_k155p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k155p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2746 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_nsample, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; goto __pyx_L1;}
+ __pyx_1 = __pyx_1 < 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;}
+ Py_INCREF(__pyx_k156p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k156p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;}
+ 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 = 2747; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2748 */
+ __pyx_2 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_2, __pyx_v_nsample, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;}
+ __pyx_1 = __pyx_1 < 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; goto __pyx_L1;}
+ Py_INCREF(__pyx_k157p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k157p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2750 */
+ __pyx_3 = __pyx_f_6mtrand_discnmN_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_lngood,__pyx_v_lnbad,__pyx_v_lnsample); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; goto __pyx_L1;}
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2754 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2756 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_ngood,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2756; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_ongood));
+ __pyx_v_ongood = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2757 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_nbad,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_onbad));
+ __pyx_v_onbad = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2758 */
+ __pyx_2 = PyArray_FROM_OTF(__pyx_v_nsample,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2758; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_onsample));
+ __pyx_v_onsample = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2759 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ongood));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ongood));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; goto __pyx_L1;}
+ Py_INCREF(__pyx_k158p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k158p);
+ __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; goto __pyx_L1;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2761 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_onbad));
+ PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_onbad));
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; goto __pyx_L1;}
+ Py_INCREF(__pyx_k159p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k159p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; goto __pyx_L1;}
+ 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 = 2762; goto __pyx_L1;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2763 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_onsample));
+ PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_onsample));
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; goto __pyx_L1;}
+ Py_INCREF(__pyx_k160p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k160p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; goto __pyx_L1;}
+ 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 = 2764; goto __pyx_L1;}
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2765 */
+ __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_add); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_ongood));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ongood));
+ Py_INCREF(((PyObject *)__pyx_v_onbad));
+ PyTuple_SET_ITEM(__pyx_5, 1, ((PyObject *)__pyx_v_onbad));
+ __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
+ Py_INCREF(((PyObject *)__pyx_v_onsample));
+ PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onsample));
+ __pyx_6 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_6, 0, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; goto __pyx_L1;}
+ Py_INCREF(__pyx_k161p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k161p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __Pyx_Raise(__pyx_5, 0, 0);
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; goto __pyx_L1;}
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2767 */
+ __pyx_4 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ongood,__pyx_v_onbad,__pyx_v_onsample); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; goto __pyx_L1;}
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ __Pyx_AddTraceback("mtrand.RandomState.hypergeometric");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_ongood);
+ Py_DECREF(__pyx_v_onbad);
+ Py_DECREF(__pyx_v_onsample);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_ngood);
+ Py_DECREF(__pyx_v_nbad);
+ Py_DECREF(__pyx_v_nsample);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_greater_equal;
+
+static PyObject *__pyx_k162p;
+static PyObject *__pyx_k163p;
+static PyObject *__pyx_k164p;
+static PyObject *__pyx_k165p;
+
+static char __pyx_k162[] = "p <= 0.0";
+static char __pyx_k163[] = "p >= 1.0";
+static char __pyx_k164[] = "p <= 0.0";
+static char __pyx_k165[] = "p >= 1.0";
+
+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[] = "\n logseries(p, size=None)\n\n Draw samples from a Logarithmic Series distribution.\n\n Samples are drawn from a Log Series distribution with specified\n parameter, p (probability, 0 < p < 1).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logser : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Log Series distribution is\n\n .. math:: P(k) = \\frac{-p^k}{k \\ln(1-p)},\n\n where p = probability.\n\n The Log Series distribution is frequently used to represent species\n richness and occurrence, first proposed by Fisher, Corbet, and\n Williams in 1943 [2]. It may also be used to model the numbers of\n occupants seen in cars [3].\n\n References\n ----------\n .. [1] Buzas, Martin A.; Culver, Stephen J., Understanding regional\n species diversity through the log series distribution of\n occurrences: BIODIVERSITY RESEARCH Diversity & Distributions,\n Volume 5, Number 5, September 1999 , pp. 187-195(9).\n .. [2] Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. The\n relation between the number of species and the number of\n individuals in a random sample of an animal population.\n Journal of Animal Ecology, 12:42-58.\n .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small\n Data Sets, CRC Press, 1994.\n .. [4] Wikipedia, \"Logarithmic-distribution\",\n http://en.wikipedia.org/wiki/Logarithmic-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = .6\n >>> s = np.random.logseries(a, 10000)\n >>> count, bins, ignored = plt.hist(s)\n\n # plot against distribution\n\n >>> def logseries(k, p):\n ... return -p**k/(k*log(1-p))\n >>> plt.plot(bins, logseries(bins, a)*count.max()/\\\n logseries(bins, a).max(),\'r\')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_p = 0;
+ PyObject *__pyx_v_size = 0;
+ PyArrayObject *__pyx_v_op;
+ double __pyx_v_fp;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"p","size",0};
+ __pyx_v_size = __pyx_k57;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_p);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2847 */
+ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2848 */
+ __pyx_1 = (!PyErr_Occurred());
+ if (__pyx_1) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2849 */
+ __pyx_1 = (__pyx_v_fp <= 0.0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;}
+ Py_INCREF(__pyx_k162p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k162p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;}
+ 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 = 2850; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2851 */
+ __pyx_1 = (__pyx_v_fp >= 1.0);
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;}
+ Py_INCREF(__pyx_k163p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k163p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;}
+ 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 = 2852; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2853 */
+ __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; goto __pyx_L1;}
+ __pyx_r = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L0;
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2855 */
+ PyErr_Clear();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2857 */
+ __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)__pyx_v_op));
+ __pyx_v_op = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2858 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ if (__pyx_1) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;}
+ Py_INCREF(__pyx_k164p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k164p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;}
+ 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 = 2859; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2860 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)__pyx_v_op));
+ PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_op));
+ 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 = 2860; 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 = 2860; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+ __pyx_4 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_1) {
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;}
+ Py_INCREF(__pyx_k165p);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k165p);
+ __pyx_5 = PyObject_CallObject(PyExc_ValueError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;}
+ 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 = 2861; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2862 */
+ __pyx_3 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_op); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; goto __pyx_L1;}
+ __pyx_r = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.logseries");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_op);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_p);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_array;
+static PyObject *__pyx_n_shape;
+static PyObject *__pyx_n_append;
+static PyObject *__pyx_n_multiply;
+static PyObject *__pyx_n_reduce;
+static PyObject *__pyx_n_svd;
+static PyObject *__pyx_n_dot;
+static PyObject *__pyx_n_sqrt;
+
+static PyObject *__pyx_k166p;
+static PyObject *__pyx_k167p;
+static PyObject *__pyx_k168p;
+static PyObject *__pyx_k169p;
+
+static char __pyx_k166[] = "mean must be 1 dimensional";
+static char __pyx_k167[] = "cov must be 2 dimensional and square";
+static char __pyx_k168[] = "mean and cov must have same length";
+static char __pyx_k169[] = "numpy.dual";
+
+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[] = "\n multivariate_normal(mean, cov[, size])\n\n Draw random samples from a multivariate normal distribution.\n\n The multivariate normal, multinormal or Gaussian distribution is a\n generalisation of the one-dimensional normal distribution to higher\n dimensions.\n\n Such a distribution is specified by its mean and covariance matrix,\n which are analogous to the mean (average or \"centre\") and variance\n (standard deviation squared or \"width\") of the one-dimensional normal\n distribution.\n\n Parameters\n ----------\n mean : (N,) ndarray\n Mean of the N-dimensional distribution.\n cov : (N,N) ndarray\n Covariance matrix of the distribution.\n size : tuple of ints, optional\n Given a shape of, for example, (m,n,k), m*n*k samples are\n generated, and packed in an m-by-n-by-k arrangement. Because each\n sample is N-dimensional, the output shape is (m,n,k,N). If no\n shape is specified, a single sample is returned.\n\n Returns\n -------\n out : ndarray\n The drawn samples, arranged according to `size`. If the\n shape given is (m,n,...), then the shape of `out` is is\n (m,n,...,N).\n\n In other words, each entry ``out[i,j,...,:]`` is an N-dimensional\n value drawn from the distribution.\n\n Notes\n -----\n The mean is a coordinate in N-dimensional space, which represents the\n location where samples are most likely to be generated. This is\n analogous to the peak of the bell curve for the one-dimensional or\n univariate normal distribution.\n\n Covariance indicates the level to which two variables vary together.\n From the multivariate normal distribution, we draw N-dimensional\n samples, :math:`X = [x_1, x_2, ... x_N]`. The covariance matrix\n element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`.\n The element :math:`C_{ii}` is the variance of :math:`x_i` (i.e. its\n \"spread\").\n\n Instead of specifying the full covariance matrix, popular\n approximations include:\n\n - Spherical covariance (`cov` is a multiple of the identity matrix)\n - Diagonal covariance (`cov` has non-negative elements, and only on\n the diagonal)\n\n This geometrical property can be seen in two dimensions by plotting\n generated data-points:\n\n >>> mean = [0,0]\n >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis\n\n >>> import matplotlib.pyplot as plt\n >>> x,y = np.random.multivariate_normal(mean,cov,5000).T\n >>> plt.plot(x,y,\'x\'); plt.axis(\'equal\'); plt.show()\n\n Note that the covariance matrix must be non-negative definite.\n\n References\n ----------\n .. [1] A. Papoulis, \"Probability, Random Variables, and Stochastic\n Processes,\" 3rd ed., McGraw-Hill Companies, 1991\n .. [2] R.O. Duda, P.E. Hart, and D.G. Stork, \"Pattern Classification,\"\n 2nd ed., Wiley, 2001.\n\n Examples\n --------\n >>> mean = (1,2)\n >>> cov = [[1,0],[1,0]]\n >>> x = np.random.multivariate_normal(mean,cov,(3,3))\n >>> x.shape\n (3, 3, 2)\n\n The following is probably true, given that 0.6 is roughly twice the\n standard deviation:\n\n >>> print list( (x[0,0,:] - mean) < 0.6 )\n [True, True]\n\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;
+ Py_ssize_t __pyx_5;
+ PyObject *__pyx_6 = 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(Py_None);
+ __pyx_v_final_shape = Py_None; Py_INCREF(Py_None);
+ __pyx_v_x = Py_None; Py_INCREF(Py_None);
+ __pyx_v_svd = Py_None; Py_INCREF(Py_None);
+ __pyx_v_u = Py_None; Py_INCREF(Py_None);
+ __pyx_v_s = Py_None; Py_INCREF(Py_None);
+ __pyx_v_v = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2958 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; 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 = 2958; 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 = 2958; 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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2959 */
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2959; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2959; 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 = 2959; 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 = 2959; 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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2960 */
+ __pyx_4 = __pyx_v_size == Py_None;
+ if (__pyx_4) {
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+ Py_INCREF(__pyx_v_size);
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_v_size;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2964 */
+ __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; goto __pyx_L1;}
+ __pyx_5 = PyObject_Length(__pyx_3); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = (__pyx_5 != 1);
+ if (__pyx_4) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; goto __pyx_L1;}
+ Py_INCREF(__pyx_k166p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k166p);
+ __pyx_1 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; goto __pyx_L1;}
+ 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 = 2965; goto __pyx_L1;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2966 */
+ __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ __pyx_5 = PyObject_Length(__pyx_3); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_4 = (__pyx_5 != 2);
+ if (!__pyx_4) {
+ __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ __pyx_1 = PySequence_GetItem(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ 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 = 2966; goto __pyx_L1;}
+ __pyx_2 = PySequence_GetItem(__pyx_3, 1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; goto __pyx_L1;}
+ __pyx_4 = __pyx_4 != 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ }
+ if (__pyx_4) {
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; goto __pyx_L1;}
+ Py_INCREF(__pyx_k167p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k167p);
+ __pyx_1 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; goto __pyx_L1;}
+ 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 = 2967; goto __pyx_L1;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2968 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; goto __pyx_L1;}
+ __pyx_3 = PySequence_GetItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; goto __pyx_L1;}
+ __pyx_2 = PySequence_GetItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (PyObject_Cmp(__pyx_3, __pyx_2, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; goto __pyx_L1;}
+ __pyx_4 = __pyx_4 != 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_4) {
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2969; goto __pyx_L1;}
+ Py_INCREF(__pyx_k168p);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k168p);
+ __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2969; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __Pyx_Raise(__pyx_3, 0, 0);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2969; goto __pyx_L1;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2971 */
+ __pyx_4 = PyObject_IsInstance(__pyx_v_shape,((PyObject *)(&PyInt_Type))); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2971; goto __pyx_L1;}
+ if (__pyx_4) {
+ __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2972; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_shape);
+ PyList_SET_ITEM(__pyx_2, 0, __pyx_v_shape);
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_2;
+ __pyx_2 = 0;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2973 */
+ __pyx_1 = PySequence_GetSlice(__pyx_v_shape, 0, PY_SSIZE_T_MAX); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2973; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2973; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
+ __pyx_1 = 0;
+ __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2973; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_final_shape);
+ __pyx_v_final_shape = __pyx_2;
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2974 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; goto __pyx_L1;}
+ __pyx_2 = PySequence_GetItem(__pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; 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 = 2974; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2978 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_reduce); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_final_shape);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_final_shape);
+ __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; 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 = 2978; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_6);
+ __pyx_6 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_x);
+ __pyx_v_x = __pyx_2;
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2979 */
+ __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_6, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_5 = PyObject_Length(__pyx_v_final_shape); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ __pyx_2 = PySequence_GetSlice(__pyx_v_final_shape, 0, (__pyx_5 - 1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; goto __pyx_L1;}
+ __pyx_3 = PySequence_GetItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_6, 0, __pyx_1);
+ PyTuple_SET_ITEM(__pyx_6, 1, __pyx_3);
+ __pyx_1 = 0;
+ __pyx_3 = 0;
+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2988 */
+ __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; goto __pyx_L1;}
+ Py_INCREF(__pyx_n_svd);
+ PyList_SET_ITEM(__pyx_2, 0, __pyx_n_svd);
+ __pyx_1 = __Pyx_Import(__pyx_k169p, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_svd); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_svd);
+ __pyx_v_svd = __pyx_3;
+ __pyx_3 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2990 */
+ __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_cov);
+ PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_cov);
+ __pyx_2 = PyObject_CallObject(__pyx_v_svd, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ __pyx_1 = PyObject_GetIter(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_3 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_u);
+ __pyx_v_u = __pyx_3;
+ __pyx_3 = 0;
+ __pyx_6 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_s);
+ __pyx_v_s = __pyx_6;
+ __pyx_6 = 0;
+ __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_v);
+ __pyx_v_v = __pyx_2;
+ __pyx_2 = 0;
+ if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2991 */
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_n_dot); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_sqrt); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; 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 = 2991; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);
+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyNumber_Multiply(__pyx_v_x, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
+ Py_INCREF(__pyx_v_v);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);
+ __pyx_1 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_6, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_x);
+ __pyx_v_x = __pyx_2;
+ __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2994 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; goto __pyx_L1;}
+ __pyx_6 = PyObject_GetAttr(__pyx_1, __pyx_n_add); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; 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_2 = PyObject_CallObject(__pyx_6, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2995 */
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_final_shape);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_final_shape);
+ __pyx_6 = PyObject_CallObject(((PyObject *)(&PyTuple_Type)), __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; goto __pyx_L1;}
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2996 */
+ Py_INCREF(__pyx_v_x);
+ __pyx_r = __pyx_v_x;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_6);
+ __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_k171p;
+
+static char __pyx_k171[] = "sum(pvals[:-1]) > 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[] = "\n multinomial(n, pvals, size=None)\n\n Draw samples from a multinomial distribution.\n\n The multinomial distribution is a multivariate generalisation of the\n binomial distribution. Take an experiment with one of ``p``\n possible outcomes. An example of such an experiment is throwing a dice,\n where the outcome can be 1 through 6. Each sample drawn from the\n distribution represents `n` such experiments. Its values,\n ``X_i = [X_0, X_1, ..., X_p]``, represent the number of times the outcome\n was ``i``.\n\n Parameters\n ----------\n n : int\n Number of experiments.\n pvals : sequence of floats, length p\n Probabilities of each of the ``p`` different outcomes. These\n should sum to 1 (however, the last element is always assumed to\n account for the remaining probability, as long as\n ``sum(pvals[:-1]) <= 1)``.\n size : tuple of ints\n Given a `size` of ``(M, N, K)``, then ``M*N*K`` samples are drawn,\n and the output shape becomes ``(M, N, K, p)``, since each sample\n has shape ``(p,)``.\n\n Examples\n --------\n Throw a dice 20 times:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=1)\n array([[4, 1, 7, 5, 2, 1]])\n\n It landed 4 times on 1, once on 2, etc.\n\n Now, throw the dice 20 times, and 20 times again:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=2)\n array([[3, 4, 3, 3, 4, 3],\n [2, 4, 3, 4, 0, 7]])\n\n For the first run, we threw 3 times 1, 4 times 2, etc. For the second,\n we threw 2 times 1, 4 times 2, etc.\n\n A loaded dice is more likely to land on number 6:\n\n >>> np.random.multinomial(100, [1/7.]*5)\n array([13, 16, 13, 16, 42])\n\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;
+ Py_ssize_t __pyx_1;
+ PyObject *__pyx_2 = 0;
+ int __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ long __pyx_6;
+ 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 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ arrayObject_mnarr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_shape = Py_None; Py_INCREF(Py_None);
+ __pyx_v_multin = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3057 */
+ __pyx_1 = PyObject_Length(__pyx_v_pvals); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; goto __pyx_L1;}
+ __pyx_v_d = __pyx_1;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3058 */
+ __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_pvals,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3058; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)arrayObject_parr));
+ arrayObject_parr = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3059 */
+ __pyx_v_pix = ((double *)arrayObject_parr->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3061 */
+ __pyx_3 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > (1.0 + 1e-12));
+ if (__pyx_3) {
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; goto __pyx_L1;}
+ Py_INCREF(__pyx_k171p);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k171p);
+ __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; goto __pyx_L1;}
+ 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 = 3062; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3064 */
+ __pyx_3 = __pyx_v_size == Py_None;
+ if (__pyx_3) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ __pyx_4 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_3 = __pyx_4 == ((PyObject *)(&PyInt_Type));
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_3) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
+ __pyx_2 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+ __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyNumber_Add(__pyx_v_size, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_2;
+ __pyx_2 = 0;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3071 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_shape);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_shape);
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_4, 1, ((PyObject *)(&PyInt_Type)));
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_multin);
+ __pyx_v_multin = __pyx_5;
+ __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3072 */
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_multin)));
+ Py_DECREF(((PyObject *)arrayObject_mnarr));
+ arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3073 */
+ __pyx_v_mnix = ((long *)arrayObject_mnarr->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3074 */
+ __pyx_v_i = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3075 */
+ while (1) {
+ __pyx_3 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr));
+ if (!__pyx_3) break;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3076 */
+ __pyx_v_Sum = 1.0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3077 */
+ __pyx_v_dn = __pyx_v_n;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3078 */
+ __pyx_6 = (__pyx_v_d - 1);
+ for (__pyx_v_j = 0; __pyx_v_j < __pyx_6; ++__pyx_v_j) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3079 */
+ (__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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3080 */
+ __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3081 */
+ __pyx_3 = (__pyx_v_dn <= 0);
+ if (__pyx_3) {
+ goto __pyx_L7;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3083 */
+ __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));
+ }
+ __pyx_L7:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3084 */
+ __pyx_3 = (__pyx_v_dn > 0);
+ if (__pyx_3) {
+ (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3087 */
+ __pyx_v_i = (__pyx_v_i + __pyx_v_d);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3089 */
+ Py_INCREF(__pyx_v_multin);
+ __pyx_r = __pyx_v_multin;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __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_dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_dirichlet[] = "\n dirichlet(alpha, size=None)\n\n Draw samples from the Dirichlet distribution.\n\n Draw `size` samples of dimension k from a Dirichlet distribution. A\n Dirichlet-distributed random variable can be seen as a multivariate\n generalization of a Beta distribution. Dirichlet pdf is the conjugate\n prior of a multinomial in Bayesian inference.\n\n Parameters\n ----------\n alpha : array\n Parameter of the distribution (k dimension for sample of\n dimension k).\n size : array\n Number of samples to draw.\n\n Notes\n -----\n .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}\n\n Uses the following property for computation: for each dimension,\n draw a random sample y_i from a standard gamma generator of shape\n `alpha_i`, then\n :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is\n Dirichlet distributed.\n\n References\n ----------\n .. [1] David McKay, \"Information Theory, Inference and Learning\n Algorithms,\" chapter 23,\n http://www.inference.phy.cam.ac.uk/mackay/\n\n ";
+static PyObject *__pyx_f_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_alpha = 0;
+ PyObject *__pyx_v_size = 0;
+ long __pyx_v_k;
+ long __pyx_v_totsize;
+ PyArrayObject *__pyx_v_alpha_arr;
+ PyArrayObject *__pyx_v_val_arr;
+ double *__pyx_v_alpha_data;
+ double *__pyx_v_val_data;
+ long __pyx_v_i;
+ long __pyx_v_j;
+ double __pyx_v_acc;
+ double __pyx_v_invacc;
+ PyObject *__pyx_v_shape;
+ PyObject *__pyx_v_diric;
+ PyObject *__pyx_r;
+ Py_ssize_t __pyx_1;
+ PyObject *__pyx_2 = 0;
+ int __pyx_3;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ static char *__pyx_argnames[] = {"alpha","size",0};
+ __pyx_v_size = __pyx_k60;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_alpha, &__pyx_v_size)) return 0;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_alpha);
+ Py_INCREF(__pyx_v_size);
+ __pyx_v_alpha_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_val_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+ __pyx_v_shape = Py_None; Py_INCREF(Py_None);
+ __pyx_v_diric = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3155 */
+ __pyx_1 = PyObject_Length(__pyx_v_alpha); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3155; goto __pyx_L1;}
+ __pyx_v_k = __pyx_1;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3156 */
+ __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_alpha,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)__pyx_v_alpha_arr));
+ __pyx_v_alpha_arr = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3157 */
+ __pyx_v_alpha_data = ((double *)__pyx_v_alpha_arr->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3159 */
+ __pyx_3 = __pyx_v_size == Py_None;
+ if (__pyx_3) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L2;
+ }
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+ __pyx_4 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_3 = __pyx_4 == ((PyObject *)(&PyInt_Type));
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_3) {
+ __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
+ __pyx_2 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+ __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_2 = PyNumber_Add(__pyx_v_size, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_shape);
+ __pyx_v_shape = __pyx_2;
+ __pyx_2 = 0;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3166 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_shape);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_shape);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5);
+ __pyx_5 = 0;
+ __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_diric);
+ __pyx_v_diric = __pyx_5;
+ __pyx_5 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3167 */
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_diric)));
+ Py_DECREF(((PyObject *)__pyx_v_val_arr));
+ __pyx_v_val_arr = ((PyArrayObject *)__pyx_v_diric);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3168 */
+ __pyx_v_val_data = ((double *)__pyx_v_val_arr->data);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3170 */
+ __pyx_v_i = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3171 */
+ __pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3172 */
+ while (1) {
+ __pyx_3 = (__pyx_v_i < __pyx_v_totsize);
+ if (!__pyx_3) break;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3173 */
+ __pyx_v_acc = 0.0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3174 */
+ for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_k; ++__pyx_v_j) {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3175 */
+ (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = rk_standard_gamma(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,(__pyx_v_alpha_data[__pyx_v_j]));
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3176 */
+ __pyx_v_acc = (__pyx_v_acc + (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]));
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3177 */
+ __pyx_v_invacc = (1 / __pyx_v_acc);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3178 */
+ for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_k; ++__pyx_v_j) {
+ (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = ((__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) * __pyx_v_invacc);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3180 */
+ __pyx_v_i = (__pyx_v_i + __pyx_v_k);
+ }
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3182 */
+ Py_INCREF(__pyx_v_diric);
+ __pyx_r = __pyx_v_diric;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("mtrand.RandomState.dirichlet");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_alpha_arr);
+ Py_DECREF(__pyx_v_val_arr);
+ Py_DECREF(__pyx_v_shape);
+ Py_DECREF(__pyx_v_diric);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_alpha);
+ Py_DECREF(__pyx_v_size);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_copy;
+
+
+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[] = "\n shuffle(x)\n\n Modify a sequence in-place by shuffling its contents.\n\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;
+ int __pyx_v_copy;
+ PyObject *__pyx_r;
+ Py_ssize_t __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ 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/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3195 */
+ __pyx_1 = PyObject_Length(__pyx_v_x); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; goto __pyx_L1;}
+ __pyx_v_i = (__pyx_1 - 1);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3196 */
+ /*try:*/ {
+ __pyx_2 = PySequence_GetItem(__pyx_v_x, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; goto __pyx_L2;}
+ __pyx_1 = PyObject_Length(__pyx_2); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; goto __pyx_L2;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_v_j = __pyx_1;
+ }
+ goto __pyx_L3;
+ __pyx_L2:;
+ Py_XDECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3198 */
+ /*except:*/ {
+ __Pyx_AddTraceback("mtrand.shuffle");
+ if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; goto __pyx_L1;}
+ __pyx_v_j = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3201 */
+ __pyx_5 = (__pyx_v_j == 0);
+ if (__pyx_5) {
+ while (1) {
+ __pyx_5 = (__pyx_v_i > 0);
+ if (!__pyx_5) break;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3204 */
+ __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3205 */
+ __pyx_2 = PySequence_GetItem(__pyx_v_x, __pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; goto __pyx_L1;}
+ __pyx_3 = PySequence_GetItem(__pyx_v_x, __pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; goto __pyx_L1;}
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_i, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_j, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3206 */
+ __pyx_v_i = (__pyx_v_i - 1);
+ }
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3209 */
+ __pyx_4 = PySequence_GetItem(__pyx_v_x, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3209; goto __pyx_L1;}
+ __pyx_5 = PyObject_HasAttr(__pyx_4,__pyx_n_copy); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3209; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_v_copy = __pyx_5;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3210 */
+ __pyx_5 = __pyx_v_copy;
+ if (__pyx_5) {
+ while (1) {
+ __pyx_5 = (__pyx_v_i > 0);
+ if (!__pyx_5) break;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3212 */
+ __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3213 */
+ __pyx_2 = PySequence_GetItem(__pyx_v_x, __pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PySequence_GetItem(__pyx_v_x, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_i, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_j, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3214 */
+ __pyx_v_i = (__pyx_v_i - 1);
+ }
+ goto __pyx_L7;
+ }
+ /*else*/ {
+ while (1) {
+ __pyx_5 = (__pyx_v_i > 0);
+ if (!__pyx_5) break;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3217 */
+ __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3218 */
+ __pyx_3 = PySequence_GetItem(__pyx_v_x, __pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ __pyx_4 = PySequence_GetSlice(__pyx_3, 0, PY_SSIZE_T_MAX); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_2 = PySequence_GetItem(__pyx_v_x, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ __pyx_3 = PySequence_GetSlice(__pyx_2, 0, PY_SSIZE_T_MAX); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_i, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (PySequence_SetItem(__pyx_v_x, __pyx_v_j, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3219 */
+ __pyx_v_i = (__pyx_v_i - 1);
+ }
+ }
+ __pyx_L7:;
+ }
+ __pyx_L4:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __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[] = "\n permutation(x)\n\n Randomly permute a sequence, or return a permuted range.\n\n Parameters\n ----------\n x : int or array_like\n If `x` is an integer, randomly permute ``np.arange(x)``.\n If `x` is an array, make a copy and shuffle the elements\n randomly.\n\n Returns\n -------\n out : ndarray\n Permuted sequence or array range.\n\n Examples\n --------\n >>> np.random.permutation(10)\n array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6])\n\n >>> np.random.permutation([1, 4, 9, 12, 15])\n array([15, 1, 9, 4, 12])\n\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;
+ int __pyx_3;
+ PyObject *__pyx_4 = 0;
+ 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(Py_None);
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3248 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_integer); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)(&PyInt_Type)));
+ PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_3 = PyObject_IsInstance(__pyx_v_x,__pyx_1); if (__pyx_3 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (__pyx_3) {
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; 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_4;
+ __pyx_4 = 0;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3251; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3251; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3251; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_x);
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3251; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_arr);
+ __pyx_v_arr = __pyx_1;
+ __pyx_1 = 0;
+ }
+ __pyx_L2:;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3252 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_arr);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_arr);
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3253 */
+ Py_INCREF(__pyx_v_arr);
+ __pyx_r = __pyx_v_arr;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __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_MT19937, "MT19937"},
+ {&__pyx_n___RandomState_ctor, "__RandomState_ctor"},
+ {&__pyx_n__rand, "_rand"},
+ {&__pyx_n_add, "add"},
+ {&__pyx_n_any, "any"},
+ {&__pyx_n_append, "append"},
+ {&__pyx_n_arange, "arange"},
+ {&__pyx_n_array, "array"},
+ {&__pyx_n_asarray, "asarray"},
+ {&__pyx_n_beta, "beta"},
+ {&__pyx_n_binomial, "binomial"},
+ {&__pyx_n_bytes, "bytes"},
+ {&__pyx_n_chisquare, "chisquare"},
+ {&__pyx_n_copy, "copy"},
+ {&__pyx_n_dirichlet, "dirichlet"},
+ {&__pyx_n_dot, "dot"},
+ {&__pyx_n_empty, "empty"},
+ {&__pyx_n_equal, "equal"},
+ {&__pyx_n_exponential, "exponential"},
+ {&__pyx_n_f, "f"},
+ {&__pyx_n_float64, "float64"},
+ {&__pyx_n_gamma, "gamma"},
+ {&__pyx_n_geometric, "geometric"},
+ {&__pyx_n_get_state, "get_state"},
+ {&__pyx_n_greater, "greater"},
+ {&__pyx_n_greater_equal, "greater_equal"},
+ {&__pyx_n_gumbel, "gumbel"},
+ {&__pyx_n_hypergeometric, "hypergeometric"},
+ {&__pyx_n_integer, "integer"},
+ {&__pyx_n_laplace, "laplace"},
+ {&__pyx_n_less, "less"},
+ {&__pyx_n_less_equal, "less_equal"},
+ {&__pyx_n_logistic, "logistic"},
+ {&__pyx_n_lognormal, "lognormal"},
+ {&__pyx_n_logseries, "logseries"},
+ {&__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_np, "np"},
+ {&__pyx_n_numpy, "numpy"},
+ {&__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_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_subtract, "subtract"},
+ {&__pyx_n_svd, "svd"},
+ {&__pyx_n_triangular, "triangular"},
+ {&__pyx_n_uint, "uint"},
+ {&__pyx_n_uint32, "uint32"},
+ {&__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_k61p, __pyx_k61, sizeof(__pyx_k61)},
+ {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},
+ {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},
+ {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},
+ {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},
+ {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},
+ {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},
+ {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},
+ {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},
+ {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)},
+ {&__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_k116p, __pyx_k116, sizeof(__pyx_k116)},
+ {&__pyx_k117p, __pyx_k117, sizeof(__pyx_k117)},
+ {&__pyx_k118p, __pyx_k118, sizeof(__pyx_k118)},
+ {&__pyx_k119p, __pyx_k119, sizeof(__pyx_k119)},
+ {&__pyx_k120p, __pyx_k120, sizeof(__pyx_k120)},
+ {&__pyx_k121p, __pyx_k121, sizeof(__pyx_k121)},
+ {&__pyx_k122p, __pyx_k122, sizeof(__pyx_k122)},
+ {&__pyx_k123p, __pyx_k123, sizeof(__pyx_k123)},
+ {&__pyx_k124p, __pyx_k124, sizeof(__pyx_k124)},
+ {&__pyx_k125p, __pyx_k125, sizeof(__pyx_k125)},
+ {&__pyx_k126p, __pyx_k126, sizeof(__pyx_k126)},
+ {&__pyx_k127p, __pyx_k127, sizeof(__pyx_k127)},
+ {&__pyx_k128p, __pyx_k128, sizeof(__pyx_k128)},
+ {&__pyx_k129p, __pyx_k129, sizeof(__pyx_k129)},
+ {&__pyx_k130p, __pyx_k130, sizeof(__pyx_k130)},
+ {&__pyx_k131p, __pyx_k131, sizeof(__pyx_k131)},
+ {&__pyx_k132p, __pyx_k132, sizeof(__pyx_k132)},
+ {&__pyx_k133p, __pyx_k133, sizeof(__pyx_k133)},
+ {&__pyx_k134p, __pyx_k134, sizeof(__pyx_k134)},
+ {&__pyx_k135p, __pyx_k135, sizeof(__pyx_k135)},
+ {&__pyx_k136p, __pyx_k136, sizeof(__pyx_k136)},
+ {&__pyx_k137p, __pyx_k137, sizeof(__pyx_k137)},
+ {&__pyx_k138p, __pyx_k138, sizeof(__pyx_k138)},
+ {&__pyx_k139p, __pyx_k139, sizeof(__pyx_k139)},
+ {&__pyx_k140p, __pyx_k140, sizeof(__pyx_k140)},
+ {&__pyx_k141p, __pyx_k141, sizeof(__pyx_k141)},
+ {&__pyx_k142p, __pyx_k142, sizeof(__pyx_k142)},
+ {&__pyx_k143p, __pyx_k143, sizeof(__pyx_k143)},
+ {&__pyx_k144p, __pyx_k144, sizeof(__pyx_k144)},
+ {&__pyx_k145p, __pyx_k145, sizeof(__pyx_k145)},
+ {&__pyx_k146p, __pyx_k146, sizeof(__pyx_k146)},
+ {&__pyx_k147p, __pyx_k147, sizeof(__pyx_k147)},
+ {&__pyx_k148p, __pyx_k148, sizeof(__pyx_k148)},
+ {&__pyx_k149p, __pyx_k149, sizeof(__pyx_k149)},
+ {&__pyx_k150p, __pyx_k150, sizeof(__pyx_k150)},
+ {&__pyx_k151p, __pyx_k151, sizeof(__pyx_k151)},
+ {&__pyx_k152p, __pyx_k152, sizeof(__pyx_k152)},
+ {&__pyx_k153p, __pyx_k153, sizeof(__pyx_k153)},
+ {&__pyx_k154p, __pyx_k154, sizeof(__pyx_k154)},
+ {&__pyx_k155p, __pyx_k155, sizeof(__pyx_k155)},
+ {&__pyx_k156p, __pyx_k156, sizeof(__pyx_k156)},
+ {&__pyx_k157p, __pyx_k157, sizeof(__pyx_k157)},
+ {&__pyx_k158p, __pyx_k158, sizeof(__pyx_k158)},
+ {&__pyx_k159p, __pyx_k159, sizeof(__pyx_k159)},
+ {&__pyx_k160p, __pyx_k160, sizeof(__pyx_k160)},
+ {&__pyx_k161p, __pyx_k161, sizeof(__pyx_k161)},
+ {&__pyx_k162p, __pyx_k162, sizeof(__pyx_k162)},
+ {&__pyx_k163p, __pyx_k163, sizeof(__pyx_k163)},
+ {&__pyx_k164p, __pyx_k164, sizeof(__pyx_k164)},
+ {&__pyx_k165p, __pyx_k165, sizeof(__pyx_k165)},
+ {&__pyx_k166p, __pyx_k166, sizeof(__pyx_k166)},
+ {&__pyx_k167p, __pyx_k167, sizeof(__pyx_k167)},
+ {&__pyx_k168p, __pyx_k168, sizeof(__pyx_k168)},
+ {&__pyx_k169p, __pyx_k169, sizeof(__pyx_k169)},
+ {&__pyx_k171p, __pyx_k171, sizeof(__pyx_k171)},
+ {0, 0, 0}
+};
+
+static PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ 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 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},
+ {"dirichlet", (PyCFunction)__pyx_f_6mtrand_11RandomState_dirichlet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_dirichlet},
+ {"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*/
+ #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
+ 0, /*nb_index*/
+ #endif
+};
+
+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*/
+};
+
+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*/
+ "\n RandomState(seed=None)\n\n Container for the Mersenne Twister PRNG.\n\n `RandomState` exposes a number of methods for generating random numbers\n drawn from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n `size` that defaults to ``None``. If `size` is ``None``, then a single\n value is generated and returned. If `size` is an integer, then a 1-D\n numpy array filled with generated values is returned. If size is a tuple,\n then a numpy array with that shape is filled and returned.\n\n Parameters\n ----------\n seed : array_like, int, optional\n Random seed initializing the PRNG.\n Can be an integer, an array (or other sequence) of integers of\n any length, or ``None``.\n If `seed` is ``None``, then `RandomState` will try to read data from\n ``/dev/urandom`` (or the Windows analogue) if available or seed from\n the clock otherwise.\n\n ", /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*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}
+};
+
+static void __pyx_init_filenames(void); /*proto*/
+
+PyMODINIT_FUNC initmtrand(void); /*proto*/
+PyMODINIT_FUNC initmtrand(void) {
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ PyObject *__pyx_7 = 0;
+ PyObject *__pyx_8 = 0;
+ PyObject *__pyx_9 = 0;
+ PyObject *__pyx_10 = 0;
+ PyObject *__pyx_11 = 0;
+ PyObject *__pyx_12 = 0;
+ PyObject *__pyx_13 = 0;
+ PyObject *__pyx_14 = 0;
+ PyObject *__pyx_15 = 0;
+ PyObject *__pyx_16 = 0;
+ PyObject *__pyx_17 = 0;
+ PyObject *__pyx_18 = 0;
+ __pyx_init_filenames();
+ __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;};
+ Py_INCREF(__pyx_m);
+ __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_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (!__pyx_ptype_6mtrand_dtype) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; goto __pyx_L1;}
+ __pyx_ptype_6mtrand_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ndarray) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_ptype_6mtrand_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (!__pyx_ptype_6mtrand_flatiter) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_ptype_6mtrand_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (!__pyx_ptype_6mtrand_broadcast) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; goto __pyx_L1;}
+ if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;}
+ if (PyObject_SetAttrString(__pyx_m, "RandomState", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;}
+ __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":121 */
+ import_array();
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":123 */
+ __pyx_1 = __Pyx_Import(__pyx_n_numpy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":546 */
+ Py_INCREF(Py_None);
+ __pyx_k2 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":556 */
+ Py_INCREF(Py_None);
+ __pyx_k3 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":646 */
+ Py_INCREF(Py_None);
+ __pyx_k4 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":655 */
+ Py_INCREF(Py_None);
+ __pyx_k5 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":683 */
+ Py_INCREF(Py_None);
+ __pyx_k6 = Py_None;
+ Py_INCREF(Py_None);
+ __pyx_k7 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":747 */
+ __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}
+ __pyx_k8 = __pyx_1;
+ __pyx_1 = 0;
+ __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}
+ __pyx_k9 = __pyx_2;
+ __pyx_2 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k10 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":895 */
+ Py_INCREF(Py_None);
+ __pyx_k11 = Py_None;
+ Py_INCREF(Py_None);
+ __pyx_k12 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":910 */
+ Py_INCREF(Py_None);
+ __pyx_k13 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":919 */
+ __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}
+ __pyx_k14 = __pyx_3;
+ __pyx_3 = 0;
+ __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}
+ __pyx_k15 = __pyx_4;
+ __pyx_4 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k16 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1019 */
+ Py_INCREF(Py_None);
+ __pyx_k17 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1078 */
+ __pyx_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; goto __pyx_L1;}
+ __pyx_k18 = __pyx_5;
+ __pyx_5 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k19 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1128 */
+ Py_INCREF(Py_None);
+ __pyx_k20 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1137 */
+ Py_INCREF(Py_None);
+ __pyx_k21 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1159 */
+ __pyx_6 = PyFloat_FromDouble(1.0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; goto __pyx_L1;}
+ __pyx_k22 = __pyx_6;
+ __pyx_6 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k23 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1250 */
+ Py_INCREF(Py_None);
+ __pyx_k24 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1353 */
+ Py_INCREF(Py_None);
+ __pyx_k25 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1391 */
+ Py_INCREF(Py_None);
+ __pyx_k26 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1471 */
+ Py_INCREF(Py_None);
+ __pyx_k27 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1513 */
+ Py_INCREF(Py_None);
+ __pyx_k28 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1522 */
+ Py_INCREF(Py_None);
+ __pyx_k29 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1545 */
+ Py_INCREF(Py_None);
+ __pyx_k30 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1640 */
+ Py_INCREF(Py_None);
+ __pyx_k31 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1729 */
+ Py_INCREF(Py_None);
+ __pyx_k32 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1828 */
+ Py_INCREF(Py_None);
+ __pyx_k33 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1851 */
+ __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; goto __pyx_L1;}
+ __pyx_k34 = __pyx_7;
+ __pyx_7 = 0;
+ __pyx_8 = PyFloat_FromDouble(1.0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; goto __pyx_L1;}
+ __pyx_k35 = __pyx_8;
+ __pyx_8 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k36 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1890 */
+ __pyx_9 = PyFloat_FromDouble(0.0); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; goto __pyx_L1;}
+ __pyx_k37 = __pyx_9;
+ __pyx_9 = 0;
+ __pyx_10 = PyFloat_FromDouble(1.0); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; goto __pyx_L1;}
+ __pyx_k38 = __pyx_10;
+ __pyx_10 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k39 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2014 */
+ __pyx_11 = PyFloat_FromDouble(0.0); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; goto __pyx_L1;}
+ __pyx_k40 = __pyx_11;
+ __pyx_11 = 0;
+ __pyx_12 = PyFloat_FromDouble(1.0); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; goto __pyx_L1;}
+ __pyx_k41 = __pyx_12;
+ __pyx_12 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k42 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2102 */
+ __pyx_13 = PyFloat_FromDouble(0.0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;}
+ __pyx_k43 = __pyx_13;
+ __pyx_13 = 0;
+ __pyx_14 = PyFloat_FromDouble(1.0); if (!__pyx_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;}
+ __pyx_k44 = __pyx_14;
+ __pyx_14 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k45 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2233 */
+ __pyx_15 = PyFloat_FromDouble(1.0); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; goto __pyx_L1;}
+ __pyx_k46 = __pyx_15;
+ __pyx_15 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k47 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2257 */
+ Py_INCREF(Py_None);
+ __pyx_k48 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2287 */
+ Py_INCREF(Py_None);
+ __pyx_k49 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2326 */
+ Py_INCREF(Py_None);
+ __pyx_k50 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2434 */
+ Py_INCREF(Py_None);
+ __pyx_k51 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2471 */
+ __pyx_16 = PyFloat_FromDouble(1.0); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; goto __pyx_L1;}
+ __pyx_k52 = __pyx_16;
+ __pyx_16 = 0;
+ Py_INCREF(Py_None);
+ __pyx_k53 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2493 */
+ Py_INCREF(Py_None);
+ __pyx_k54 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2585 */
+ Py_INCREF(Py_None);
+ __pyx_k55 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2651 */
+ Py_INCREF(Py_None);
+ __pyx_k56 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2770 */
+ Py_INCREF(Py_None);
+ __pyx_k57 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2865 */
+ Py_INCREF(Py_None);
+ __pyx_k58 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2998 */
+ Py_INCREF(Py_None);
+ __pyx_k59 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3091 */
+ Py_INCREF(Py_None);
+ __pyx_k60 = Py_None;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3255 */
+ __pyx_17 = PyObject_CallObject(((PyObject *)__pyx_ptype_6mtrand_RandomState), 0); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3255; goto __pyx_L1;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3255; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3256 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_seed); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_seed, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3257 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3257; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_get_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3257; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3257; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3258 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_set_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3259 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_sample); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3260 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randint); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3261 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3261; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_bytes); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3261; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3261; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3262 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_uniform); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3263 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3263; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rand); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3263; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3263; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3264 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randn); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3265 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3265; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_integers); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3265; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3265; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3266 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3266; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3266; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3266; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3267 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3267; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3267; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3267; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3268 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_beta); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3269 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3270 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3271 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3272 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3273 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3274 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3275 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3276 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3277 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3277; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_cauchy); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3277; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3277; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3278 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3278; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_t); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3278; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3278; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3279 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3279; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_vonmises); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3279; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3279; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3280 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3280; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_pareto); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3280; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3280; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3281 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3281; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_weibull); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3281; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3281; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3282 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_power); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3283 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3283; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_laplace); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3283; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3283; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3284 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3284; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gumbel); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3284; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3284; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3285 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3285; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logistic); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3285; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3285; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3286 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_lognormal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3287 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3287; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rayleigh); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3287; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3287; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3288 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_wald); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3289 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3289; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_triangular); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3289; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3289; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3291 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3291; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3291; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3291; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3292 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3292; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_negative_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3292; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3292; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3293 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3293; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_poisson); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3293; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3293; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3294 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3294; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_zipf); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3294; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3294; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3295 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3295; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_geometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3295; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3295; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3296 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3296; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_hypergeometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3296; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3296; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3297 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3297; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logseries); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3297; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3297; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3299 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3299; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multivariate_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3299; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3299; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3300 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multinomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3301 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3301; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_dirichlet); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3301; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_dirichlet, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3301; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3303 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_shuffle); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+
+ /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3304 */
+ __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3304; goto __pyx_L1;}
+ __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_permutation); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3304; goto __pyx_L1;}
+ Py_DECREF(__pyx_17); __pyx_17 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3304; goto __pyx_L1;}
+ Py_DECREF(__pyx_18); __pyx_18 = 0;
+ return;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ Py_XDECREF(__pyx_7);
+ Py_XDECREF(__pyx_8);
+ Py_XDECREF(__pyx_9);
+ Py_XDECREF(__pyx_10);
+ Py_XDECREF(__pyx_11);
+ Py_XDECREF(__pyx_12);
+ Py_XDECREF(__pyx_13);
+ Py_XDECREF(__pyx_14);
+ Py_XDECREF(__pyx_15);
+ Py_XDECREF(__pyx_16);
+ Py_XDECREF(__pyx_17);
+ Py_XDECREF(__pyx_18);
+ __Pyx_AddTraceback("mtrand");
+}
+
+static char *__pyx_filenames[] = {
+ "mtrand.pyx",
+ "numpy.pxi",
+};
+
+/* Runtime support code */
+
+static void __pyx_init_filenames(void) {
+ __pyx_f = __pyx_filenames;
+}
+
+static int __Pyx_GetStarArgs(
+ PyObject **args,
+ PyObject **kwds,
+ char *kwd_list[],
+ Py_ssize_t nargs,
+ PyObject **args2,
+ PyObject **kwds2,
+ char rqd_kwds[])
+{
+ PyObject *x = 0, *args1 = 0, *kwds1 = 0;
+ int i;
+ char **p;
+
+ 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_GET_SIZE(*args));
+ if (!*args2)
+ goto bad;
+ }
+ else if (PyTuple_GET_SIZE(*args) > nargs) {
+ int m = nargs;
+ int n = PyTuple_GET_SIZE(*args);
+ PyErr_Format(PyExc_TypeError,
+ "function takes at most %d positional arguments (%d given)",
+ m, n);
+ goto bad;
+ }
+ else {
+ args1 = *args;
+ Py_INCREF(args1);
+ }
+
+ if (rqd_kwds && !*kwds)
+ for (i = 0, p = kwd_list; *p; i++, p++)
+ if (rqd_kwds[i])
+ goto missing_kwarg;
+
+ if (kwds2) {
+ if (*kwds) {
+ kwds1 = PyDict_New();
+ if (!kwds1)
+ goto bad;
+ *kwds2 = PyDict_Copy(*kwds);
+ if (!*kwds2)
+ goto bad;
+ for (i = 0, p = kwd_list; *p; i++, 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 if (rqd_kwds && rqd_kwds[i])
+ goto missing_kwarg;
+ }
+ }
+ else {
+ *kwds2 = PyDict_New();
+ if (!*kwds2)
+ goto bad;
+ }
+ }
+ else {
+ kwds1 = *kwds;
+ Py_XINCREF(kwds1);
+ if (rqd_kwds && *kwds)
+ for (i = 0, p = kwd_list; *p; i++, p++)
+ if (rqd_kwds[i] && !PyDict_GetItemString(*kwds, *p))
+ goto missing_kwarg;
+ }
+
+ *args = args1;
+ *kwds = kwds1;
+ return 0;
+missing_kwarg:
+ PyErr_Format(PyExc_TypeError,
+ "required keyword argument '%s' is missing", *p);
+bad:
+ Py_XDECREF(args1);
+ Py_XDECREF(kwds1);
+ if (args2) {
+ Py_XDECREF(*args2);
+ }
+ if (kwds2) {
+ 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_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);
+ }
+ #if PY_VERSION_HEX < 0x02050000
+ if (!PyClass_Check(type))
+ #else
+ if (!PyType_Check(type))
+ #endif
+ {
+ /* 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;
+ }
+ /* Normalize to raise <class>, <instance> */
+ Py_DECREF(value);
+ value = type;
+ #if PY_VERSION_HEX < 0x02050000
+ if (PyInstance_Check(type)) {
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+ Py_INCREF(type);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception must be an old-style class or instance");
+ goto raise_error;
+ }
+ #else
+ type = (PyObject*) type->ob_type;
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ #endif
+ }
+ 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 *iter) {
+ PyObject *item;
+ if (!(item = PyIter_Next(iter))) {
+ if (!PyErr_Occurred())
+ __Pyx_UnpackError();
+ }
+ return item;
+}
+
+static int __Pyx_EndUnpack(PyObject *iter) {
+ PyObject *item;
+ if ((item = PyIter_Next(iter))) {
+ Py_DECREF(item);
+ __Pyx_UnpackError();
+ return -1;
+ }
+ else if (!PyErr_Occurred())
+ return 0;
+ else
+ return -1;
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyThreadState *tstate = PyThreadState_Get();
+ PyErr_Fetch(type, value, tb);
+ PyErr_NormalizeException(type, value, tb);
+ if (PyErr_Occurred())
+ goto bad;
+ Py_INCREF(*type);
+ Py_INCREF(*value);
+ Py_INCREF(*tb);
+ Py_XDECREF(tstate->exc_type);
+ Py_XDECREF(tstate->exc_value);
+ Py_XDECREF(tstate->exc_traceback);
+ tstate->exc_type = *type;
+ tstate->exc_value = *value;
+ tstate->exc_traceback = *tb;
+ return 0;
+bad:
+ Py_XDECREF(*type);
+ Py_XDECREF(*value);
+ Py_XDECREF(*tb);
+ return -1;
+}
+
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+ if (!type) {
+ PyErr_Format(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (obj == Py_None || PyObject_TypeCheck(obj, type))
+ return 1;
+ PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
+ obj->ob_type->tp_name, type->tp_name);
+ 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;
+}
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
+ long size)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ result = PyObject_GetAttrString(py_module, 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;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(result);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(char *name) {
+ PyObject *py_name = 0;
+
+ py_name = PyString_FromString(name);
+ if (!py_name)
+ goto bad;
+ return PyImport_Import(py_name);
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#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..7ac9fc12c
--- /dev/null
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -0,0 +1,3304 @@
+# 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 "numpy.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
+ int has_gauss
+ double gauss
+
+ 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, double 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_discdd)(rk_state *state, double 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 numpy
+import_array()
+
+import numpy as np
+
+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>np.empty(size, np.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_sc(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>np.empty(size, np.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 cont1_array(rk_state *state, rk_cont1 func, object size, ndarray oa):
+ cdef double *array_data
+ cdef double *oa_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef flatiter itera
+ cdef broadcast multi
+
+ if size is None:
+ array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE)
+ length = PyArray_SIZE(array)
+ array_data = <double *>array.data
+ itera = <flatiter>PyArray_IterNew(<object>oa)
+ for i from 0 <= i < length:
+ array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+ PyArray_ITER_NEXT(itera)
+ else:
+ array = <ndarray>np.empty(size, np.float64)
+ array_data = <double *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(2, <void *>array,
+ <void *>oa)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ array_data[i] = func(state, oa_data[0])
+ PyArray_MultiIter_NEXTi(multi, 1)
+ return array
+
+cdef object cont2_array_sc(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>np.empty(size, np.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 cont2_array(rk_state *state, rk_cont2 func, object size,
+ ndarray oa, ndarray ob):
+ cdef double *array_data
+ cdef double *oa_data
+ cdef double *ob_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef broadcast multi
+
+ if size is None:
+ multi = <broadcast> PyArray_MultiIterNew(2, <void *>oa, <void *>ob)
+ array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
+ array_data = <double *>array.data
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
+ ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ array_data[i] = func(state, oa_data[0], ob_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ else:
+ array = <ndarray>np.empty(size, np.float64)
+ array_data = <double *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>oa, <void *>ob)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+ array_data[i] = func(state, oa_data[0], ob_data[0])
+ PyArray_MultiIter_NEXTi(multi, 1)
+ PyArray_MultiIter_NEXTi(multi, 2)
+ return array
+
+cdef object cont3_array_sc(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>np.empty(size, np.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 cont3_array(rk_state *state, rk_cont3 func, object size, ndarray oa,
+ ndarray ob, ndarray oc):
+
+ cdef double *array_data
+ cdef double *oa_data
+ cdef double *ob_data
+ cdef double *oc_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef broadcast multi
+
+ if size is None:
+ multi = <broadcast> PyArray_MultiIterNew(3, <void *>oa, <void *>ob, <void *>oc)
+ array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
+ array_data = <double *>array.data
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
+ ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ oc_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+ array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ else:
+ array = <ndarray>np.empty(size, np.float64)
+ array_data = <double *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>oa,
+ <void *>ob, <void *>oc)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+ oc_data = <double *>PyArray_MultiIter_DATA(multi, 3)
+ array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ 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>np.empty(size, 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_sc(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>np.empty(size, 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 discnp_array(rk_state *state, rk_discnp func, object size, ndarray on, ndarray op):
+ cdef long *array_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef double *op_data
+ cdef long *on_data
+ cdef broadcast multi
+
+ if size is None:
+ multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
+ array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
+ array_data = <long *>array.data
+ for i from 0 <= i < multi.size:
+ on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
+ op_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ array_data[i] = func(state, on_data[0], op_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ else:
+ array = <ndarray>np.empty(size, int)
+ array_data = <long *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+ op_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+ array_data[i] = func(state, on_data[0], op_data[0])
+ PyArray_MultiIter_NEXTi(multi, 1)
+ PyArray_MultiIter_NEXTi(multi, 2)
+
+ return array
+
+cdef object discdd_array_sc(rk_state *state, rk_discdd func, object size, double 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>np.empty(size, 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 discdd_array(rk_state *state, rk_discdd func, object size, ndarray on, ndarray op):
+ cdef long *array_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef double *op_data
+ cdef double *on_data
+ cdef broadcast multi
+
+ if size is None:
+ multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
+ array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
+ array_data = <long *>array.data
+ for i from 0 <= i < multi.size:
+ on_data = <double *>PyArray_MultiIter_DATA(multi, 0)
+ op_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ array_data[i] = func(state, on_data[0], op_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ else:
+ array = <ndarray>np.empty(size, int)
+ array_data = <long *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ on_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ op_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+ array_data[i] = func(state, on_data[0], op_data[0])
+ PyArray_MultiIter_NEXTi(multi, 1)
+ PyArray_MultiIter_NEXTi(multi, 2)
+
+ return array
+
+cdef object discnmN_array_sc(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>np.empty(size, 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 discnmN_array(rk_state *state, rk_discnmN func, object size,
+ ndarray on, ndarray om, ndarray oN):
+ cdef long *array_data
+ cdef long *on_data
+ cdef long *om_data
+ cdef long *oN_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef broadcast multi
+
+ if size is None:
+ multi = <broadcast> PyArray_MultiIterNew(3, <void *>on, <void *>om, <void *>oN)
+ array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
+ array_data = <long *>array.data
+ for i from 0 <= i < multi.size:
+ on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
+ om_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+ oN_data = <long *>PyArray_MultiIter_DATA(multi, 2)
+ array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
+ PyArray_MultiIter_NEXT(multi)
+ else:
+ array = <ndarray>np.empty(size, int)
+ array_data = <long *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>on, <void *>om,
+ <void *>oN)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+ om_data = <long *>PyArray_MultiIter_DATA(multi, 2)
+ oN_data = <long *>PyArray_MultiIter_DATA(multi, 3)
+ array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
+ PyArray_MultiIter_NEXT(multi)
+
+ return array
+
+cdef object discd_array_sc(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>np.empty(size, 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 object discd_array(rk_state *state, rk_discd func, object size, ndarray oa):
+ cdef long *array_data
+ cdef double *oa_data
+ cdef ndarray array "arrayObject"
+ cdef npy_intp length
+ cdef npy_intp i
+ cdef broadcast multi
+ cdef flatiter itera
+
+ if size is None:
+ array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG)
+ length = PyArray_SIZE(array)
+ array_data = <long *>array.data
+ itera = <flatiter>PyArray_IterNew(<object>oa)
+ for i from 0 <= i < length:
+ array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+ PyArray_ITER_NEXT(itera)
+ else:
+ array = <ndarray>np.empty(size, int)
+ array_data = <long *>array.data
+ multi = <broadcast>PyArray_MultiIterNew(2, <void *>array, <void *>oa)
+ if (multi.size != PyArray_SIZE(array)):
+ raise ValueError("size is not compatible with inputs")
+ for i from 0 <= i < multi.size:
+ oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ array_data[i] = func(state, oa_data[0])
+ PyArray_MultiIter_NEXTi(multi, 1)
+ 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:
+ """
+ RandomState(seed=None)
+
+ Container for the Mersenne Twister PRNG.
+
+ `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` that defaults to ``None``. If `size` is ``None``, then a single
+ value is generated and returned. If `size` is an integer, then a 1-D
+ numpy array filled with generated values is returned. If size is a tuple,
+ then a numpy array with that shape is filled and returned.
+
+ Parameters
+ ----------
+ seed : array_like, int, optional
+ Random seed initializing the PRNG.
+ 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_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)
+ self.internal_state = NULL
+
+ def seed(self, seed=None):
+ """
+ seed(seed=None)
+
+ Seed the generator.
+
+ 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)
+ elif isinstance(seed, np.integer):
+ iseed = int(seed)
+ rk_seed(iseed, self.internal_state)
+ else:
+ obj = <ndarray>PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1)
+ init_by_array(self.internal_state, <unsigned long *>(obj.data),
+ obj.dimensions[0])
+
+ def get_state(self):
+ """
+ get_state()
+
+ Return a tuple representing the internal state of the generator::
+
+ ('MT19937', int key[624], int pos, int has_gauss, float cached_gaussian)
+
+ """
+ cdef ndarray state "arrayObject_state"
+ state = <ndarray>np.empty(624, np.uint)
+ memcpy(<void*>(state.data), <void*>(self.internal_state.key), 624*sizeof(long))
+ state = <ndarray>np.asarray(state, np.uint32)
+ return ('MT19937', state, self.internal_state.pos,
+ self.internal_state.has_gauss, self.internal_state.gauss)
+
+ def set_state(self, state):
+ """
+ set_state(state)
+
+ Set the state from a tuple.
+
+ state = ('MT19937', int key[624], int pos, int has_gauss, float cached_gaussian)
+
+ For backwards compatibility, the following form is also accepted
+ although it is missing some information about the cached Gaussian value.
+
+ state = ('MT19937', int key[624], int pos)
+
+ """
+ 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:3]
+ if len(state) == 3:
+ has_gauss = 0
+ cached_gaussian = 0.0
+ else:
+ has_gauss, cached_gaussian = state[3:5]
+ try:
+ obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1)
+ except TypeError:
+ # compatibility -- could be an older pickle
+ obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1)
+ if obj.dimensions[0] != 624:
+ raise ValueError("state must be 624 longs")
+ memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long))
+ self.internal_state.pos = pos
+ self.internal_state.has_gauss = has_gauss
+ self.internal_state.gauss = cached_gaussian
+
+ # Pickling support:
+ def __getstate__(self):
+ return self.get_state()
+
+ def __setstate__(self, state):
+ self.set_state(state)
+
+ def __reduce__(self):
+ return (np.random.__RandomState_ctor, (), self.get_state())
+
+ # Basic distributions:
+ def random_sample(self, size=None):
+ """
+ random_sample(size=None)
+
+ Return random floats in the half-open interval [0.0, 1.0).
+
+ """
+ return cont0_array(self.internal_state, rk_double, size)
+
+ def tomaxint(self, size=None):
+ """
+ tomaxint(size=None)
+
+ Uniformly sample discrete random integers `x` such that
+ ``0 <= x <= sys.maxint``.
+
+ Parameters
+ ----------
+ size : tuple of ints, int, optional
+ Shape of output. If the given size is, for example, (m,n,k),
+ m*n*k samples are generated. If no shape is specified, a single sample
+ is returned.
+
+ Returns
+ -------
+ out : ndarray
+ Drawn samples, with shape `size`.
+
+ See Also
+ --------
+ randint : Uniform sampling over a given half-open interval of integers.
+ random_integers : Uniform sampling over a given closed interval of
+ integers.
+
+ """
+ return disc0_array(self.internal_state, rk_long, size)
+
+ def randint(self, low, high=None, size=None):
+ """
+ randint(low, high=None, size=None)
+
+ Return random integers x such that low <= x < high.
+
+ 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 <long>rk_interval(diff, self.internal_state) + lo
+ else:
+ array = <ndarray>np.empty(size, 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):
+ """
+ bytes(length)
+
+ Return random bytes.
+
+ Parameters
+ ----------
+ length : int
+ Number of random bytes.
+
+ Returns
+ -------
+ out : str
+ String of length `N`.
+
+ Examples
+ --------
+ >>> np.random.bytes(10)
+ ' eh\\x85\\x022SZ\\xbf\\xa4' #random
+
+ """
+ cdef void *bytes
+ bytestring = PyString_FromStringAndSize(NULL, length)
+ bytes = PyString_AS_STRING(bytestring)
+ rk_fill(bytes, length, self.internal_state)
+ return bytestring
+
+ def uniform(self, low=0.0, high=1.0, size=None):
+ """
+ uniform(low=0.0, high=1.0, size=1)
+
+ Draw samples from a uniform distribution.
+
+ Samples are uniformly distributed over the half-open interval
+ ``[low, high)`` (includes low, but excludes high). In other words,
+ any value within the given interval is equally likely to be drawn
+ by `uniform`.
+
+ Parameters
+ ----------
+ low : float, optional
+ Lower boundary of the output interval. All values generated will be
+ greater than or equal to low. The default value is 0.
+ high : float
+ Upper boundary of the output interval. All values generated will be
+ less than high. The default value is 1.0.
+ size : tuple of ints, int, optional
+ Shape of output. If the given size is, for example, (m,n,k),
+ m*n*k samples are generated. If no shape is specified, a single sample
+ is returned.
+
+ Returns
+ -------
+ out : ndarray
+ Drawn samples, with shape `size`.
+
+ See Also
+ --------
+ randint : Discrete uniform distribution, yielding integers.
+ random_integers : Discrete uniform distribution over the closed interval
+ ``[low, high]``.
+ random_sample : Floats uniformly distributed over ``[0, 1)``.
+ random : Alias for `random_sample`.
+ rand : Convenience function that accepts dimensions as input, e.g.,
+ ``rand(2,2)`` would generate a 2-by-2 array of floats, uniformly
+ distributed over ``[0, 1)``.
+
+ Notes
+ -----
+ The probability density function of the uniform distribution is
+
+ .. math:: p(x) = \\frac{1}{b - a}
+
+ anywhere within the interval ``[a, b)``, and zero elsewhere.
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> s = np.random.uniform(-1,0,1000)
+
+ All values are within the given interval:
+
+ >>> np.all(s >= -1)
+ True
+
+ >>> np.all(s < 0)
+ True
+
+ Display the histogram of the samples, along with the
+ probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> count, bins, ignored = plt.hist(s, 15, normed=True)
+ >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray olow, ohigh, odiff
+ cdef double flow, fhigh
+ cdef object temp
+
+ flow = PyFloat_AsDouble(low)
+ fhigh = PyFloat_AsDouble(high)
+ if not PyErr_Occurred():
+ return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow)
+ PyErr_Clear()
+ olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED)
+ ohigh = <ndarray>PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED)
+ temp = np.subtract(ohigh, olow)
+ Py_INCREF(temp) # needed to get around Pyrex's automatic reference-counting
+ # rules because EnsureArray steals a reference
+ odiff = <ndarray>PyArray_EnsureArray(temp)
+ return cont2_array(self.internal_state, rk_uniform, size, olow, odiff)
+
+ def rand(self, *args):
+ """
+ rand(d0, d1, ..., dn)
+
+ Random values in a given shape.
+
+ Create an array of the given shape and propagate it with
+ random samples from a uniform distribution
+ over ``[0, 1)``.
+
+ Parameters
+ ----------
+ d0, d1, ..., dn : int
+ Shape of the output.
+
+ Returns
+ -------
+ out : ndarray, shape ``(d0, d1, ..., dn)``
+ Random values.
+
+ See Also
+ --------
+ random
+
+ Notes
+ -----
+ This is a convenience function. If you want an interface that
+ takes a shape-tuple as the first argument, refer to
+ `random`.
+
+ Examples
+ --------
+ >>> np.random.rand(3,2)
+ array([[ 0.14022471, 0.96360618], #random
+ [ 0.37601032, 0.25528411], #random
+ [ 0.49313049, 0.94909878]]) #random
+
+ """
+ if len(args) == 0:
+ return self.random_sample()
+ else:
+ return self.random_sample(size=args)
+
+ def randn(self, *args):
+ """
+ randn(d0, d1, ..., dn)
+
+ Returns zero-mean, unit-variance Gaussian random numbers in an
+ array of shape (d0, d1, ..., dn).
+
+ Note: This is a convenience function. If you want an
+ interface that takes a tuple as the first argument
+ use numpy.random.standard_normal(shape_tuple).
+
+ """
+ if len(args) == 0:
+ return self.standard_normal()
+ else:
+ return self.standard_normal(args)
+
+ def random_integers(self, low, high=None, size=None):
+ """
+ random_integers(low, high=None, size=None)
+
+ Return random integers x such that low <= x <= high.
+
+ 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(size=None)
+
+ Standard Normal distribution (mean=0, stdev=1).
+
+ """
+ return cont0_array(self.internal_state, rk_gauss, size)
+
+ def normal(self, loc=0.0, scale=1.0, size=None):
+ """
+ normal(loc=0.0, scale=1.0, size=None)
+
+ Draw random samples from a normal (Gaussian) distribution.
+
+ The probability density function of the normal distribution, first
+ derived by De Moivre and 200 years later by both Gauss and Laplace
+ independently [2]_, is often called the bell curve because of
+ its characteristic shape (see the example below).
+
+ The normal distributions occurs often in nature. For example, it
+ describes the commonly occurring distribution of samples influenced
+ by a large number of tiny, random disturbances, each with its own
+ unique distribution [2]_.
+
+ Parameters
+ ----------
+ loc : float
+ Mean ("centre") of the distribution.
+ scale : float
+ Standard deviation (spread or "width") of the distribution.
+ size : tuple of ints
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ See Also
+ --------
+ scipy.stats.distributions.norm : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Gaussian distribution is
+
+ .. math:: p(x) = \\frac{1}{\\sqrt{ 2 \\pi \\sigma^2 }}
+ e^{ - \\frac{ (x - \\mu)^2 } {2 \\sigma^2} },
+
+ where :math:`\\mu` is the mean and :math:`\\sigma` the standard deviation.
+ The square of the standard deviation, :math:`\\sigma^2`, is called the
+ variance.
+
+ The function has its peak at the mean, and its "spread" increases with
+ the standard deviation (the function reaches 0.607 times its maximum at
+ :math:`x + \\sigma` and :math:`x - \\sigma` [2]_). This implies that
+ `numpy.random.normal` is more likely to return samples lying close to the
+ mean, rather than those far away.
+
+ References
+ ----------
+ .. [1] Wikipedia, "Normal distribution",
+ http://en.wikipedia.org/wiki/Normal_distribution
+ .. [2] P. R. Peebles Jr., "Central Limit Theorem" in "Probability, Random
+ Variables and Random Signal Principles", 4th ed., 2001,
+ pp. 51, 51, 125.
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> mu, sigma = 0, 0.1 # mean and standard deviation
+ >>> s = np.random.normal(mu, sigma, 1000)
+
+ Verify the mean and the variance:
+
+ >>> abs(mu - np.mean(s)) < 0.01
+ True
+
+ >>> abs(sigma - np.std(s, ddof=1)) < 0.01
+ True
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> count, bins, ignored = plt.hist(s, 30, normed=True)
+ >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
+ ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
+ ... linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray oloc, oscale
+ cdef double floc, fscale
+
+ floc = PyFloat_AsDouble(loc)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
+
+ PyErr_Clear()
+
+ oloc = <ndarray>PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0)):
+ raise ValueError("scale <= 0")
+ return cont2_array(self.internal_state, rk_normal, size, oloc, oscale)
+
+ def beta(self, a, b, size=None):
+ """
+ beta(a, b, size=None)
+
+ The Beta distribution over ``[0, 1]``.
+
+ The Beta distribution is a special case of the Dirichlet distribution,
+ and is related to the Gamma distribution. It has the probability
+ distribution function
+
+ .. math:: f(x; a,b) = \\frac{1}{B(\\alpha, \\beta)} x^{\\alpha - 1}
+ (1 - x)^{\\beta - 1},
+
+ where the normalisation, B, is the beta function,
+
+ .. math:: B(\\alpha, \\beta) = \\int_0^1 t^{\\alpha - 1}
+ (1 - t)^{\\beta - 1} dt.
+
+ It is often seen in Bayesian inference and order statistics.
+
+ Parameters
+ ----------
+ a : float
+ Alpha, non-negative.
+ b : float
+ Beta, non-negative.
+ size : tuple of ints, optional
+ The number of samples to draw. The ouput is packed according to
+ the size given.
+
+ Returns
+ -------
+ out : ndarray
+ Array of the given shape, containing values drawn from a
+ Beta distribution.
+
+ """
+ cdef ndarray oa, ob
+ cdef double fa, fb
+
+ fa = PyFloat_AsDouble(a)
+ fb = PyFloat_AsDouble(b)
+ if not PyErr_Occurred():
+ if fa <= 0:
+ raise ValueError("a <= 0")
+ if fb <= 0:
+ raise ValueError("b <= 0")
+ return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
+
+ PyErr_Clear()
+
+ oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oa, 0)):
+ raise ValueError("a <= 0")
+ if np.any(np.less_equal(ob, 0)):
+ raise ValueError("b <= 0")
+ return cont2_array(self.internal_state, rk_beta, size, oa, ob)
+
+ def exponential(self, scale=1.0, size=None):
+ """
+ exponential(scale=1.0, size=None)
+
+ Exponential distribution.
+
+ Its probability density function is
+
+ .. math:: f(x; \\lambda) = \\lambda \\exp(-\\lambda x),
+
+ for ``x > 0`` and 0 elsewhere. :math:`lambda` is
+ known as the rate parameter.
+
+ The exponential distribution is a continuous analogue of the
+ geometric distribution. It describes many common situations, such as
+ the size of raindrops measured over many rainstorms [1]_, or the time
+ between page requests to Wikipedia [2]_.
+
+ Parameters
+ ----------
+ scale : float
+ The rate parameter, :math:`\\lambda`.
+ size : tuple of ints
+ Number of samples to draw. The output is shaped
+ according to `size`.
+
+ References
+ ----------
+ .. [1] Peyton Z. Peebles Jr., "Probability, Random Variables and
+ Random Signal Principles", 4th ed, 2001, p. 57.
+ .. [2] "Poisson Process", Wikipedia,
+ http://en.wikipedia.org/wiki/Poisson_process
+
+ """
+ cdef ndarray oscale
+ cdef double fscale
+
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
+
+ PyErr_Clear()
+
+ oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0")
+ return cont1_array(self.internal_state, rk_exponential, size, oscale)
+
+ def standard_exponential(self, size=None):
+ """
+ standard_exponential(size=None)
+
+ Standard exponential distribution (scale=1).
+
+ """
+ return cont0_array(self.internal_state, rk_standard_exponential, size)
+
+ def standard_gamma(self, shape, size=None):
+ """
+ standard_gamma(shape, size=None)
+
+ Standard Gamma distribution.
+
+ """
+ cdef ndarray oshape
+ cdef double fshape
+
+ fshape = PyFloat_AsDouble(shape)
+ if not PyErr_Occurred():
+ if fshape <= 0:
+ raise ValueError("shape <= 0")
+ return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
+
+ PyErr_Clear()
+ oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oshape, 0.0)):
+ raise ValueError("shape <= 0")
+ return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
+
+ def gamma(self, shape, scale=1.0, size=None):
+ """
+ gamma(shape, scale=1.0, size=None)
+
+ Draw samples from a Gamma distribution.
+
+ Samples are drawn from a Gamma distribution with specified parameters,
+ `shape` (sometimes designated "k") and `scale` (sometimes designated
+ "theta"), where both parameters are > 0.
+
+ Parameters
+ ----------
+ shape : scalar > 0
+ The shape of the gamma distribution.
+ scale : scalar > 0, optional
+ The scale of the gamma distribution. Default is equal to 1.
+ size : shape_tuple, optional
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ out : ndarray, float
+ Returns one sample unless `size` parameter is specified.
+
+ See Also
+ --------
+ scipy.stats.distributions.gamma : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Gamma distribution is
+
+ .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},
+
+ where :math:`k` is the shape and :math:`\\theta` the scale,
+ and :math:`\\Gamma` is the Gamma function.
+
+ The Gamma distribution is often used to model the times to failure of
+ electronic components, and arises naturally in processes for which the
+ waiting times between Poisson distributed events are relevant.
+
+ References
+ ----------
+ .. [1] Weisstein, Eric W. "Gamma Distribution." From MathWorld--A
+ Wolfram Web Resource.
+ http://mathworld.wolfram.com/GammaDistribution.html
+ .. [2] Wikipedia, "Gamma-distribution",
+ http://en.wikipedia.org/wiki/Gamma-distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> shape, scale = 2., 2. # mean and dispersion
+ >>> s = np.random.gamma(shape, scale, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> import scipy.special as sps
+ >>> count, bins, ignored = plt.hist(s, 50, normed=True)
+ >>> y = bins**(shape-1)*((exp(-bins/scale))/\\
+ (sps.gamma(shape)*scale**shape))
+ >>> plt.plot(bins, y, linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray oshape, oscale
+ cdef double fshape, fscale
+
+ fshape = PyFloat_AsDouble(shape)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fshape <= 0:
+ raise ValueError("shape <= 0")
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
+
+ PyErr_Clear()
+ oshape = <ndarray>PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oshape, 0.0)):
+ raise ValueError("shape <= 0")
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0")
+ return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale)
+
+ def f(self, dfnum, dfden, size=None):
+ """
+ f(dfnum, dfden, size=None)
+
+ Draw samples from a F distribution.
+
+ Samples are drawn from an F distribution with specified parameters,
+ `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom
+ in denominator), where both parameters should be greater than zero.
+
+ The random variate of the F distribution (also known as the
+ Fisher distribution) is a continuous probability distribution
+ that arises in ANOVA tests, and is the ratio of two chi-square
+ variates.
+
+ Parameters
+ ----------
+ dfnum : float
+ Degrees of freedom in numerator. Should be greater than zero.
+ dfden : float
+ Degrees of freedom in denominator. Should be greater than zero.
+ size : {tuple, int}, optional
+ Output shape. If the given shape is, e.g., ``(m, n, k)``,
+ then ``m * n * k`` samples are drawn. By default only one sample
+ is returned.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ Samples from the Fisher distribution.
+
+ See Also
+ --------
+ scipy.stats.distributions.f : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+
+ The F statistic is used to compare in-group variances to between-group
+ variances. Calculating the distribution depends on the sampling, and
+ so it is a function of the respective degrees of freedom in the
+ problem. The variable `dfnum` is the number of samples minus one, the
+ between-groups degrees of freedom, while `dfden` is the within-groups
+ degrees of freedom, the sum of the number of samples in each group
+ minus the number of groups.
+
+ References
+ ----------
+ .. [1] Glantz, Stanton A. "Primer of Biostatistics.", McGraw-Hill,
+ Fifth Edition, 2002.
+ .. [2] Wikipedia, "F-distribution",
+ http://en.wikipedia.org/wiki/F-distribution
+
+ Examples
+ --------
+ An example from Glantz[1], pp 47-40.
+ Two groups, children of diabetics (25 people) and children from people
+ without diabetes (25 controls). Fasting blood glucose was measured,
+ case group had a mean value of 86.1, controls had a mean value of
+ 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these
+ data consistent with the null hypothesis that the parents diabetic
+ status does not affect their children's blood glucose levels?
+ Calculating the F statistic from the data gives a value of 36.01.
+
+ Draw samples from the distribution:
+
+ >>> dfnum = 1. # between group degrees of freedom
+ >>> dfden = 48. # within groups degrees of freedom
+ >>> s = np.random.f(dfnum, dfden, 1000)
+
+ The lower bound for the top 1% of the samples is :
+
+ >>> sort(s)[-10]
+ 7.61988120985
+
+ So there is about a 1% chance that the F statistic will exceed 7.62,
+ the measured value is 36, so the null hypothesis is rejected at the 1%
+ level.
+
+ """
+ cdef ndarray odfnum, odfden
+ cdef double fdfnum, fdfden
+
+ fdfnum = PyFloat_AsDouble(dfnum)
+ fdfden = PyFloat_AsDouble(dfden)
+ if not PyErr_Occurred():
+ if fdfnum <= 0:
+ raise ValueError("shape <= 0")
+ if fdfden <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
+
+ PyErr_Clear()
+
+ odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
+ odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(odfnum, 0.0)):
+ raise ValueError("dfnum <= 0")
+ if np.any(np.less_equal(odfden, 0.0)):
+ raise ValueError("dfden <= 0")
+ return cont2_array(self.internal_state, rk_f, size, odfnum, odfden)
+
+ def noncentral_f(self, dfnum, dfden, nonc, size=None):
+ """
+ noncentral_f(dfnum, dfden, nonc, size=None)
+
+ Noncentral F distribution.
+
+ """
+ cdef ndarray odfnum, odfden, ononc
+ cdef double fdfnum, fdfden, fnonc
+
+ fdfnum = PyFloat_AsDouble(dfnum)
+ fdfden = PyFloat_AsDouble(dfden)
+ fnonc = PyFloat_AsDouble(nonc)
+ if not PyErr_Occurred():
+ if fdfnum <= 1:
+ raise ValueError("dfnum <= 1")
+ if fdfden <= 0:
+ raise ValueError("dfden <= 0")
+ if fnonc < 0:
+ raise ValueError("nonc < 0")
+ return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
+ fdfnum, fdfden, fnonc)
+
+ PyErr_Clear()
+
+ odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
+ odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
+ ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
+
+ if np.any(np.less_equal(odfnum, 1.0)):
+ raise ValueError("dfnum <= 1")
+ if np.any(np.less_equal(odfden, 0.0)):
+ raise ValueError("dfden <= 0")
+ if np.any(np.less(ononc, 0.0)):
+ raise ValueError("nonc < 0")
+ return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum,
+ odfden, ononc)
+
+ def chisquare(self, df, size=None):
+ """
+ chisquare(df, size=None)
+
+ Draw samples from a chi-square distribution.
+
+ When `df` independent random variables, each with standard
+ normal distributions (mean 0, variance 1), are squared and summed,
+ the resulting distribution is chi-square (see Notes). This
+ distribution is often used in hypothesis testing.
+
+ Parameters
+ ----------
+ df : int
+ Number of degrees of freedom.
+ size : tuple of ints, int, optional
+ Size of the returned array. By default, a scalar is
+ returned.
+
+ Returns
+ -------
+ output : ndarray
+ Samples drawn from the distribution, packed in a `size`-shaped
+ array.
+
+ Raises
+ ------
+ ValueError
+ When `df` <= 0 or when an inappropriate `size` (e.g. ``size=-1``)
+ is given.
+
+ Notes
+ -----
+ The variable obtained by summing the squares of `df` independent,
+ standard normally distributed random variables:
+
+ .. math:: Q = \\sum_{i=0}^{\\mathtt{df}} X^2_i
+
+ is chi-square distributed, denoted
+
+ .. math:: Q \\sim \\chi^2_k.
+
+ The probability density function of the chi-squared distribution is
+
+ .. math:: p(x) = \\frac{(1/2)^{k/2}}{\\Gamma(k/2)}
+ x^{k/2 - 1} e^{-x/2},
+
+ where :math:`\\Gamma` is the gamma function,
+
+ .. math:: \\Gamma(x) = \\int_0^{-\\infty} t^{x - 1} e^{-t} dt.
+
+ References
+ ----------
+ .. [1] NIST/SEMATECH e-Handbook of Statistical Methods,
+ http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm
+ .. [2] Wikipedia, "Chi-square distribution",
+ http://en.wikipedia.org/wiki/Chi-square_distribution
+
+ Examples
+ --------
+ >>> np.random.chisquare(2,4)
+ array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272])
+
+ """
+ cdef ndarray odf
+ cdef double fdf
+
+ fdf = PyFloat_AsDouble(df)
+ if not PyErr_Occurred():
+ if fdf <= 0:
+ raise ValueError("df <= 0")
+ return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf)
+
+ PyErr_Clear()
+
+ odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(odf, 0.0)):
+ raise ValueError("df <= 0")
+ return cont1_array(self.internal_state, rk_chisquare, size, odf)
+
+ def noncentral_chisquare(self, df, nonc, size=None):
+ """
+ noncentral_chisquare(df, nonc, size=None)
+
+ Draw samples from a noncentral chi-square distribution.
+
+ The noncentral :math:`\\chi^2` distribution is a generalisation of
+ the :math:`\\chi^2` distribution.
+
+ Parameters
+ ----------
+ df : int
+ Degrees of freedom.
+ nonc : float
+ Non-centrality.
+ size : tuple of ints
+ Shape of the output.
+
+ """
+ cdef ndarray odf, ononc
+ cdef double fdf, fnonc
+ fdf = PyFloat_AsDouble(df)
+ fnonc = PyFloat_AsDouble(nonc)
+ if not PyErr_Occurred():
+ if fdf <= 1:
+ raise ValueError("df <= 0")
+ if fnonc <= 0:
+ raise ValueError("nonc <= 0")
+ return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
+ size, fdf, fnonc)
+
+ PyErr_Clear()
+
+ odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
+ ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(odf, 0.0)):
+ raise ValueError("df <= 1")
+ if np.any(np.less_equal(ononc, 0.0)):
+ raise ValueError("nonc < 0")
+ return cont2_array(self.internal_state, rk_noncentral_chisquare, size,
+ odf, ononc)
+
+ def standard_cauchy(self, size=None):
+ """
+ standard_cauchy(size=None)
+
+ Standard Cauchy with mode=0.
+
+ """
+ return cont0_array(self.internal_state, rk_standard_cauchy, size)
+
+ def standard_t(self, df, size=None):
+ """
+ standard_t(df, size=None)
+
+ Standard Student's t distribution with df degrees of freedom.
+
+ """
+ cdef ndarray odf
+ cdef double fdf
+
+ fdf = PyFloat_AsDouble(df)
+ if not PyErr_Occurred():
+ if fdf <= 0:
+ raise ValueError("df <= 0")
+ return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
+
+ PyErr_Clear()
+
+ odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(odf, 0.0)):
+ raise ValueError("df <= 0")
+ return cont1_array(self.internal_state, rk_standard_t, size, odf)
+
+ def vonmises(self, mu, kappa, size=None):
+ """
+ vonmises(mu=0.0, kappa=1.0, size=None)
+
+ Draw samples from a von Mises distribution.
+
+ Samples are drawn from a von Mises distribution with specified mode (mu)
+ and dispersion (kappa), on the interval [-pi, pi].
+
+ The von Mises distribution (also known as the circular normal
+ distribution) is a continuous probability distribution on the circle. It
+ may be thought of as the circular analogue of the normal distribution.
+
+ Parameters
+ ----------
+ mu : float
+ Mode ("center") of the distribution.
+ kappa : float, >= 0.
+ Dispersion of the distribution.
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ The returned samples live on the unit circle [-\\pi, \\pi].
+
+ See Also
+ --------
+ scipy.stats.distributions.vonmises : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the von Mises distribution is
+
+ .. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},
+
+ where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,
+ and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.
+
+ The von Mises, named for Richard Edler von Mises, born in
+ Austria-Hungary, in what is now the Ukraine. He fled to the United
+ States in 1939 and became a professor at Harvard. He worked in
+ probability theory, aerodynamics, fluid mechanics, and philosophy of
+ science.
+
+ References
+ ----------
+ .. [1] Abramowitz, M. and Stegun, I. A. (ed.), Handbook of Mathematical
+ Functions, National Bureau of Standards, 1964; reprinted Dover
+ Publications, 1965.
+ .. [2] von Mises, Richard, 1964, Mathematical Theory of Probability
+ and Statistics (New York: Academic Press).
+ .. [3] Wikipedia, "Von Mises distribution",
+ http://en.wikipedia.org/wiki/Von_Mises_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> mu, kappa = 0.0, 4.0 # mean and dispersion
+ >>> s = np.random.vonmises(mu, kappa, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> import scipy.special as sps
+ >>> count, bins, ignored = plt.hist(s, 50, normed=True)
+ >>> x = arange(-pi, pi, 2*pi/50.)
+ >>> y = -np.exp(kappa*np.cos(x-mu))/(2*pi*sps.jn(0,kappa))
+ >>> plt.plot(x, y/max(y), linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray omu, okappa
+ cdef double fmu, fkappa
+
+ fmu = PyFloat_AsDouble(mu)
+ fkappa = PyFloat_AsDouble(kappa)
+ if not PyErr_Occurred():
+ if fkappa < 0:
+ raise ValueError("kappa < 0")
+ return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
+
+ PyErr_Clear()
+
+ omu = <ndarray> PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED)
+ okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less(okappa, 0.0)):
+ raise ValueError("kappa < 0")
+ return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
+
+ def pareto(self, a, size=None):
+ """
+ pareto(a, size=None)
+
+ Draw samples from a Pareto distribution with specified shape.
+
+ This is a simplified version of the Generalized Pareto distribution
+ (available in SciPy), with the scale set to one and the location set to
+ zero. Most authors default the location to one.
+
+ The Pareto distribution must be greater than zero, and is unbounded above.
+ It is also known as the "80-20 rule". In this distribution, 80 percent of
+ the weights are in the lowest 20 percent of the range, while the other 20
+ percent fill the remaining 80 percent of the range.
+
+ Parameters
+ ----------
+ shape : float, > 0.
+ Shape of the distribution.
+ size : tuple of ints
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ See Also
+ --------
+ scipy.stats.distributions.genpareto.pdf : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Pareto distribution is
+
+ .. math:: p(x) = \\frac{am^a}{x^{a+1}}
+
+ where :math:`a` is the shape and :math:`m` the location
+
+ The Pareto distribution, named after the Italian economist Vilfredo Pareto,
+ is a power law probability distribution useful in many real world problems.
+ Outside the field of economics it is generally referred to as the Bradford
+ distribution. Pareto developed the distribution to describe the
+ distribution of wealth in an economy. It has also found use in insurance,
+ web page access statistics, oil field sizes, and many other problems,
+ including the download frequency for projects in Sourceforge [1]. It is
+ one of the so-called "fat-tailed" distributions.
+
+
+ References
+ ----------
+ .. [1] Francis Hunt and Paul Johnson, On the Pareto Distribution of
+ Sourceforge projects.
+ .. [2] Pareto, V. (1896). Course of Political Economy. Lausanne.
+ .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme
+ Values, Birkhauser Verlag, Basel, pp 23-30.
+ .. [4] Wikipedia, "Pareto distribution",
+ http://en.wikipedia.org/wiki/Pareto_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> a, m = 3., 1. # shape and mode
+ >>> s = np.random.pareto(a, 1000) + m
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='center')
+ >>> fit = a*m**a/bins**(a+1)
+ >>> plt.plot(bins, max(count)*fit/max(fit),linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray oa
+ cdef double fa
+
+ fa = PyFloat_AsDouble(a)
+ if not PyErr_Occurred():
+ if fa <= 0:
+ raise ValueError("a <= 0")
+ return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
+
+ PyErr_Clear()
+
+ oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oa, 0.0)):
+ raise ValueError("a <= 0")
+ return cont1_array(self.internal_state, rk_pareto, size, oa)
+
+ def weibull(self, a, size=None):
+ """
+ weibull(a, size=None)
+
+ Weibull distribution.
+
+ Draw samples from a 1-parameter Weibull distribution with the given
+ shape parameter.
+
+ .. math:: X = (-ln(U))^{1/a}
+
+ Here, U is drawn from the uniform distribution over (0,1].
+
+ The more common 2-parameter Weibull, including a scale parameter
+ :math:`\\lambda` is just :math:`X = \\lambda(-ln(U))^{1/a}`.
+
+ The Weibull (or Type III asymptotic extreme value distribution for smallest
+ values, SEV Type III, or Rosin-Rammler distribution) is one of a class of
+ Generalized Extreme Value (GEV) distributions used in modeling extreme
+ value problems. This class includes the Gumbel and Frechet distributions.
+
+ Parameters
+ ----------
+ a : float
+ Shape of the distribution.
+ size : tuple of ints
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ See Also
+ --------
+ scipy.stats.distributions.weibull : probability density function,
+ distribution or cumulative density function, etc.
+
+ gumbel, scipy.stats.distributions.genextreme
+
+ Notes
+ -----
+ The probability density for the Weibull distribution is
+
+ .. math:: p(x) = \\frac{a}
+ {\\lambda}(\\frac{x}{\\lambda})^{a-1}e^{-(x/\\lambda)^a},
+
+ where :math:`a` is the shape and :math:`\\lambda` the scale.
+
+ The function has its peak (the mode) at
+ :math:`\\lambda(\\frac{a-1}{a})^{1/a}`.
+
+ When ``a = 1``, the Weibull distribution reduces to the exponential
+ distribution.
+
+ References
+ ----------
+ .. [1] Waloddi Weibull, Professor, Royal Technical University, Stockholm,
+ 1939 "A Statistical Theory Of The Strength Of Materials",
+ Ingeniorsvetenskapsakademiens Handlingar Nr 151, 1939,
+ Generalstabens Litografiska Anstalts Forlag, Stockholm.
+ .. [2] Waloddi Weibull, 1951 "A Statistical Distribution Function of Wide
+ Applicability", Journal Of Applied Mechanics ASME Paper.
+ .. [3] Wikipedia, "Weibull distribution",
+ http://en.wikipedia.org/wiki/Weibull_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> a = 5. # shape
+ >>> s = np.random.weibull(a, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> def weib(x,n,a):
+ ... return (a/n)*(x/n)**(a-1)*exp(-(x/n)**a)
+
+ >>> count, bins, ignored = plt.hist(numpy.random.weibull(5.,1000))
+ >>> scale = count.max()/weib(x, 1., 5.).max()
+ >>> x = arange(1,100.)/50.
+ >>> plt.plot(x, weib(x, 1., 5.)*scale)
+ >>> plt.show()
+
+ """
+ cdef ndarray oa
+ cdef double fa
+
+ fa = PyFloat_AsDouble(a)
+ if not PyErr_Occurred():
+ if fa <= 0:
+ raise ValueError("a <= 0")
+ return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
+
+ PyErr_Clear()
+
+ oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oa, 0.0)):
+ raise ValueError("a <= 0")
+ return cont1_array(self.internal_state, rk_weibull, size, oa)
+
+ def power(self, a, size=None):
+ """
+ power(a, size=None)
+
+ Power distribution.
+
+ """
+ cdef ndarray oa
+ cdef double fa
+
+ fa = PyFloat_AsDouble(a)
+ if not PyErr_Occurred():
+ if fa <= 0:
+ raise ValueError("a <= 0")
+ return cont1_array_sc(self.internal_state, rk_power, size, fa)
+
+ PyErr_Clear()
+
+ oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oa, 0.0)):
+ raise ValueError("a <= 0")
+ return cont1_array(self.internal_state, rk_power, size, oa)
+
+ def laplace(self, loc=0.0, scale=1.0, size=None):
+ """
+ laplace(loc=0.0, scale=1.0, size=None)
+
+ Laplace or double exponential distribution.
+
+ It has the probability density function
+
+ .. math:: f(x; \\mu, \\lambda) = \\frac{1}{2\\lambda}
+ \\exp\\left(-\\frac{|x - \\mu|}{\\lambda}\\right).
+
+ The Laplace distribution is similar to the Gaussian/normal distribution,
+ but is sharper at the peak and has fatter tails.
+
+ Parameters
+ ----------
+ loc : float
+ The position, :math:`\\mu`, of the distribution peak.
+ scale : float
+ :math:`\\lambda`, the exponential decay.
+
+ """
+ cdef ndarray oloc, oscale
+ cdef double floc, fscale
+
+ floc = PyFloat_AsDouble(loc)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
+
+ PyErr_Clear()
+ oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0")
+ return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
+
+ def gumbel(self, loc=0.0, scale=1.0, size=None):
+ """
+ gumbel(loc=0.0, scale=1.0, size=None)
+
+ Gumbel distribution.
+
+ Draw samples from a Gumbel distribution with specified location (or mean)
+ and scale (or standard deviation).
+
+ The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value
+ Type I) distribution is one of a class of Generalized Extreme Value (GEV)
+ distributions used in modeling extreme value problems. The Gumbel is a
+ special case of the Extreme Value Type I distribution for maximums from
+ distributions with "exponential-like" tails, it may be derived by
+ considering a Gaussian process of measurements, and generating the pdf for
+ the maximum values from that set of measurements (see examples).
+
+ Parameters
+ ----------
+ loc : float
+ The location of the mode of the distribution.
+ scale : float
+ The scale parameter of the distribution.
+ size : tuple of ints
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ See Also
+ --------
+ scipy.stats.gumbel : probability density function,
+ distribution or cumulative density function, etc.
+ weibull, scipy.stats.genextreme
+
+ Notes
+ -----
+ The probability density for the Gumbel distribution is
+
+ .. math:: p(x) = \\frac{e^{-(x - \\mu)/ \\beta}}{\\beta} e^{ -e^{-(x - \\mu)/
+ \\beta}},
+
+ where :math:`\\mu` is the mode, a location parameter, and :math:`\\beta`
+ is the scale parameter.
+
+ The Gumbel (named for German mathematician Emil Julius Gumbel) was used
+ very early in the hydrology literature, for modeling the occurrence of
+ flood events. It is also used for modeling maximum wind speed and rainfall
+ rates. It is a "fat-tailed" distribution - the probability of an event in
+ the tail of the distribution is larger than if one used a Gaussian, hence
+ the surprisingly frequent occurrence of 100-year floods. Floods were
+ initially modeled as a Gaussian process, which underestimated the frequency
+ of extreme events.
+
+ It is one of a class of extreme value distributions, the Generalized
+ Extreme Value (GEV) distributions, which also includes the Weibull and
+ Frechet.
+
+ The function has a mean of :math:`\\mu + 0.57721\\beta` and a variance of
+ :math:`\\frac{\\pi^2}{6}\\beta^2`.
+
+ References
+ ----------
+ .. [1] Gumbel, E.J. (1958). Statistics of Extremes. Columbia University
+ Press.
+ .. [2] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme
+ Values, from Insurance, Finance, Hydrology and Other Fields,
+ Birkhauser Verlag, Basel: Boston : Berlin.
+ .. [3] Wikipedia, "Gumbel distribution",
+ http://en.wikipedia.org/wiki/Gumbel_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> mu, beta = 0, 0.1 # location and scale
+ >>> s = np.random.gumbel(mu, beta, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> count, bins, ignored = plt.hist(s, 30, normed=True)
+ >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
+ ... * np.exp( -np.exp( -(bins - mu) /beta) ),
+ ... linewidth=2, color='r')
+ >>> plt.show()
+
+ Show how an extreme value distribution can arise from a Gaussian process
+ and compare to a Gaussian:
+
+ >>> means = []
+ >>> maxima = []
+ >>> for i in range(0,1000) :
+ ... a = np.random.normal(mu, beta, 1000)
+ ... means.append(a.mean())
+ ... maxima.append(a.max())
+ >>> count, bins, ignored = plt.hist(maxima, 30, normed=True)
+ >>> beta = np.std(maxima)*np.pi/np.sqrt(6)
+ >>> mu = np.mean(maxima) - 0.57721*beta
+ >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
+ ... * np.exp(-np.exp(-(bins - mu)/beta)),
+ ... linewidth=2, color='r')
+ >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi))
+ ... * np.exp(-(bins - mu)**2 / (2 * beta**2)),
+ ... linewidth=2, color='g')
+ >>> plt.show()
+
+ """
+ cdef ndarray oloc, oscale
+ cdef double floc, fscale
+
+ floc = PyFloat_AsDouble(loc)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
+
+ PyErr_Clear()
+ oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0")
+ return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
+
+ def logistic(self, loc=0.0, scale=1.0, size=None):
+ """
+ logistic(loc=0.0, scale=1.0, size=None)
+
+ Draw samples from a Logistic distribution.
+
+ Samples are drawn from a Logistic distribution with specified
+ parameters, loc (location or mean, also median), and scale (>0).
+
+ Parameters
+ ----------
+ loc : float
+
+ scale : float > 0.
+
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ where the values are all integers in [0, n].
+
+ See Also
+ --------
+ scipy.stats.distributions.logistic : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Logistic distribution is
+
+ .. math:: P(x) = P(x) = \\frac{e^{-(x-\\mu)/s}}{s(1+e^{-(x-\\mu)/s})^2},
+
+ where :math:`\\mu` = location and :math:`s` = scale.
+
+ The Logistic distribution is used in Extreme Value problems where it
+ can act as a mixture of Gumbel distributions, in Epidemiology, and by
+ the World Chess Federation (FIDE) where it is used in the Elo ranking
+ system, assuming the performance of each player is a logistically
+ distributed random variable.
+
+ References
+ ----------
+ .. [1] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme
+ Values, from Insurance, Finance, Hydrology and Other Fields,
+ Birkhauser Verlag, Basel, pp 132-133.
+ .. [2] Weisstein, Eric W. "Logistic Distribution." From
+ MathWorld--A Wolfram Web Resource.
+ http://mathworld.wolfram.com/LogisticDistribution.html
+ .. [3] Wikipedia, "Logistic-distribution",
+ http://en.wikipedia.org/wiki/Logistic-distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> loc, scale = 10, 1
+ >>> s = np.random.logistic(loc, scale, 10000)
+ >>> count, bins, ignored = plt.hist(s, bins=50)
+
+ # plot against distribution
+
+ >>> def logist(x, loc, scale):
+ ... return exp((loc-x)/scale)/(scale*(1+exp((loc-x)/scale))**2)
+ >>> plt.plot(bins, logist(bins, loc, scale)*count.max()/\\
+ ... logist(bins, loc, scale).max())
+ >>> plt.show()
+
+ """
+ cdef ndarray oloc, oscale
+ cdef double floc, fscale
+
+ floc = PyFloat_AsDouble(loc)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
+
+ PyErr_Clear()
+ oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0")
+ return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
+
+ def lognormal(self, mean=0.0, sigma=1.0, size=None):
+ """
+ lognormal(mean=0.0, sigma=1.0, size=None)
+
+ Return samples drawn from a log-normal distribution.
+
+ Draw samples from a log-normal distribution with specified mean, standard
+ deviation, and shape. Note that the mean and standard deviation are not the
+ values for the distribution itself, but of the underlying normal
+ distribution it is derived from.
+
+
+ Parameters
+ ----------
+ mean : float
+ Mean value of the underlying normal distribution
+ sigma : float, >0.
+ Standard deviation of the underlying normal distribution
+ size : tuple of ints
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ See Also
+ --------
+ scipy.stats.lognorm : probability density function, distribution,
+ cumulative density function, etc.
+
+ Notes
+ -----
+ A variable `x` has a log-normal distribution if `log(x)` is normally
+ distributed.
+
+ The probability density function for the log-normal distribution is
+
+ .. math:: p(x) = \\frac{1}{\\sigma x \\sqrt{2\\pi}}
+ e^{(-\\frac{(ln(x)-\\mu)^2}{2\\sigma^2})}
+
+ where :math:`\\mu` is the mean and :math:`\\sigma` is the standard deviation
+ of the normally distributed logarithm of the variable.
+
+ A log-normal distribution results if a random variable is the *product* of
+ a large number of independent, identically-distributed variables in the
+ same way that a normal distribution results if the variable is the *sum*
+ of a large number of independent, identically-distributed variables
+ (see the last example). It is one of the so-called "fat-tailed"
+ distributions.
+
+ The log-normal distribution is commonly used to model the lifespan of units
+ with fatigue-stress failure modes. Since this includes
+ most mechanical systems, the log-normal distribution has widespread
+ application.
+
+ It is also commonly used to model oil field sizes, species abundance, and
+ latent periods of infectious diseases.
+
+ References
+ ----------
+ .. [1] Eckhard Limpert, Werner A. Stahel, and Markus Abbt, "Log-normal
+ Distributions across the Sciences: Keys and Clues", May 2001
+ Vol. 51 No. 5 BioScience
+ http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf
+ .. [2] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme
+ Values, Birkhauser Verlag, Basel, pp 31-32.
+ .. [3] Wikipedia, "Lognormal distribution",
+ http://en.wikipedia.org/wiki/Lognormal_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> mu, sigma = 3., 1. # mean and standard deviation
+ >>> s = np.random.lognormal(mu, sigma, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='center')
+
+ >>> x = np.linspace(min(bins), max(bins), 10000)
+ >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))
+ ... / (x * sigma * np.sqrt(2 * np.pi)))
+
+ >>> plt.plot(x, pdf, linewidth=2, color='r')
+ >>> plt.axis('tight')
+ >>> plt.show()
+
+ Demonstrate that taking the products of random samples from a uniform
+ distribution can be fit well by a log-normal probability density function.
+
+ >>> # Generate a thousand samples: each is the product of 100 random
+ >>> # values, drawn from a normal distribution.
+ >>> b = []
+ >>> for i in range(1000):
+ ... a = 10. + np.random.random(100)
+ ... b.append(np.product(a))
+
+ >>> b = np.array(b) / np.min(b) # scale values to be positive
+
+ >>> count, bins, ignored = plt.hist(b, 100, normed=True, align='center')
+
+ >>> sigma = np.std(np.log(b))
+ >>> mu = np.mean(np.log(b))
+
+ >>> x = np.linspace(min(bins), max(bins), 10000)
+ >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))
+ ... / (x * sigma * np.sqrt(2 * np.pi)))
+
+ >>> plt.plot(x, pdf, color='r', linewidth=2)
+ >>> plt.show()
+
+ """
+ cdef ndarray omean, osigma
+ cdef double fmean, fsigma
+
+ fmean = PyFloat_AsDouble(mean)
+ fsigma = PyFloat_AsDouble(sigma)
+
+ if not PyErr_Occurred():
+ if fsigma <= 0:
+ raise ValueError("sigma <= 0")
+ return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
+
+ PyErr_Clear()
+
+ omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED)
+ osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(osigma, 0.0)):
+ raise ValueError("sigma <= 0.0")
+ return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma)
+
+ def rayleigh(self, scale=1.0, size=None):
+ """
+ rayleigh(scale=1.0, size=None)
+
+ Rayleigh distribution.
+
+ """
+ cdef ndarray oscale
+ cdef double fscale
+
+ fscale = PyFloat_AsDouble(scale)
+
+ if not PyErr_Occurred():
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
+
+ PyErr_Clear()
+
+ oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oscale, 0.0)):
+ raise ValueError("scale <= 0.0")
+ return cont1_array(self.internal_state, rk_rayleigh, size, oscale)
+
+ def wald(self, mean, scale, size=None):
+ """
+ wald(mean, scale, size=None)
+
+ Wald (inverse Gaussian) distribution.
+
+ """
+ cdef ndarray omean, oscale
+ cdef double fmean, fscale
+
+ fmean = PyFloat_AsDouble(mean)
+ fscale = PyFloat_AsDouble(scale)
+ if not PyErr_Occurred():
+ if fmean <= 0:
+ raise ValueError("mean <= 0")
+ if fscale <= 0:
+ raise ValueError("scale <= 0")
+ return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
+
+ PyErr_Clear()
+ omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED)
+ oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(omean,0.0)):
+ raise ValueError("mean <= 0.0")
+ elif np.any(np.less_equal(oscale,0.0)):
+ raise ValueError("scale <= 0.0")
+ return cont2_array(self.internal_state, rk_wald, size, omean, oscale)
+
+
+
+ def triangular(self, left, mode, right, size=None):
+ """
+ triangular(left, mode, right, size=None)
+
+ Triangular distribution starting at left, peaking at mode, and
+ ending at right (left <= mode <= right).
+
+ """
+ cdef ndarray oleft, omode, oright
+ cdef double fleft, fmode, fright
+
+ fleft = PyFloat_AsDouble(left)
+ fright = PyFloat_AsDouble(right)
+ fmode = PyFloat_AsDouble(mode)
+ if not PyErr_Occurred():
+ if fleft > fmode:
+ raise ValueError("left > mode")
+ if fmode > fright:
+ raise ValueError("mode > right")
+ if fleft == fright:
+ raise ValueError("left == right")
+ return cont3_array_sc(self.internal_state, rk_triangular, size, fleft,
+ fmode, fright)
+
+ PyErr_Clear()
+ oleft = <ndarray>PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED)
+ omode = <ndarray>PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED)
+ oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED)
+
+ if np.any(np.greater(oleft, omode)):
+ raise ValueError("left > mode")
+ if np.any(np.greater(omode, oright)):
+ raise ValueError("mode > right")
+ if np.any(np.equal(oleft, oright)):
+ raise ValueError("left == right")
+ return cont3_array(self.internal_state, rk_triangular, size, oleft,
+ omode, oright)
+
+ # Complicated, discrete distributions:
+ def binomial(self, n, p, size=None):
+ """
+ binomial(n, p, size=None)
+
+ Draw samples from a binomial distribution.
+
+ Samples are drawn from a Binomial distribution with specified
+ parameters, n trials and p probability of success where
+ n an integer > 0 and p is in the interval [0,1]. (n may be
+ input as a float, but it is truncated to an integer in use)
+
+ Parameters
+ ----------
+ n : float (but truncated to an integer)
+ parameter, > 0.
+ p : float
+ parameter, >= 0 and <=1.
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ where the values are all integers in [0, n].
+
+ See Also
+ --------
+ scipy.stats.distributions.binom : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Binomial distribution is
+
+ .. math:: P(N) = \\binom{n}{N}p^N(1-p)^{n-N},
+
+ where :math:`n` is the number of trials, :math:`p` is the probability
+ of success, and :math:`N` is the number of successes.
+
+ When estimating the standard error of a proportion in a population by
+ using a random sample, the normal distribution works well unless the
+ product p*n <=5, where p = population proportion estimate, and n =
+ number of samples, in which case the binomial distribution is used
+ instead. For example, a sample of 15 people shows 4 who are left
+ handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4,
+ so the binomial distribution should be used in this case.
+
+ References
+ ----------
+ .. [1] Dalgaard, Peter, "Introductory Statistics with R",
+ Springer-Verlag, 2002.
+ .. [2] Glantz, Stanton A. "Primer of Biostatistics.", McGraw-Hill,
+ Fifth Edition, 2002.
+ .. [3] Lentner, Marvin, "Elementary Applied Statistics", Bogden
+ and Quigley, 1972.
+ .. [4] Weisstein, Eric W. "Binomial Distribution." From MathWorld--A
+ Wolfram Web Resource.
+ http://mathworld.wolfram.com/BinomialDistribution.html
+ .. [5] Wikipedia, "Binomial-distribution",
+ http://en.wikipedia.org/wiki/Binomial_distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> n, p = 10, .5 # number of trials, probability of each trial
+ >>> s = np.random.binomial(n, p, 1000)
+ # result of flipping a coin 10 times, tested 1000 times.
+
+ A real world example. A company drills 9 wild-cat oil exploration
+ wells, each with an estimated probability of success of 0.1. All nine
+ wells fail. What is the probability of that happening?
+
+ Let's do 20,000 trials of the model, and count the number that
+ generate zero positive results.
+
+ >>> sum(np.random.binomial(9,0.1,20000)==0)/20000.
+ answer = 0.38885, or 38%.
+
+ """
+ cdef ndarray on, op
+ cdef long ln
+ cdef double fp
+
+ fp = PyFloat_AsDouble(p)
+ ln = PyInt_AsLong(n)
+ if not PyErr_Occurred():
+ if ln <= 0:
+ raise ValueError("n <= 0")
+ if fp < 0:
+ raise ValueError("p < 0")
+ elif fp > 1:
+ raise ValueError("p > 1")
+ return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
+
+ PyErr_Clear()
+
+ on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED)
+ op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(n, 0)):
+ raise ValueError("n <= 0")
+ if np.any(np.less(p, 0)):
+ raise ValueError("p < 0")
+ if np.any(np.greater(p, 1)):
+ raise ValueError("p > 1")
+ return discnp_array(self.internal_state, rk_binomial, size, on, op)
+
+ def negative_binomial(self, n, p, size=None):
+ """
+ negative_binomial(n, p, size=None)
+
+ Negative Binomial distribution.
+
+ """
+ cdef ndarray on
+ cdef ndarray op
+ cdef double fn
+ cdef double fp
+
+ fp = PyFloat_AsDouble(p)
+ fn = PyFloat_AsDouble(n)
+ if not PyErr_Occurred():
+ if fn <= 0:
+ raise ValueError("n <= 0")
+ if fp < 0:
+ raise ValueError("p < 0")
+ elif fp > 1:
+ raise ValueError("p > 1")
+ return discdd_array_sc(self.internal_state, rk_negative_binomial,
+ size, fn, fp)
+
+ PyErr_Clear()
+
+ on = <ndarray>PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED)
+ op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(n, 0)):
+ raise ValueError("n <= 0")
+ if np.any(np.less(p, 0)):
+ raise ValueError("p < 0")
+ if np.any(np.greater(p, 1)):
+ raise ValueError("p > 1")
+ return discdd_array(self.internal_state, rk_negative_binomial, size,
+ on, op)
+
+ def poisson(self, lam=1.0, size=None):
+ """
+ poisson(lam=1.0, size=None)
+
+ Poisson distribution.
+
+ """
+ cdef ndarray olam
+ cdef double flam
+ flam = PyFloat_AsDouble(lam)
+ if not PyErr_Occurred():
+ if lam < 0:
+ raise ValueError("lam < 0")
+ return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+
+ PyErr_Clear()
+
+ olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less(olam, 0)):
+ raise ValueError("lam < 0")
+ return discd_array(self.internal_state, rk_poisson, size, olam)
+
+ def zipf(self, a, size=None):
+ """
+ zipf(a, size=None)
+
+ Draw samples from a Zipf distribution.
+
+ Samples are drawn from a Zipf distribution with specified parameter (a),
+ where a > 1.
+
+ The zipf distribution (also known as the zeta
+ distribution) is a continuous probability distribution that satisfies
+ Zipf's law, where the frequency of an item is inversely proportional to
+ its rank in a frequency table.
+
+ Parameters
+ ----------
+ a : float
+ parameter, > 1.
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ The returned samples are greater than or equal to one.
+
+ See Also
+ --------
+ scipy.stats.distributions.zipf : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Zipf distribution is
+
+ .. math:: p(x) = \\frac{x^{-a}}{\\zeta(a)},
+
+ where :math:`\\zeta` is the Riemann Zeta function.
+
+ Named after the American linguist George Kingsley Zipf, who noted that
+ the frequency of any word in a sample of a language is inversely
+ proportional to its rank in the frequency table.
+
+
+ References
+ ----------
+ .. [1] Weisstein, Eric W. "Zipf Distribution." From MathWorld--A Wolfram
+ Web Resource. http://mathworld.wolfram.com/ZipfDistribution.html
+ .. [2] Wikipedia, "Zeta distribution",
+ http://en.wikipedia.org/wiki/Zeta_distribution
+ .. [3] Wikipedia, "Zipf's Law",
+ http://en.wikipedia.org/wiki/Zipf%27s_law
+ .. [4] Zipf, George Kingsley (1932): Selected Studies of the Principle
+ of Relative Frequency in Language. Cambridge (Mass.).
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> a = 2. # parameter
+ >>> s = np.random.zipf(a, 1000)
+
+ Display the histogram of the samples, along with
+ the probability density function:
+
+ >>> import matplotlib.pyplot as plt
+ >>> import scipy.special as sps
+ Truncate s values at 50 so plot is interesting
+ >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)
+ >>> x = arange(1., 50.)
+ >>> y = x**(-a)/sps.zetac(a)
+ >>> plt.plot(x, y/max(y), linewidth=2, color='r')
+ >>> plt.show()
+
+ """
+ cdef ndarray oa
+ cdef double fa
+
+ fa = PyFloat_AsDouble(a)
+ if not PyErr_Occurred():
+ if fa <= 1.0:
+ raise ValueError("a <= 1.0")
+ return discd_array_sc(self.internal_state, rk_zipf, size, fa)
+
+ PyErr_Clear()
+
+ oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(oa, 1.0)):
+ raise ValueError("a <= 1.0")
+ return discd_array(self.internal_state, rk_zipf, size, oa)
+
+ def geometric(self, p, size=None):
+ """
+ geometric(p, size=None)
+
+ Draw samples from the geometric distribution.
+
+ Bernoulli trials are experiments with one of two outcomes:
+ success or failure (an example of such an experiment is flipping
+ a coin). The geometric distribution models the number of trials
+ that must be run in order to achieve success. It is therefore
+ supported on the positive integers, ``k = 1, 2, ...``.
+
+ The probability mass function of the geometric distribution is
+
+ .. math:: f(k) = (1 - p)^{k - 1} p
+
+ where `p` is the probability of success of an individual trial.
+
+ Parameters
+ ----------
+ p : float
+ The probability of success of an individual trial.
+ size : tuple of ints
+ Number of values to draw from the distribution. The output
+ is shaped according to `size`.
+
+ Returns
+ -------
+ out : ndarray
+ Samples from the geometric distribution, shaped according to
+ `size`.
+
+ Examples
+ --------
+ Draw ten thousand values from the geometric distribution,
+ with the probability of an individual success equal to 0.35:
+
+ >>> z = np.random.geometric(p=0.35, size=10000)
+
+ How many trials succeeded after a single run?
+
+ >>> (z == 1).sum() / 10000.
+ 0.34889999999999999 #random
+
+ """
+ cdef ndarray op
+ cdef double fp
+
+ fp = PyFloat_AsDouble(p)
+ if not PyErr_Occurred():
+ if fp < 0.0:
+ raise ValueError("p < 0.0")
+ if fp > 1.0:
+ raise ValueError("p > 1.0")
+ return discd_array_sc(self.internal_state, rk_geometric, size, fp)
+
+ PyErr_Clear()
+
+
+ op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less(op, 0.0)):
+ raise ValueError("p < 0.0")
+ if np.any(np.greater(op, 1.0)):
+ raise ValueError("p > 1.0")
+ return discd_array(self.internal_state, rk_geometric, size, op)
+
+ def hypergeometric(self, ngood, nbad, nsample, size=None):
+ """
+ hypergeometric(ngood, nbad, nsample, size=None)
+
+ Draw samples from a Hypergeometric distribution.
+
+ Samples are drawn from a Hypergeometric distribution with specified
+ parameters, ngood (ways to make a good selection), nbad (ways to make
+ a bad selection), and nsample = number of items sampled, which is less
+ than or equal to the sum ngood + nbad.
+
+ Parameters
+ ----------
+ ngood : float (but truncated to an integer)
+ parameter, > 0.
+ nbad : float
+ parameter, >= 0.
+ nsample : float
+ parameter, > 0 and <= ngood+nbad
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ where the values are all integers in [0, n].
+
+ See Also
+ --------
+ scipy.stats.distributions.hypergeom : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Hypergeometric distribution is
+
+ .. math:: P(x) = \\frac{\\binom{m}{n}\\binom{N-m}{n-x}}{\\binom{N}{n}},
+
+ where :math:`0 \\le x \\le m` and :math:`n+m-N \\le x \\le n`
+
+ for P(x) the probability of x successes, n = ngood, m = nbad, and
+ N = number of samples.
+
+ Consider an urn with black and white marbles in it, ngood of them
+ black and nbad are white. If you draw nsample balls without
+ replacement, then the Hypergeometric distribution describes the
+ distribution of black balls in the drawn sample.
+
+ Note that this distribution is very similar to the Binomial
+ distribution, except that in this case, samples are drawn without
+ replacement, whereas in the Binomial case samples are drawn with
+ replacement (or the sample space is infinite). As the sample space
+ becomes large, this distribution approaches the Binomial.
+
+ References
+ ----------
+ .. [1] Lentner, Marvin, "Elementary Applied Statistics", Bogden
+ and Quigley, 1972.
+ .. [2] Weisstein, Eric W. "Hypergeometric Distribution." From
+ MathWorld--A Wolfram Web Resource.
+ http://mathworld.wolfram.com/HypergeometricDistribution.html
+ .. [3] Wikipedia, "Hypergeometric-distribution",
+ http://en.wikipedia.org/wiki/Hypergeometric-distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> ngood, nbad, nsamp = 100, 2, 10
+ # number of good, number of bad, and number of samples
+ >>> s = np.random.hypergeometric(ngood, nbad, nsamp, 1000)
+ >>> hist(s)
+ # note that it is very unlikely to grab both bad items
+
+ Suppose you have an urn with 15 white and 15 black marbles.
+ If you pull 15 marbles at random, how likely is it that
+ 12 or more of them are one color?
+
+ >>> s = np.random.hypergeometric(15, 15, 15, 100000)
+ >>> sum(s>=12)/100000. + sum(s<=3)/100000.
+ # answer = 0.003 ... pretty unlikely!
+
+ """
+ cdef ndarray ongood, onbad, onsample
+ cdef long lngood, lnbad, lnsample
+
+ lngood = PyInt_AsLong(ngood)
+ lnbad = PyInt_AsLong(nbad)
+ lnsample = PyInt_AsLong(nsample)
+ if not PyErr_Occurred():
+ if ngood < 1:
+ raise ValueError("ngood < 1")
+ if nbad < 1:
+ raise ValueError("nbad < 1")
+ if nsample < 1:
+ raise ValueError("nsample < 1")
+ if ngood + nbad < nsample:
+ raise ValueError("ngood + nbad < nsample")
+ return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
+ lngood, lnbad, lnsample)
+
+
+ PyErr_Clear()
+
+ ongood = <ndarray>PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED)
+ onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED)
+ onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
+ if np.any(np.less(ongood, 1)):
+ raise ValueError("ngood < 1")
+ if np.any(np.less(onbad, 1)):
+ raise ValueError("nbad < 1")
+ if np.any(np.less(onsample, 1)):
+ raise ValueError("nsample < 1")
+ if np.any(np.less(np.add(ongood, onbad),onsample)):
+ raise ValueError("ngood + nbad < nsample")
+ return discnmN_array(self.internal_state, rk_hypergeometric, size,
+ ongood, onbad, onsample)
+
+ def logseries(self, p, size=None):
+ """
+ logseries(p, size=None)
+
+ Draw samples from a Logarithmic Series distribution.
+
+ Samples are drawn from a Log Series distribution with specified
+ parameter, p (probability, 0 < p < 1).
+
+ Parameters
+ ----------
+ loc : float
+
+ scale : float > 0.
+
+ size : {tuple, int}
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn.
+
+ Returns
+ -------
+ samples : {ndarray, scalar}
+ where the values are all integers in [0, n].
+
+ See Also
+ --------
+ scipy.stats.distributions.logser : probability density function,
+ distribution or cumulative density function, etc.
+
+ Notes
+ -----
+ The probability density for the Log Series distribution is
+
+ .. math:: P(k) = \\frac{-p^k}{k \\ln(1-p)},
+
+ where p = probability.
+
+ The Log Series distribution is frequently used to represent species
+ richness and occurrence, first proposed by Fisher, Corbet, and
+ Williams in 1943 [2]. It may also be used to model the numbers of
+ occupants seen in cars [3].
+
+ References
+ ----------
+ .. [1] Buzas, Martin A.; Culver, Stephen J., Understanding regional
+ species diversity through the log series distribution of
+ occurrences: BIODIVERSITY RESEARCH Diversity & Distributions,
+ Volume 5, Number 5, September 1999 , pp. 187-195(9).
+ .. [2] Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. The
+ relation between the number of species and the number of
+ individuals in a random sample of an animal population.
+ Journal of Animal Ecology, 12:42-58.
+ .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small
+ Data Sets, CRC Press, 1994.
+ .. [4] Wikipedia, "Logarithmic-distribution",
+ http://en.wikipedia.org/wiki/Logarithmic-distribution
+
+ Examples
+ --------
+ Draw samples from the distribution:
+
+ >>> a = .6
+ >>> s = np.random.logseries(a, 10000)
+ >>> count, bins, ignored = plt.hist(s)
+
+ # plot against distribution
+
+ >>> def logseries(k, p):
+ ... return -p**k/(k*log(1-p))
+ >>> plt.plot(bins, logseries(bins, a)*count.max()/\\
+ logseries(bins, a).max(),'r')
+ >>> plt.show()
+
+ """
+ cdef ndarray op
+ cdef double fp
+
+ fp = PyFloat_AsDouble(p)
+ if not PyErr_Occurred():
+ if fp <= 0.0:
+ raise ValueError("p <= 0.0")
+ if fp >= 1.0:
+ raise ValueError("p >= 1.0")
+ return discd_array_sc(self.internal_state, rk_logseries, size, fp)
+
+ PyErr_Clear()
+
+ op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ if np.any(np.less_equal(op, 0.0)):
+ raise ValueError("p <= 0.0")
+ if np.any(np.greater_equal(op, 1.0)):
+ raise ValueError("p >= 1.0")
+ return discd_array(self.internal_state, rk_logseries, size, op)
+
+ # Multivariate distributions:
+ def multivariate_normal(self, mean, cov, size=None):
+ """
+ multivariate_normal(mean, cov[, size])
+
+ Draw random samples from a multivariate normal distribution.
+
+ The multivariate normal, multinormal or Gaussian distribution is a
+ generalisation of the one-dimensional normal distribution to higher
+ dimensions.
+
+ Such a distribution is specified by its mean and covariance matrix,
+ which are analogous to the mean (average or "centre") and variance
+ (standard deviation squared or "width") of the one-dimensional normal
+ distribution.
+
+ Parameters
+ ----------
+ mean : (N,) ndarray
+ Mean of the N-dimensional distribution.
+ cov : (N,N) ndarray
+ Covariance matrix of the distribution.
+ size : tuple of ints, optional
+ Given a shape of, for example, (m,n,k), m*n*k samples are
+ generated, and packed in an m-by-n-by-k arrangement. Because each
+ sample is N-dimensional, the output shape is (m,n,k,N). If no
+ shape is specified, a single sample is returned.
+
+ Returns
+ -------
+ out : ndarray
+ The drawn samples, arranged according to `size`. If the
+ shape given is (m,n,...), then the shape of `out` is is
+ (m,n,...,N).
+
+ In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
+ value drawn from the distribution.
+
+ Notes
+ -----
+ The mean is a coordinate in N-dimensional space, which represents the
+ location where samples are most likely to be generated. This is
+ analogous to the peak of the bell curve for the one-dimensional or
+ univariate normal distribution.
+
+ Covariance indicates the level to which two variables vary together.
+ From the multivariate normal distribution, we draw N-dimensional
+ samples, :math:`X = [x_1, x_2, ... x_N]`. The covariance matrix
+ element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`.
+ The element :math:`C_{ii}` is the variance of :math:`x_i` (i.e. its
+ "spread").
+
+ Instead of specifying the full covariance matrix, popular
+ approximations include:
+
+ - Spherical covariance (`cov` is a multiple of the identity matrix)
+ - Diagonal covariance (`cov` has non-negative elements, and only on
+ the diagonal)
+
+ This geometrical property can be seen in two dimensions by plotting
+ generated data-points:
+
+ >>> mean = [0,0]
+ >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis
+
+ >>> import matplotlib.pyplot as plt
+ >>> x,y = np.random.multivariate_normal(mean,cov,5000).T
+ >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
+
+ Note that the covariance matrix must be non-negative definite.
+
+ References
+ ----------
+ .. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
+ Processes," 3rd ed., McGraw-Hill Companies, 1991
+ .. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
+ 2nd ed., Wiley, 2001.
+
+ Examples
+ --------
+ >>> mean = (1,2)
+ >>> cov = [[1,0],[1,0]]
+ >>> x = np.random.multivariate_normal(mean,cov,(3,3))
+ >>> x.shape
+ (3, 3, 2)
+
+ The following is probably true, given that 0.6 is roughly twice the
+ standard deviation:
+
+ >>> print list( (x[0,0,:] - mean) < 0.6 )
+ [True, True]
+
+ """
+ # Check preconditions on arguments
+ mean = np.array(mean)
+ cov = np.array(cov)
+ if size is None:
+ shape = []
+ else:
+ shape = size
+ if len(mean.shape) != 1:
+ raise ValueError("mean must be 1 dimensional")
+ if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):
+ raise ValueError("cov must be 2 dimensional and square")
+ if mean.shape[0] != cov.shape[0]:
+ raise ValueError("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 = self.standard_normal(np.multiply.reduce(final_shape))
+ x.shape = (np.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 dot(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 numpy.dual import svd
+ # XXX: we really should be doing this by Cholesky decomposition
+ (u,s,v) = svd(cov)
+ x = np.dot(x*np.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.
+ np.add(mean,x,x)
+ x.shape = tuple(final_shape)
+ return x
+
+ def multinomial(self, long n, object pvals, size=None):
+ """
+ multinomial(n, pvals, size=None)
+
+ Draw samples from a multinomial distribution.
+
+ The multinomial distribution is a multivariate generalisation of the
+ binomial distribution. Take an experiment with one of ``p``
+ possible outcomes. An example of such an experiment is throwing a dice,
+ where the outcome can be 1 through 6. Each sample drawn from the
+ distribution represents `n` such experiments. Its values,
+ ``X_i = [X_0, X_1, ..., X_p]``, represent the number of times the outcome
+ was ``i``.
+
+ Parameters
+ ----------
+ n : int
+ Number of experiments.
+ pvals : sequence of floats, length p
+ Probabilities of each of the ``p`` different outcomes. These
+ should sum to 1 (however, the last element is always assumed to
+ account for the remaining probability, as long as
+ ``sum(pvals[:-1]) <= 1)``.
+ size : tuple of ints
+ Given a `size` of ``(M, N, K)``, then ``M*N*K`` samples are drawn,
+ and the output shape becomes ``(M, N, K, p)``, since each sample
+ has shape ``(p,)``.
+
+ Examples
+ --------
+ Throw a dice 20 times:
+
+ >>> np.random.multinomial(20, [1/6.]*6, size=1)
+ array([[4, 1, 7, 5, 2, 1]])
+
+ It landed 4 times on 1, once on 2, etc.
+
+ Now, throw the dice 20 times, and 20 times again:
+
+ >>> np.random.multinomial(20, [1/6.]*6, size=2)
+ array([[3, 4, 3, 3, 4, 3],
+ [2, 4, 3, 4, 0, 7]])
+
+ For the first run, we threw 3 times 1, 4 times 2, etc. For the second,
+ we threw 2 times 1, 4 times 2, etc.
+
+ A loaded dice is more likely to land on number 6:
+
+ >>> np.random.multinomial(100, [1/7.]*5)
+ array([13, 16, 13, 16, 42])
+
+ """
+ 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, NPY_DOUBLE, 1, 1)
+ pix = <double*>parr.data
+
+ if kahan_sum(pix, d-1) > (1.0 + 1e-12):
+ raise ValueError("sum(pvals[:-1]) > 1.0")
+
+ if size is None:
+ shape = (d,)
+ elif type(size) is int:
+ shape = (size, d)
+ else:
+ shape = size + (d,)
+
+ multin = np.zeros(shape, 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
+
+ def dirichlet(self, object alpha, size=None):
+ """
+ dirichlet(alpha, size=None)
+
+ Draw samples from the Dirichlet distribution.
+
+ Draw `size` samples of dimension k from a Dirichlet distribution. A
+ Dirichlet-distributed random variable can be seen as a multivariate
+ generalization of a Beta distribution. Dirichlet pdf is the conjugate
+ prior of a multinomial in Bayesian inference.
+
+ Parameters
+ ----------
+ alpha : array
+ Parameter of the distribution (k dimension for sample of
+ dimension k).
+ size : array
+ Number of samples to draw.
+
+ Notes
+ -----
+ .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}
+
+ Uses the following property for computation: for each dimension,
+ draw a random sample y_i from a standard gamma generator of shape
+ `alpha_i`, then
+ :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is
+ Dirichlet distributed.
+
+ References
+ ----------
+ .. [1] David McKay, "Information Theory, Inference and Learning
+ Algorithms," chapter 23,
+ http://www.inference.phy.cam.ac.uk/mackay/
+
+ """
+
+ #=================
+ # Pure python algo
+ #=================
+ #alpha = N.atleast_1d(alpha)
+ #k = alpha.size
+
+ #if n == 1:
+ # val = N.zeros(k)
+ # for i in range(k):
+ # val[i] = sgamma(alpha[i], n)
+ # val /= N.sum(val)
+ #else:
+ # val = N.zeros((k, n))
+ # for i in range(k):
+ # val[i] = sgamma(alpha[i], n)
+ # val /= N.sum(val, axis = 0)
+ # val = val.T
+
+ #return val
+
+ cdef long k
+ cdef long totsize
+ cdef ndarray alpha_arr, val_arr
+ cdef double *alpha_data, *val_data
+ cdef long i, j
+ cdef double acc, invacc
+
+ k = len(alpha)
+ alpha_arr = <ndarray>PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1)
+ alpha_data = <double*>alpha_arr.data
+
+ if size is None:
+ shape = (k,)
+ elif type(size) is int:
+ shape = (size, k)
+ else:
+ shape = size + (k,)
+
+ diric = np.zeros(shape, np.float64)
+ val_arr = <ndarray>diric
+ val_data= <double*>val_arr.data
+
+ i = 0
+ totsize = PyArray_SIZE(val_arr)
+ while i < totsize:
+ acc = 0.0
+ for j from 0 <= j < k:
+ val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j])
+ acc = acc + val_data[i+j]
+ invacc = 1/acc
+ for j from 0 <= j < k:
+ val_data[i+j] = val_data[i+j] * invacc
+ i = i + k
+
+ return diric
+
+ # Shuffling and permutations:
+ def shuffle(self, object x):
+ """
+ shuffle(x)
+
+ Modify a sequence in-place by shuffling its contents.
+
+ """
+ cdef long i, j
+ cdef int copy
+
+ i = len(x) - 1
+ try:
+ j = len(x[0])
+ except:
+ j = 0
+
+ if (j == 0):
+ # adaptation of random.shuffle()
+ while i > 0:
+ j = rk_interval(i, self.internal_state)
+ x[i], x[j] = x[j], x[i]
+ i = i - 1
+ else:
+ # make copies
+ copy = hasattr(x[0], 'copy')
+ if copy:
+ while(i > 0):
+ j = rk_interval(i, self.internal_state)
+ x[i], x[j] = x[j].copy(), x[i].copy()
+ i = i - 1
+ else:
+ 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):
+ """
+ permutation(x)
+
+ Randomly permute a sequence, or return a permuted range.
+
+ Parameters
+ ----------
+ x : int or array_like
+ If `x` is an integer, randomly permute ``np.arange(x)``.
+ If `x` is an array, make a copy and shuffle the elements
+ randomly.
+
+ Returns
+ -------
+ out : ndarray
+ Permuted sequence or array range.
+
+ Examples
+ --------
+ >>> np.random.permutation(10)
+ array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6])
+
+ >>> np.random.permutation([1, 4, 9, 12, 15])
+ array([15, 1, 9, 4, 12])
+
+ """
+ if isinstance(x, (int, np.integer)):
+ arr = np.arange(x)
+ else:
+ arr = np.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
+dirichlet = _rand.dirichlet
+
+shuffle = _rand.shuffle
+permutation = _rand.permutation
diff --git a/numpy/random/mtrand/numpy.pxi b/numpy/random/mtrand/numpy.pxi
new file mode 100644
index 000000000..11cb8fac9
--- /dev/null
+++ b/numpy/random/mtrand/numpy.pxi
@@ -0,0 +1,133 @@
+# :Author: Travis Oliphant
+
+cdef extern from "numpy/arrayobject.h":
+
+ cdef enum NPY_TYPES:
+ NPY_BOOL
+ NPY_BYTE
+ NPY_UBYTE
+ NPY_SHORT
+ NPY_USHORT
+ NPY_INT
+ NPY_UINT
+ NPY_LONG
+ NPY_ULONG
+ NPY_LONGLONG
+ NPY_ULONGLONG
+ NPY_FLOAT
+ NPY_DOUBLE
+ NPY_LONGDOUBLE
+ NPY_CFLOAT
+ NPY_CDOUBLE
+ NPY_CLONGDOUBLE
+ NPY_OBJECT
+ NPY_STRING
+ NPY_UNICODE
+ NPY_VOID
+ NPY_NTYPES
+ NPY_NOTYPE
+
+ cdef enum requirements:
+ NPY_CONTIGUOUS
+ NPY_FORTRAN
+ NPY_OWNDATA
+ NPY_FORCECAST
+ NPY_ENSURECOPY
+ NPY_ENSUREARRAY
+ NPY_ELEMENTSTRIDES
+ NPY_ALIGNED
+ NPY_NOTSWAPPED
+ NPY_WRITEABLE
+ NPY_UPDATEIFCOPY
+ NPY_ARR_HAS_DESCR
+
+ NPY_BEHAVED
+ NPY_BEHAVED_NS
+ NPY_CARRAY
+ NPY_CARRAY_RO
+ NPY_FARRAY
+ NPY_FARRAY_RO
+ NPY_DEFAULT
+
+ NPY_IN_ARRAY
+ NPY_OUT_ARRAY
+ NPY_INOUT_ARRAY
+ NPY_IN_FARRAY
+ NPY_OUT_FARRAY
+ NPY_INOUT_FARRAY
+
+ NPY_UPDATE_ALL
+
+ cdef enum defines:
+ NPY_MAXDIMS
+
+ ctypedef struct npy_cdouble:
+ double real
+ double imag
+
+ ctypedef struct npy_cfloat:
+ double real
+ double imag
+
+ ctypedef int npy_intp
+
+ ctypedef extern class numpy.dtype [object PyArray_Descr]:
+ cdef int type_num, elsize, alignment
+ cdef char type, kind, byteorder, hasobject
+ cdef object fields, typeobj
+
+ ctypedef extern class numpy.ndarray [object PyArrayObject]:
+ cdef char *data
+ cdef int nd
+ cdef npy_intp *dimensions
+ cdef npy_intp *strides
+ cdef object base
+ cdef dtype descr
+ cdef int flags
+
+ ctypedef extern class numpy.flatiter [object PyArrayIterObject]:
+ cdef int nd_m1
+ cdef npy_intp index, size
+ cdef ndarray ao
+ cdef char *dataptr
+
+ ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]:
+ cdef int numiter
+ cdef npy_intp size, index
+ cdef int nd
+ cdef npy_intp *dimensions
+ cdef void **iters
+
+ object PyArray_ZEROS(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+ object PyArray_EMPTY(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+ dtype PyArray_DescrFromTypeNum(NPY_TYPES type_num)
+ object PyArray_SimpleNew(int ndims, npy_intp* dims, NPY_TYPES type_num)
+ int PyArray_Check(object obj)
+ object PyArray_ContiguousFromAny(object obj, NPY_TYPES type,
+ int mindim, int maxdim)
+ object PyArray_ContiguousFromObject(object obj, NPY_TYPES type,
+ int mindim, int maxdim)
+ npy_intp PyArray_SIZE(ndarray arr)
+ npy_intp PyArray_NBYTES(ndarray arr)
+ void *PyArray_DATA(ndarray arr)
+ object PyArray_FromAny(object obj, dtype newtype, int mindim, int maxdim,
+ int requirements, object context)
+ object PyArray_FROMANY(object obj, NPY_TYPES type_num, int min,
+ int max, int requirements)
+ object PyArray_NewFromDescr(object subtype, dtype newtype, int nd,
+ npy_intp* dims, npy_intp* strides, void* data,
+ int flags, object parent)
+
+ object PyArray_FROM_OTF(object obj, NPY_TYPES type, int flags)
+ object PyArray_EnsureArray(object)
+
+ object PyArray_MultiIterNew(int n, ...)
+
+ char *PyArray_MultiIter_DATA(broadcast multi, int i)
+ void PyArray_MultiIter_NEXTi(broadcast multi, int i)
+ void PyArray_MultiIter_NEXT(broadcast multi)
+
+ object PyArray_IterNew(object arr)
+ void PyArray_ITER_NEXT(flatiter it)
+
+ void import_array()
diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/mtrand/randomkit.c
new file mode 100644
index 000000000..0fbc40dfd
--- /dev/null
+++ b/numpy/random/mtrand/randomkit.c
@@ -0,0 +1,381 @@
+/* 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 <limits.h>
+#include <math.h>
+
+#ifdef _WIN32
+/* Windows */
+/* XXX: we have to use this ugly defined(__GNUC__) because it is not easy to
+ * detect the compiler used in distutils itself */
+#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND))
+/* FIXME: ideally, we should set this to the real version of MSVCRT. We need
+ * something higher than 0x601 to enable _ftime64 and co */
+#define __MSVCRT_VERSION__ 0x0700
+#include <time.h>
+#include <sys/timeb.h>
+/* mingw msvcr lib import wrongly export _ftime, which does not exist in the
+ * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which
+ * is available in those versions of the runtime
+ */
+#define _FTIME(x) _ftime64((x))
+#else
+#include <time.h>
+#include <sys/timeb.h>
+#define _FTIME(x) _ftime((x))
+#endif
+#ifndef RK_NO_WINCRYPT
+/* Windows crypto */
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#include <windows.h>
+#include <wincrypt.h>
+#endif
+#else
+/* Unix */
+#include <time.h>
+#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;
+ state->has_binomial = 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;
+ state->has_binomial = 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 */
+#if ULONG_MAX > 0xffffffffUL
+ if (max <= 0xffffffffUL) {
+ while ((value = (rk_random(state) & mask)) > max);
+ } else {
+ while ((value = (rk_ulong(state) & mask)) > max);
+ }
+#else
+ while ((value = (rk_ulong(state) & mask)) > max);
+#endif
+
+ 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/setup.py b/numpy/random/setup.py
new file mode 100644
index 000000000..dde3119b7
--- /dev/null
+++ b/numpy/random/setup.py
@@ -0,0 +1,69 @@
+from os.path import join, split, dirname
+import os
+import sys
+from distutils.dep_util import newer
+from distutils.msvccompiler import get_build_version as get_msvc_build_version
+
+def needs_mingw_ftime_workaround():
+ # We need the mingw workaround for _ftime if the msvc runtime version is
+ # 7.1 or above and we build with mingw ...
+ # ... but we can't easily detect compiler version outside distutils command
+ # context, so we will need to detect in randomkit whether we build with gcc
+ msver = get_msvc_build_version()
+ if msver and msver >= 8:
+ return True
+
+ return False
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration, get_mathlibs
+ config = Configuration('random',parent_package,top_path)
+
+ def generate_libraries(ext, build_dir):
+ config_cmd = config.get_config_cmd()
+ libs = get_mathlibs()
+ tc = testcode_wincrypt()
+ if config_cmd.try_run(tc):
+ libs.append('Advapi32')
+ ext.libraries.extend(libs)
+ return None
+
+ defs = []
+ if needs_mingw_ftime_workaround():
+ defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
+
+ libs = []
+ # Configure mtrand
+ config.add_extension('mtrand',
+ sources=[join('mtrand', x) for x in
+ ['mtrand.c', 'randomkit.c', 'initarray.c',
+ 'distributions.c']]+[generate_libraries],
+ libraries=libs,
+ depends = [join('mtrand','*.h'),
+ join('mtrand','*.pyx'),
+ join('mtrand','*.pxi'),
+ ],
+ define_macros = defs,
+ )
+
+ config.add_data_files(('.', join('mtrand', 'randomkit.h')))
+ config.add_data_dir('tests')
+
+ return config
+
+def testcode_wincrypt():
+ return """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+ return 0;
+#else
+ return 1;
+#endif
+}
+"""
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(configuration=configuration)
diff --git a/numpy/random/setupscons.py b/numpy/random/setupscons.py
new file mode 100644
index 000000000..f5342c39e
--- /dev/null
+++ b/numpy/random/setupscons.py
@@ -0,0 +1,40 @@
+import glob
+from os.path import join, split
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration, get_mathlibs
+ config = Configuration('random',parent_package,top_path)
+
+ source_files = [join('mtrand', i) for i in ['mtrand.c',
+ 'mtrand.pyx',
+ 'numpy.pxi',
+ 'randomkit.c',
+ 'randomkit.h',
+ 'Python.pxi',
+ 'initarray.c',
+ 'initarray.h',
+ 'distributions.c',
+ 'distributions.h',
+ ]]
+ config.add_sconscript('SConstruct', source_files = source_files)
+ config.add_data_files(('.', join('mtrand', 'randomkit.h')))
+ config.add_data_dir('tests')
+
+ return config
+
+def testcode_wincrypt():
+ return """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+ return 0;
+#else
+ return 1;
+#endif
+}
+"""
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(configuration=configuration)
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
new file mode 100644
index 000000000..8dae16fcb
--- /dev/null
+++ b/numpy/random/tests/test_random.py
@@ -0,0 +1,71 @@
+from numpy.testing import *
+from numpy import random
+import numpy as np
+
+class TestMultinomial(TestCase):
+ def test_basic(self):
+ random.multinomial(100, [0.2, 0.8])
+
+ def test_zero_probability(self):
+ random.multinomial(100, [0.2, 0.8, 0.0, 0.0, 0.0])
+
+ def test_int_negative_interval(self):
+ assert -5 <= random.randint(-5,-1) < -1
+ x = random.randint(-5,-1,5)
+ assert np.all(-5 <= x)
+ assert np.all(x < -1)
+
+
+class TestSetState(TestCase):
+ def setUp(self):
+ self.seed = 1234567890
+ self.prng = random.RandomState(self.seed)
+ self.state = self.prng.get_state()
+
+ def test_basic(self):
+ old = self.prng.tomaxint(16)
+ self.prng.set_state(self.state)
+ new = self.prng.tomaxint(16)
+ assert np.all(old == new)
+
+ def test_gaussian_reset(self):
+ """ Make sure the cached every-other-Gaussian is reset.
+ """
+ old = self.prng.standard_normal(size=3)
+ self.prng.set_state(self.state)
+ new = self.prng.standard_normal(size=3)
+ assert np.all(old == new)
+
+ def test_gaussian_reset_in_media_res(self):
+ """ When the state is saved with a cached Gaussian, make sure the cached
+ Gaussian is restored.
+ """
+ self.prng.standard_normal()
+ state = self.prng.get_state()
+ old = self.prng.standard_normal(size=3)
+ self.prng.set_state(state)
+ new = self.prng.standard_normal(size=3)
+ assert np.all(old == new)
+
+ def test_backwards_compatibility(self):
+ """ Make sure we can accept old state tuples that do not have the cached
+ Gaussian value.
+ """
+ old_state = self.state[:-2]
+ x1 = self.prng.standard_normal(size=16)
+ self.prng.set_state(old_state)
+ x2 = self.prng.standard_normal(size=16)
+ self.prng.set_state(self.state)
+ x3 = self.prng.standard_normal(size=16)
+ assert np.all(x1 == x2)
+ assert np.all(x1 == x3)
+
+ def test_negative_binomial(self):
+ """ Ensure that the negative binomial results take floating point
+ arguments without truncation.
+ """
+ self.prng.negative_binomial(0.5, 0.5)
+
+
+if __name__ == "__main__":
+ run_module_suite()